aboutsummaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorHeiner Kallweit <[email protected]>2019-05-16 23:13:09 +0200
committerWolfram Sang <[email protected]>2019-05-17 19:29:40 +0200
commitb8f5fe3bc5b9318d95770a09a480c31aced20cd2 (patch)
treeab82f4749c413824b6fe39bf0b763abaca19ad87 /include/linux
parent7159dbdae3c58d0200ae2550fab977a19a3c497a (diff)
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 <[email protected]> [wsa: rename new functions and fix minor kdoc issues] Signed-off-by: Wolfram Sang <[email protected]> Reviewed-by: Peter Rosin <[email protected]> Reviewed-by: Kieran Bingham <[email protected]> Reviewed-by: Bartosz Golaszewski <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/i2c.h3
1 files changed, 3 insertions, 0 deletions
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
@@ -470,6 +470,9 @@ 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,
u16 default_addr);