diff options
author | Wolfram Sang <wsa+renesas@sang-engineering.com> | 2020-01-07 18:47:43 +0100 |
---|---|---|
committer | Wolfram Sang <wsa@the-dreams.de> | 2020-01-15 20:40:08 +0100 |
commit | 87e07437df936b5ebdccd5a847fd1801f36bef02 (patch) | |
tree | ba61eea618e25fb9cb27389187979b4b76c1d713 /drivers/i2c | |
parent | 90a3be9b194505165ecbbd9fe600818f5618dfbe (diff) | |
download | linux-87e07437df936b5ebdccd5a847fd1801f36bef02.tar.gz linux-87e07437df936b5ebdccd5a847fd1801f36bef02.tar.bz2 linux-87e07437df936b5ebdccd5a847fd1801f36bef02.zip |
i2c: i2c-core-base: convert to use i2c_new_client_device()
Move away from the deprecated API and return the shiny new ERRPTR where
useful.
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Diffstat (limited to 'drivers/i2c')
-rw-r--r-- | drivers/i2c/i2c-core-base.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/drivers/i2c/i2c-core-base.c b/drivers/i2c/i2c-core-base.c index 19d929948cd2..cefad0881942 100644 --- a/drivers/i2c/i2c-core-base.c +++ b/drivers/i2c/i2c-core-base.c @@ -831,8 +831,8 @@ EXPORT_SYMBOL_GPL(i2c_new_device); /** - * i2c_unregister_device - reverse effect of i2c_new_device() - * @client: value returned from i2c_new_device() + * i2c_unregister_device - reverse effect of i2c_new_*_device() + * @client: value returned from i2c_new_*_device() * Context: can sleep */ void i2c_unregister_device(struct i2c_client *client) @@ -1178,9 +1178,8 @@ static void i2c_scan_static_board_info(struct i2c_adapter *adapter) down_read(&__i2c_board_lock); list_for_each_entry(devinfo, &__i2c_board_list, list) { - if (devinfo->busnum == adapter->nr - && !i2c_new_device(adapter, - &devinfo->board_info)) + if (devinfo->busnum == adapter->nr && + IS_ERR(i2c_new_client_device(adapter, &devinfo->board_info))) dev_err(&adapter->dev, "Can't create device at 0x%02x\n", devinfo->board_info.addr); @@ -2167,8 +2166,8 @@ static int i2c_detect_address(struct i2c_client *temp_client, dev_dbg(&adapter->dev, "Creating %s at 0x%02x\n", info.type, info.addr); - client = i2c_new_device(adapter, &info); - if (client) + client = i2c_new_client_device(adapter, &info); + if (!IS_ERR(client)) list_add_tail(&client->detected, &driver->clients); else dev_err(&adapter->dev, "Failed creating %s at 0x%02x\n", |