Skip to content

Commit c6909d6

Browse files
Wolfram SangWolfram Sang
authored andcommitted
i2c: slave: print warning if slave flag not set
Address collisions will be rare, but we should let the user know that slaves have their own address space nonetheless. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
1 parent cfa0327 commit c6909d6

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

drivers/i2c/i2c-core.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3017,6 +3017,10 @@ int i2c_slave_register(struct i2c_client *client, i2c_slave_cb_t slave_cb)
30173017
return -EINVAL;
30183018
}
30193019

3020+
if (!(client->flags & I2C_CLIENT_SLAVE))
3021+
dev_warn(&client->dev, "%s: client slave flag not set. You might see address collisions\n",
3022+
__func__);
3023+
30203024
if (!(client->flags & I2C_CLIENT_TEN)) {
30213025
/* Enforce stricter address checking */
30223026
ret = i2c_check_7bit_addr_validity_strict(client->addr);

0 commit comments

Comments
 (0)