[PATCH 1/3] i2c: atr: Allow unmapped addresses from nested ATRs
From: Tomi Valkeinen
Date: Fri Nov 22 2024 - 02:53:15 EST
From: Cosmin Tanislav <demonsingur@xxxxxxxxx>
i2c-atr translates the i2c transactions and forwards them to its parent
i2c bus. Any transaction to an i2c address that has not been mapped on
the i2c-atr will be rejected with an error.
However, if the parent i2c bus is another i2c-atr, the parent i2c-atr
gets a transaction to an i2c address that is not mapped in the parent
i2c-atr, and thus fails.
Relax the checks, and allow non-mapped transactions to fix this issue.
Signed-off-by: Cosmin Tanislav <demonsingur@xxxxxxxxx>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen+renesas@xxxxxxxxxxxxxxxx>
---
drivers/i2c/i2c-atr.c | 12 ++----------
1 file changed, 2 insertions(+), 10 deletions(-)
diff --git a/drivers/i2c/i2c-atr.c b/drivers/i2c/i2c-atr.c
index f21475ae5921..ef5adafa9bf4 100644
--- a/drivers/i2c/i2c-atr.c
+++ b/drivers/i2c/i2c-atr.c
@@ -134,7 +134,6 @@ i2c_atr_find_mapping_by_addr(const struct list_head *list, u16 phys_addr)
static int i2c_atr_map_msgs(struct i2c_atr_chan *chan, struct i2c_msg *msgs,
int num)
{
- struct i2c_atr *atr = chan->atr;
static struct i2c_atr_alias_pair *c2a;
int i;
@@ -157,15 +156,8 @@ static int i2c_atr_map_msgs(struct i2c_atr_chan *chan, struct i2c_msg *msgs,
c2a = i2c_atr_find_mapping_by_addr(&chan->alias_list,
msgs[i].addr);
- if (!c2a) {
- dev_err(atr->dev, "client 0x%02x not mapped!\n",
- msgs[i].addr);
-
- while (i--)
- msgs[i].addr = chan->orig_addrs[i];
-
- return -ENXIO;
- }
+ if (!c2a)
+ continue;
msgs[i].addr = c2a->alias;
}
--
2.43.0