* [PATCH 0/1] platform: replace i2c_new_probed_device with an ERR_PTR variant @ 2019-12-16 12:29 Wolfram Sang 2019-12-16 12:29 ` [PATCH 1/1] platform: chrome: convert to i2c_new_scanned_device Wolfram Sang 0 siblings, 1 reply; 3+ messages in thread From: Wolfram Sang @ 2019-12-16 12:29 UTC (permalink / raw) To: linux-i2c; +Cc: Wolfram Sang, linux-kernel In the on-going mission to let i2c_new_* calls return an ERR_PTR instead of NULL, here is a series for this subsystem converting i2c_new_probed_device() to the newly introduced i2c_new_scanned_device(). Based on v5.5-rc1 and build tested. Please apply via your tree. Thanks, Wolfram Wolfram Sang (1): platform: chrome: convert to i2c_new_scanned_device drivers/platform/chrome/chromeos_laptop.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) -- 2.20.1 ^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 1/1] platform: chrome: convert to i2c_new_scanned_device 2019-12-16 12:29 [PATCH 0/1] platform: replace i2c_new_probed_device with an ERR_PTR variant Wolfram Sang @ 2019-12-16 12:29 ` Wolfram Sang 2019-12-17 9:53 ` Enric Balletbo i Serra 0 siblings, 1 reply; 3+ messages in thread From: Wolfram Sang @ 2019-12-16 12:29 UTC (permalink / raw) To: linux-i2c Cc: Wolfram Sang, Benson Leung, Enric Balletbo i Serra, linux-kernel Move from the deprecated i2c_new_probed_device() to the new i2c_new_scanned_device(). Make use of the new ERRPTR if suitable. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> --- Build tested only. drivers/platform/chrome/chromeos_laptop.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/drivers/platform/chrome/chromeos_laptop.c b/drivers/platform/chrome/chromeos_laptop.c index 8723bcf10c93..4f3651fcd9fe 100644 --- a/drivers/platform/chrome/chromeos_laptop.c +++ b/drivers/platform/chrome/chromeos_laptop.c @@ -63,7 +63,7 @@ struct acpi_peripheral { struct chromeos_laptop { /* * Note that we can't mark this pointer as const because - * i2c_new_probed_device() changes passed in I2C board info, so. + * i2c_new_scanned_device() changes passed in I2C board info, so. */ struct i2c_peripheral *i2c_peripherals; unsigned int num_i2c_peripherals; @@ -87,8 +87,8 @@ chromes_laptop_instantiate_i2c_device(struct i2c_adapter *adapter, * address we scan secondary addresses. In any case the client * structure gets assigned primary address. */ - client = i2c_new_probed_device(adapter, info, addr_list, NULL); - if (!client && alt_addr) { + client = i2c_new_scanned_device(adapter, info, addr_list, NULL); + if (IS_ERR(client) && alt_addr) { struct i2c_board_info dummy_info = { I2C_BOARD_INFO("dummy", info->addr), }; @@ -97,9 +97,9 @@ chromes_laptop_instantiate_i2c_device(struct i2c_adapter *adapter, }; struct i2c_client *dummy; - dummy = i2c_new_probed_device(adapter, &dummy_info, - alt_addr_list, NULL); - if (dummy) { + dummy = i2c_new_scanned_device(adapter, &dummy_info, + alt_addr_list, NULL); + if (!IS_ERR(dummy)) { pr_debug("%d-%02x is probed at %02x\n", adapter->nr, info->addr, dummy->addr); i2c_unregister_device(dummy); @@ -107,12 +107,14 @@ chromes_laptop_instantiate_i2c_device(struct i2c_adapter *adapter, } } - if (!client) + if (IS_ERR(client)) { + client = NULL; pr_debug("failed to register device %d-%02x\n", adapter->nr, info->addr); - else + } else { pr_debug("added i2c device %d-%02x\n", adapter->nr, info->addr); + } return client; } -- 2.20.1 ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 1/1] platform: chrome: convert to i2c_new_scanned_device 2019-12-16 12:29 ` [PATCH 1/1] platform: chrome: convert to i2c_new_scanned_device Wolfram Sang @ 2019-12-17 9:53 ` Enric Balletbo i Serra 0 siblings, 0 replies; 3+ messages in thread From: Enric Balletbo i Serra @ 2019-12-17 9:53 UTC (permalink / raw) To: Wolfram Sang, linux-i2c; +Cc: Benson Leung, linux-kernel Hi Wolfram, On 16/12/19 13:29, Wolfram Sang wrote: > Move from the deprecated i2c_new_probed_device() to the new > i2c_new_scanned_device(). Make use of the new ERRPTR if suitable. > > Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Applied for 5.6 Thanks, Enric > --- > Build tested only. > > drivers/platform/chrome/chromeos_laptop.c | 18 ++++++++++-------- > 1 file changed, 10 insertions(+), 8 deletions(-) > > diff --git a/drivers/platform/chrome/chromeos_laptop.c b/drivers/platform/chrome/chromeos_laptop.c > index 8723bcf10c93..4f3651fcd9fe 100644 > --- a/drivers/platform/chrome/chromeos_laptop.c > +++ b/drivers/platform/chrome/chromeos_laptop.c > @@ -63,7 +63,7 @@ struct acpi_peripheral { > struct chromeos_laptop { > /* > * Note that we can't mark this pointer as const because > - * i2c_new_probed_device() changes passed in I2C board info, so. > + * i2c_new_scanned_device() changes passed in I2C board info, so. > */ > struct i2c_peripheral *i2c_peripherals; > unsigned int num_i2c_peripherals; > @@ -87,8 +87,8 @@ chromes_laptop_instantiate_i2c_device(struct i2c_adapter *adapter, > * address we scan secondary addresses. In any case the client > * structure gets assigned primary address. > */ > - client = i2c_new_probed_device(adapter, info, addr_list, NULL); > - if (!client && alt_addr) { > + client = i2c_new_scanned_device(adapter, info, addr_list, NULL); > + if (IS_ERR(client) && alt_addr) { > struct i2c_board_info dummy_info = { > I2C_BOARD_INFO("dummy", info->addr), > }; > @@ -97,9 +97,9 @@ chromes_laptop_instantiate_i2c_device(struct i2c_adapter *adapter, > }; > struct i2c_client *dummy; > > - dummy = i2c_new_probed_device(adapter, &dummy_info, > - alt_addr_list, NULL); > - if (dummy) { > + dummy = i2c_new_scanned_device(adapter, &dummy_info, > + alt_addr_list, NULL); > + if (!IS_ERR(dummy)) { > pr_debug("%d-%02x is probed at %02x\n", > adapter->nr, info->addr, dummy->addr); > i2c_unregister_device(dummy); > @@ -107,12 +107,14 @@ chromes_laptop_instantiate_i2c_device(struct i2c_adapter *adapter, > } > } > > - if (!client) > + if (IS_ERR(client)) { > + client = NULL; > pr_debug("failed to register device %d-%02x\n", > adapter->nr, info->addr); > - else > + } else { > pr_debug("added i2c device %d-%02x\n", > adapter->nr, info->addr); > + } > > return client; > } > ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-12-17 9:53 UTC | newest] Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2019-12-16 12:29 [PATCH 0/1] platform: replace i2c_new_probed_device with an ERR_PTR variant Wolfram Sang 2019-12-16 12:29 ` [PATCH 1/1] platform: chrome: convert to i2c_new_scanned_device Wolfram Sang 2019-12-17 9:53 ` Enric Balletbo i Serra
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®