]> git.baikalelectronics.ru Git - kernel.git/commit
i2c: core: add device-managed version of i2c_new_dummy
authorHeiner Kallweit <hkallweit1@gmail.com>
Thu, 16 May 2019 21:13:09 +0000 (23:13 +0200)
committerWolfram Sang <wsa@the-dreams.de>
Fri, 17 May 2019 17:29:40 +0000 (19:29 +0200)
commit510f840250c4a4fd2273a3650d5bf65bc668864d
treeab82f4749c413824b6fe39bf0b763abaca19ad87
parent5fadfb336f1110f3a2822cb64a49b50a40626b95
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 <hkallweit1@gmail.com>
[wsa: rename new functions and fix minor kdoc issues]
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Reviewed-by: Peter Rosin <peda@axentia.se>
Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Reviewed-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Documentation/driver-model/devres.txt
drivers/i2c/i2c-core-base.c
include/linux/i2c.h