Commit c82ebf1b authored by Wolfram Sang's avatar Wolfram Sang Committed by Enric Balletbo i Serra

platform/chrome: chromeos_laptop: Convert to i2c_new_scanned_device

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: default avatarWolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: default avatarEnric Balletbo i Serra <enric.balletbo@collabora.com>
parent a69b4eeb
...@@ -63,7 +63,7 @@ struct acpi_peripheral { ...@@ -63,7 +63,7 @@ struct acpi_peripheral {
struct chromeos_laptop { struct chromeos_laptop {
/* /*
* Note that we can't mark this pointer as const because * 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; struct i2c_peripheral *i2c_peripherals;
unsigned int num_i2c_peripherals; unsigned int num_i2c_peripherals;
...@@ -87,8 +87,8 @@ chromes_laptop_instantiate_i2c_device(struct i2c_adapter *adapter, ...@@ -87,8 +87,8 @@ chromes_laptop_instantiate_i2c_device(struct i2c_adapter *adapter,
* address we scan secondary addresses. In any case the client * address we scan secondary addresses. In any case the client
* structure gets assigned primary address. * structure gets assigned primary address.
*/ */
client = i2c_new_probed_device(adapter, info, addr_list, NULL); client = i2c_new_scanned_device(adapter, info, addr_list, NULL);
if (!client && alt_addr) { if (IS_ERR(client) && alt_addr) {
struct i2c_board_info dummy_info = { struct i2c_board_info dummy_info = {
I2C_BOARD_INFO("dummy", info->addr), I2C_BOARD_INFO("dummy", info->addr),
}; };
...@@ -97,9 +97,9 @@ chromes_laptop_instantiate_i2c_device(struct i2c_adapter *adapter, ...@@ -97,9 +97,9 @@ chromes_laptop_instantiate_i2c_device(struct i2c_adapter *adapter,
}; };
struct i2c_client *dummy; struct i2c_client *dummy;
dummy = i2c_new_probed_device(adapter, &dummy_info, dummy = i2c_new_scanned_device(adapter, &dummy_info,
alt_addr_list, NULL); alt_addr_list, NULL);
if (dummy) { if (!IS_ERR(dummy)) {
pr_debug("%d-%02x is probed at %02x\n", pr_debug("%d-%02x is probed at %02x\n",
adapter->nr, info->addr, dummy->addr); adapter->nr, info->addr, dummy->addr);
i2c_unregister_device(dummy); i2c_unregister_device(dummy);
...@@ -107,12 +107,14 @@ chromes_laptop_instantiate_i2c_device(struct i2c_adapter *adapter, ...@@ -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", pr_debug("failed to register device %d-%02x\n",
adapter->nr, info->addr); adapter->nr, info->addr);
else } else {
pr_debug("added i2c device %d-%02x\n", pr_debug("added i2c device %d-%02x\n",
adapter->nr, info->addr); adapter->nr, info->addr);
}
return client; return client;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment