mirror of
https://github.com/torvalds/linux.git
synced 2026-06-03 03:53:37 +02:00
i2c: atr: allow replacing mappings in attach_addr()
It is possible for aliases to be exhausted while we are still attaching children. Allow replacing mapping on attach by calling i2c_atr_replace_mapping_by_addr() if i2c_atr_create_mapping_by_addr() fails. Signed-off-by: Cosmin Tanislav <demonsingur@gmail.com> Reviewed-by: Luca Ceresoli <luca.ceresoli@bootlin.com> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
This commit is contained in:
parent
02426327e2
commit
b09d8a9cce
|
|
@ -543,6 +543,9 @@ static int i2c_atr_attach_addr(struct i2c_adapter *adapter,
|
|||
mutex_lock(&chan->alias_pairs_lock);
|
||||
|
||||
c2a = i2c_atr_create_mapping_by_addr(chan, addr);
|
||||
if (!c2a)
|
||||
c2a = i2c_atr_replace_mapping_by_addr(chan, addr);
|
||||
|
||||
if (!c2a) {
|
||||
dev_err(atr->dev, "failed to find a free alias\n");
|
||||
ret = -EBUSY;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user