* [PATCH v2 0/3] i2c: atr: A few i2c-atr fixes
@ 2024-11-22 12:26 Tomi Valkeinen
2024-11-22 12:26 ` [PATCH v2 1/3] i2c: atr: Fix client detach Tomi Valkeinen
2024-11-22 14:13 ` [PATCH v2 0/3] i2c: atr: A few i2c-atr fixes Andy Shevchenko
0 siblings, 2 replies; 11+ messages in thread
From: Tomi Valkeinen @ 2024-11-22 12:26 UTC (permalink / raw)
To: Luca Ceresoli, Wolfram Sang, Andy Shevchenko, Sakari Ailus
Cc: linux-i2c, linux-kernel, Wolfram Sang, Mauro Carvalho Chehab,
Cosmin Tanislav, Tomi Valkeinen, Tomi Valkeinen, stable
The last two are perhaps not strictly fixes, as they essentially add
support for nested ATRs. The first one is a fix, thus stable is in cc.
Tomi
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
---
Changes in v2:
- Use mutext_init_with_key()
- Rearrange the series so that the fix is the first patch
- Link to v1: https://lore.kernel.org/r/20241122-i2c-atr-fixes-v1-0-62c51ce790be@ideasonboard.com
---
Cosmin Tanislav (1):
i2c: atr: Allow unmapped addresses from nested ATRs
Tomi Valkeinen (2):
i2c: atr: Fix client detach
i2c: atr: Fix lockdep for nested ATRs
drivers/i2c/i2c-atr.c | 27 ++++++++++++++-------------
1 file changed, 14 insertions(+), 13 deletions(-)
---
base-commit: adc218676eef25575469234709c2d87185ca223a
change-id: 20241121-i2c-atr-fixes-6d52b9f5f0c1
Best regards,
--
Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH v2 1/3] i2c: atr: Fix client detach
2024-11-22 12:26 [PATCH v2 0/3] i2c: atr: A few i2c-atr fixes Tomi Valkeinen
@ 2024-11-22 12:26 ` Tomi Valkeinen
2024-11-22 14:07 ` Andy Shevchenko
` (4 more replies)
2024-11-22 14:13 ` [PATCH v2 0/3] i2c: atr: A few i2c-atr fixes Andy Shevchenko
1 sibling, 5 replies; 11+ messages in thread
From: Tomi Valkeinen @ 2024-11-22 12:26 UTC (permalink / raw)
To: Luca Ceresoli, Wolfram Sang, Andy Shevchenko, Sakari Ailus
Cc: linux-i2c, linux-kernel, Wolfram Sang, Mauro Carvalho Chehab,
Cosmin Tanislav, Tomi Valkeinen, Tomi Valkeinen, stable
From: Tomi Valkeinen <tomi.valkeinen+renesas@ideasonboard.com>
i2c-atr catches the BUS_NOTIFY_DEL_DEVICE event on the bus and removes
the translation by calling i2c_atr_detach_client().
However, BUS_NOTIFY_DEL_DEVICE happens when the device is about to be
removed from this bus, i.e. before removal, and thus before calling
.remove() on the driver. If the driver happens to do any i2c
transactions in its remove(), they will fail.
Fix this by catching BUS_NOTIFY_REMOVED_DEVICE instead, thus removing
the translation only after the device is actually removed.
Fixes: a076a860acae ("media: i2c: add I2C Address Translator (ATR) support")
Cc: stable@vger.kernel.org
Signed-off-by: Tomi Valkeinen <tomi.valkeinen+renesas@ideasonboard.com>
---
drivers/i2c/i2c-atr.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/i2c/i2c-atr.c b/drivers/i2c/i2c-atr.c
index f21475ae5921..0d54d0b5e327 100644
--- a/drivers/i2c/i2c-atr.c
+++ b/drivers/i2c/i2c-atr.c
@@ -412,7 +412,7 @@ static int i2c_atr_bus_notifier_call(struct notifier_block *nb,
dev_name(dev), ret);
break;
- case BUS_NOTIFY_DEL_DEVICE:
+ case BUS_NOTIFY_REMOVED_DEVICE:
i2c_atr_detach_client(client->adapter, client);
break;
--
2.43.0
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH v2 1/3] i2c: atr: Fix client detach
2024-11-22 12:26 ` [PATCH v2 1/3] i2c: atr: Fix client detach Tomi Valkeinen
@ 2024-11-22 14:07 ` Andy Shevchenko
2024-12-10 8:01 ` Tomi Valkeinen
2024-11-26 8:14 ` Luca Ceresoli
` (3 subsequent siblings)
4 siblings, 1 reply; 11+ messages in thread
From: Andy Shevchenko @ 2024-11-22 14:07 UTC (permalink / raw)
To: Tomi Valkeinen
Cc: Luca Ceresoli, Wolfram Sang, Sakari Ailus, linux-i2c,
linux-kernel, Wolfram Sang, Mauro Carvalho Chehab,
Cosmin Tanislav, Tomi Valkeinen, stable
On Fri, Nov 22, 2024 at 02:26:18PM +0200, Tomi Valkeinen wrote:
> From: Tomi Valkeinen <tomi.valkeinen+renesas@ideasonboard.com>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen+renesas@ideasonboard.com>
We (used to?) have a check in Linux Next against missing SoB of the committer,
wouldn't this trap into it?
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v2 0/3] i2c: atr: A few i2c-atr fixes
2024-11-22 12:26 [PATCH v2 0/3] i2c: atr: A few i2c-atr fixes Tomi Valkeinen
2024-11-22 12:26 ` [PATCH v2 1/3] i2c: atr: Fix client detach Tomi Valkeinen
@ 2024-11-22 14:13 ` Andy Shevchenko
2024-12-03 8:06 ` Tomi Valkeinen
1 sibling, 1 reply; 11+ messages in thread
From: Andy Shevchenko @ 2024-11-22 14:13 UTC (permalink / raw)
To: Tomi Valkeinen
Cc: Luca Ceresoli, Wolfram Sang, Sakari Ailus, linux-i2c,
linux-kernel, Wolfram Sang, Mauro Carvalho Chehab,
Cosmin Tanislav, Tomi Valkeinen, stable
On Fri, Nov 22, 2024 at 02:26:17PM +0200, Tomi Valkeinen wrote:
> The last two are perhaps not strictly fixes, as they essentially add
> support for nested ATRs. The first one is a fix, thus stable is in cc.
Other than SoB chain issues, code wise LGTM,
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v2 1/3] i2c: atr: Fix client detach
2024-11-22 12:26 ` [PATCH v2 1/3] i2c: atr: Fix client detach Tomi Valkeinen
2024-11-22 14:07 ` Andy Shevchenko
@ 2024-11-26 8:14 ` Luca Ceresoli
2024-11-29 12:44 ` Tomi Valkeinen
2024-12-02 16:21 ` Romain Gantois
` (2 subsequent siblings)
4 siblings, 1 reply; 11+ messages in thread
From: Luca Ceresoli @ 2024-11-26 8:14 UTC (permalink / raw)
To: Tomi Valkeinen
Cc: Wolfram Sang, Andy Shevchenko, Sakari Ailus, linux-i2c,
linux-kernel, Wolfram Sang, Mauro Carvalho Chehab,
Cosmin Tanislav, Tomi Valkeinen, stable, Romain Gantois
Hello Tomi,
+Cc: Romain who is doing a different kind of sorcery on i2c-atr.c, so
he is aware of this series.
On Fri, 22 Nov 2024 14:26:18 +0200
Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> wrote:
> From: Tomi Valkeinen <tomi.valkeinen+renesas@ideasonboard.com>
>
> i2c-atr catches the BUS_NOTIFY_DEL_DEVICE event on the bus and removes
> the translation by calling i2c_atr_detach_client().
>
> However, BUS_NOTIFY_DEL_DEVICE happens when the device is about to be
> removed from this bus, i.e. before removal, and thus before calling
> .remove() on the driver. If the driver happens to do any i2c
> transactions in its remove(), they will fail.
>
> Fix this by catching BUS_NOTIFY_REMOVED_DEVICE instead, thus removing
> the translation only after the device is actually removed.
>
> Fixes: a076a860acae ("media: i2c: add I2C Address Translator (ATR) support")
> Cc: stable@vger.kernel.org
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen+renesas@ideasonboard.com>
Looks good:
Reviewed-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
--
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v2 1/3] i2c: atr: Fix client detach
2024-11-26 8:14 ` Luca Ceresoli
@ 2024-11-29 12:44 ` Tomi Valkeinen
0 siblings, 0 replies; 11+ messages in thread
From: Tomi Valkeinen @ 2024-11-29 12:44 UTC (permalink / raw)
To: Luca Ceresoli, Romain Gantois
Cc: Wolfram Sang, Andy Shevchenko, Sakari Ailus, linux-i2c,
linux-kernel, Wolfram Sang, Mauro Carvalho Chehab,
Cosmin Tanislav, Tomi Valkeinen, stable
Hi Romain,
On 26/11/2024 10:14, Luca Ceresoli wrote:
> Hello Tomi,
>
> +Cc: Romain who is doing a different kind of sorcery on i2c-atr.c, so
> he is aware of this series.
>
> On Fri, 22 Nov 2024 14:26:18 +0200
> Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> wrote:
>
>> From: Tomi Valkeinen <tomi.valkeinen+renesas@ideasonboard.com>
>>
>> i2c-atr catches the BUS_NOTIFY_DEL_DEVICE event on the bus and removes
>> the translation by calling i2c_atr_detach_client().
>>
>> However, BUS_NOTIFY_DEL_DEVICE happens when the device is about to be
>> removed from this bus, i.e. before removal, and thus before calling
>> .remove() on the driver. If the driver happens to do any i2c
>> transactions in its remove(), they will fail.
>>
>> Fix this by catching BUS_NOTIFY_REMOVED_DEVICE instead, thus removing
>> the translation only after the device is actually removed.
>>
>> Fixes: a076a860acae ("media: i2c: add I2C Address Translator (ATR) support")
>> Cc: stable@vger.kernel.org
>> Signed-off-by: Tomi Valkeinen <tomi.valkeinen+renesas@ideasonboard.com>
>
> Looks good:
> Reviewed-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
>
Can you test this one with your setup, and give your Rb/Tb?
I think it's an obvious fix, and could be merged separately from the
rest, which still need discussion.
Tomi
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v2 1/3] i2c: atr: Fix client detach
2024-11-22 12:26 ` [PATCH v2 1/3] i2c: atr: Fix client detach Tomi Valkeinen
2024-11-22 14:07 ` Andy Shevchenko
2024-11-26 8:14 ` Luca Ceresoli
@ 2024-12-02 16:21 ` Romain Gantois
2024-12-10 8:04 ` Tomi Valkeinen
2025-01-09 10:09 ` Wolfram Sang
4 siblings, 0 replies; 11+ messages in thread
From: Romain Gantois @ 2024-12-02 16:21 UTC (permalink / raw)
To: Luca Ceresoli, Wolfram Sang, Andy Shevchenko, Sakari Ailus,
Tomi Valkeinen
Cc: linux-i2c, linux-kernel, Wolfram Sang, Mauro Carvalho Chehab,
Cosmin Tanislav, Tomi Valkeinen, Tomi Valkeinen, stable
On vendredi 22 novembre 2024 13:26:18 heure normale d’Europe centrale Tomi
Valkeinen wrote:
> From: Tomi Valkeinen <tomi.valkeinen+renesas@ideasonboard.com>
>
> i2c-atr catches the BUS_NOTIFY_DEL_DEVICE event on the bus and removes
> the translation by calling i2c_atr_detach_client().
>
> However, BUS_NOTIFY_DEL_DEVICE happens when the device is about to be
> removed from this bus, i.e. before removal, and thus before calling
> .remove() on the driver. If the driver happens to do any i2c
> transactions in its remove(), they will fail.
>
> Fix this by catching BUS_NOTIFY_REMOVED_DEVICE instead, thus removing
> the translation only after the device is actually removed.
>
> Fixes: a076a860acae ("media: i2c: add I2C Address Translator (ATR) support")
> Cc: stable@vger.kernel.org
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen+renesas@ideasonboard.com>
> ---
> drivers/i2c/i2c-atr.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/i2c/i2c-atr.c b/drivers/i2c/i2c-atr.c
> index f21475ae5921..0d54d0b5e327 100644
> --- a/drivers/i2c/i2c-atr.c
> +++ b/drivers/i2c/i2c-atr.c
> @@ -412,7 +412,7 @@ static int i2c_atr_bus_notifier_call(struct
> notifier_block *nb, dev_name(dev), ret);
> break;
>
> - case BUS_NOTIFY_DEL_DEVICE:
> + case BUS_NOTIFY_REMOVED_DEVICE:
> i2c_atr_detach_client(client->adapter, client);
> break;
LGTM, tested on a TI FPC202 ATR.
Reviewed-by: Romain Gantois <romain.gantois@bootlin.com>
Tested-by: Romain Gantois <romain.gantois@bootlin.com>
--
Romain Gantois, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v2 0/3] i2c: atr: A few i2c-atr fixes
2024-11-22 14:13 ` [PATCH v2 0/3] i2c: atr: A few i2c-atr fixes Andy Shevchenko
@ 2024-12-03 8:06 ` Tomi Valkeinen
0 siblings, 0 replies; 11+ messages in thread
From: Tomi Valkeinen @ 2024-12-03 8:06 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Luca Ceresoli, Wolfram Sang, Sakari Ailus, linux-i2c,
linux-kernel, Wolfram Sang, Mauro Carvalho Chehab,
Cosmin Tanislav, Tomi Valkeinen, stable
Hi Andy,
On 22/11/2024 16:13, Andy Shevchenko wrote:
> On Fri, Nov 22, 2024 at 02:26:17PM +0200, Tomi Valkeinen wrote:
>> The last two are perhaps not strictly fixes, as they essentially add
>> support for nested ATRs. The first one is a fix, thus stable is in cc.
>
> Other than SoB chain issues, code wise LGTM,
> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Thanks. I'll try to figure that out. Looks like even if the committer in
my git tree is +renesas, b4 send still sends them with my normal email
address.
It's not hard to add both SoBs, but... it feels a bit silly.
Tomi
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v2 1/3] i2c: atr: Fix client detach
2024-11-22 14:07 ` Andy Shevchenko
@ 2024-12-10 8:01 ` Tomi Valkeinen
0 siblings, 0 replies; 11+ messages in thread
From: Tomi Valkeinen @ 2024-12-10 8:01 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Luca Ceresoli, Wolfram Sang, Sakari Ailus, linux-i2c,
linux-kernel, Wolfram Sang, Mauro Carvalho Chehab,
Cosmin Tanislav, Tomi Valkeinen, stable
Hi,
On 22/11/2024 16:07, Andy Shevchenko wrote:
> On Fri, Nov 22, 2024 at 02:26:18PM +0200, Tomi Valkeinen wrote:
>> From: Tomi Valkeinen <tomi.valkeinen+renesas@ideasonboard.com>
>
>> Signed-off-by: Tomi Valkeinen <tomi.valkeinen+renesas@ideasonboard.com>
>
> We (used to?) have a check in Linux Next against missing SoB of the committer,
> wouldn't this trap into it?
I don't think linux-next can check that. Or rather, it can, but the
committer there (which is the subsystem maintainer, probably) is not
related to the sender of this mail, so I don't think linux-next can
complain about this particular issue.
I didn't right away figure out how to easily change the From address for
the email with the standard tooling. As this is such a clear case of the
sender and the author being the same person, I'll just ignore this point
for now (although strictly speaking I think you're right).
Tomi
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v2 1/3] i2c: atr: Fix client detach
2024-11-22 12:26 ` [PATCH v2 1/3] i2c: atr: Fix client detach Tomi Valkeinen
` (2 preceding siblings ...)
2024-12-02 16:21 ` Romain Gantois
@ 2024-12-10 8:04 ` Tomi Valkeinen
2025-01-09 10:09 ` Wolfram Sang
4 siblings, 0 replies; 11+ messages in thread
From: Tomi Valkeinen @ 2024-12-10 8:04 UTC (permalink / raw)
To: Wolfram Sang
Cc: linux-i2c, linux-kernel, Mauro Carvalho Chehab, Cosmin Tanislav,
Tomi Valkeinen, stable, Luca Ceresoli, Wolfram Sang,
Andy Shevchenko, Sakari Ailus
Hi Wolfram,
On 22/11/2024 14:26, Tomi Valkeinen wrote:
> From: Tomi Valkeinen <tomi.valkeinen+renesas@ideasonboard.com>
>
> i2c-atr catches the BUS_NOTIFY_DEL_DEVICE event on the bus and removes
> the translation by calling i2c_atr_detach_client().
>
> However, BUS_NOTIFY_DEL_DEVICE happens when the device is about to be
> removed from this bus, i.e. before removal, and thus before calling
> .remove() on the driver. If the driver happens to do any i2c
> transactions in its remove(), they will fail.
>
> Fix this by catching BUS_NOTIFY_REMOVED_DEVICE instead, thus removing
> the translation only after the device is actually removed.
>
> Fixes: a076a860acae ("media: i2c: add I2C Address Translator (ATR) support")
> Cc: stable@vger.kernel.org
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen+renesas@ideasonboard.com>
> ---
> drivers/i2c/i2c-atr.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/i2c/i2c-atr.c b/drivers/i2c/i2c-atr.c
> index f21475ae5921..0d54d0b5e327 100644
> --- a/drivers/i2c/i2c-atr.c
> +++ b/drivers/i2c/i2c-atr.c
> @@ -412,7 +412,7 @@ static int i2c_atr_bus_notifier_call(struct notifier_block *nb,
> dev_name(dev), ret);
> break;
>
> - case BUS_NOTIFY_DEL_DEVICE:
> + case BUS_NOTIFY_REMOVED_DEVICE:
> i2c_atr_detach_client(client->adapter, client);
> break;
>
>
Can you pick this one up (ignore the two other patches in this series),
or should I send it as a separate patch?
Tomi
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v2 1/3] i2c: atr: Fix client detach
2024-11-22 12:26 ` [PATCH v2 1/3] i2c: atr: Fix client detach Tomi Valkeinen
` (3 preceding siblings ...)
2024-12-10 8:04 ` Tomi Valkeinen
@ 2025-01-09 10:09 ` Wolfram Sang
4 siblings, 0 replies; 11+ messages in thread
From: Wolfram Sang @ 2025-01-09 10:09 UTC (permalink / raw)
To: Tomi Valkeinen
Cc: Luca Ceresoli, Andy Shevchenko, Sakari Ailus, linux-i2c,
linux-kernel, Wolfram Sang, Mauro Carvalho Chehab,
Cosmin Tanislav, Tomi Valkeinen, stable
[-- Attachment #1: Type: text/plain, Size: 890 bytes --]
On Fri, Nov 22, 2024 at 02:26:18PM +0200, Tomi Valkeinen wrote:
> From: Tomi Valkeinen <tomi.valkeinen+renesas@ideasonboard.com>
>
> i2c-atr catches the BUS_NOTIFY_DEL_DEVICE event on the bus and removes
> the translation by calling i2c_atr_detach_client().
>
> However, BUS_NOTIFY_DEL_DEVICE happens when the device is about to be
> removed from this bus, i.e. before removal, and thus before calling
> .remove() on the driver. If the driver happens to do any i2c
> transactions in its remove(), they will fail.
>
> Fix this by catching BUS_NOTIFY_REMOVED_DEVICE instead, thus removing
> the translation only after the device is actually removed.
>
> Fixes: a076a860acae ("media: i2c: add I2C Address Translator (ATR) support")
> Cc: stable@vger.kernel.org
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen+renesas@ideasonboard.com>
Applied to for-current, thanks!
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2025-01-09 10:09 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-22 12:26 [PATCH v2 0/3] i2c: atr: A few i2c-atr fixes Tomi Valkeinen
2024-11-22 12:26 ` [PATCH v2 1/3] i2c: atr: Fix client detach Tomi Valkeinen
2024-11-22 14:07 ` Andy Shevchenko
2024-12-10 8:01 ` Tomi Valkeinen
2024-11-26 8:14 ` Luca Ceresoli
2024-11-29 12:44 ` Tomi Valkeinen
2024-12-02 16:21 ` Romain Gantois
2024-12-10 8:04 ` Tomi Valkeinen
2025-01-09 10:09 ` Wolfram Sang
2024-11-22 14:13 ` [PATCH v2 0/3] i2c: atr: A few i2c-atr fixes Andy Shevchenko
2024-12-03 8:06 ` Tomi Valkeinen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).