[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20241122-i2c-atr-fixes-v2-2-0acd325b6916@ideasonboard.com>
Date: Fri, 22 Nov 2024 14:26:19 +0200
From: Tomi Valkeinen <tomi.valkeinen@...asonboard.com>
To: Luca Ceresoli <luca.ceresoli@...tlin.com>,
Wolfram Sang <wsa+renesas@...g-engineering.com>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Sakari Ailus <sakari.ailus@...ux.intel.com>
Cc: linux-i2c@...r.kernel.org, linux-kernel@...r.kernel.org,
Wolfram Sang <wsa@...nel.org>, Mauro Carvalho Chehab <mchehab@...nel.org>,
Cosmin Tanislav <demonsingur@...il.com>,
Tomi Valkeinen <tomi.valkeinen@...asonboard.com>,
Tomi Valkeinen <tomi.valkeinen+renesas@...asonboard.com>
Subject: [PATCH v2 2/3] i2c: atr: Allow unmapped addresses from nested ATRs
From: Cosmin Tanislav <demonsingur@...il.com>
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@...il.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen+renesas@...asonboard.com>
---
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 0d54d0b5e327..5adb720af84e 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
Powered by blists - more mailing lists