i2c: i2c devices with the same device address can be registered on the same i2c bus.

(1) before: multiple i2c devices with the same address
            registered to the same i2c bus will fail.
(2) after:  multiple i2c devices with the same address
            registered to the same i2c bus just print
            the error log, but will not fail.

Fixes: b97a325b33 ("i2c: Devices which have some i2c addr can work in same i2c bus")
Change-Id: I53a2b5a988d96c32e64b8a426621cf894c9cba20
Signed-off-by: Wang Jie <dave.wang@rock-chips.com>
This commit is contained in:
Wang Jie
2019-10-30 17:47:44 +08:00
committed by Tao Huang
parent d68dc25527
commit c11ccaa96c

View File

@@ -769,7 +769,9 @@ i2c_new_device(struct i2c_adapter *adap, struct i2c_board_info const *info)
/* Check for address business */
status = i2c_check_addr_ex(adap, i2c_encode_flags_to_addr(client));
if (status)
goto out_err;
dev_err(&adap->dev,
"%d i2c clients have been registered at 0x%02x",
status, client->addr);
client->dev.parent = &client->adapter->dev;
client->dev.bus = &i2c_bus_type;
@@ -803,10 +805,6 @@ out_free_props:
device_remove_properties(&client->dev);
out_err_put_of_node:
of_node_put(info->of_node);
out_err:
dev_err(&adap->dev,
"Failed to register i2c client %s at 0x%02x (%d)\n",
client->name, client->addr, status);
out_err_silent:
kfree(client);
return NULL;