From b8f5fe3bc5b9318d95770a09a480c31aced20cd2 Mon Sep 17 00:00:00 2001 From: Heiner Kallweit Date: Thu, 16 May 2019 23:13:09 +0200 Subject: i2c: core: add device-managed version of i2c_new_dummy i2c_new_dummy is typically called from the probe function of the driver for the primary i2c client. It requires calls to i2c_unregister_device in the error path of the probe function and in the remove function. This can be simplified by introducing a device-managed version. Note the changed error case return value type: i2c_new_dummy returns NULL whilst devm_i2c_new_dummy_device returns an ERR_PTR. Signed-off-by: Heiner Kallweit [wsa: rename new functions and fix minor kdoc issues] Signed-off-by: Wolfram Sang Reviewed-by: Peter Rosin Reviewed-by: Kieran Bingham Reviewed-by: Bartosz Golaszewski Signed-off-by: Wolfram Sang --- include/linux/i2c.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'include') diff --git a/include/linux/i2c.h b/include/linux/i2c.h index be27062f8ed1..6c4db54714f6 100644 --- a/include/linux/i2c.h +++ b/include/linux/i2c.h @@ -469,6 +469,9 @@ extern int i2c_probe_func_quick_read(struct i2c_adapter *, unsigned short addr); extern struct i2c_client * i2c_new_dummy(struct i2c_adapter *adap, u16 address); +extern struct i2c_client * +devm_i2c_new_dummy_device(struct device *dev, struct i2c_adapter *adap, u16 address); + extern struct i2c_client * i2c_new_secondary_device(struct i2c_client *client, const char *name, -- cgit