* [PATCH] usb: typec: anx7411 - stop the IRQ before destroying the workqueue
@ 2026-09-03 8:22 Linkai Gong
2026-09-07 10:53 ` Heikki Krogerus
2026-09-08 6:03 ` [PATCH v2] " Linkai Gong
0 siblings, 2 replies; 8+ messages in thread
From: Linkai Gong @ 2026-09-03 8:22 UTC (permalink / raw)
To: Heikki Krogerus, Greg Kroah-Hartman
Cc: Xin Ji, linux-usb, linux-kernel, gonglinkai
The IRQ is devm-managed, so it can still queue plat->work while
remove() is tearing the queue down. Disable it first.
Fixes: fe6d8a9c8e64 ("usb: typec: anx7411: Add Analogix PD ANX7411 support")
Signed-off-by: Linkai Gong <gonglinkai@kylinos.cn>
---
drivers/usb/typec/anx7411.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/usb/typec/anx7411.c b/drivers/usb/typec/anx7411.c
index 41df115912b9..c3d36da692e4 100644
--- a/drivers/usb/typec/anx7411.c
+++ b/drivers/usb/typec/anx7411.c
@@ -1566,8 +1566,11 @@ static void anx7411_i2c_remove(struct i2c_client *client)
anx7411_partner_unregister_altmode(plat);
anx7411_unregister_partner(plat);
- if (plat->workqueue)
+ if (plat->workqueue) {
+ disable_irq(plat->intp_irq);
+ cancel_work_sync(&plat->work);
destroy_workqueue(plat->workqueue);
+ }
i2c_unregister_device(plat->spi_client);
--
2.25.1
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [PATCH] usb: typec: anx7411 - stop the IRQ before destroying the workqueue
2026-09-03 8:22 [PATCH] usb: typec: anx7411 - stop the IRQ before destroying the workqueue Linkai Gong
@ 2026-09-07 10:53 ` Heikki Krogerus
2026-09-08 3:16 ` Linkai Gong
2026-09-08 6:02 ` Linkai Gong
2026-09-08 6:03 ` [PATCH v2] " Linkai Gong
1 sibling, 2 replies; 8+ messages in thread
From: Heikki Krogerus @ 2026-09-07 10:53 UTC (permalink / raw)
To: Linkai Gong; +Cc: Greg Kroah-Hartman, Xin Ji, linux-usb, linux-kernel
On Thu, Sep 03, 2026 at 04:22:54PM +0800, Linkai Gong wrote:
> The IRQ is devm-managed, so it can still queue plat->work while
> remove() is tearing the queue down. Disable it first.
>
> Fixes: fe6d8a9c8e64 ("usb: typec: anx7411: Add Analogix PD ANX7411 support")
> Signed-off-by: Linkai Gong <gonglinkai@kylinos.cn>
> ---
> drivers/usb/typec/anx7411.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/usb/typec/anx7411.c b/drivers/usb/typec/anx7411.c
> index 41df115912b9..c3d36da692e4 100644
> --- a/drivers/usb/typec/anx7411.c
> +++ b/drivers/usb/typec/anx7411.c
> @@ -1566,8 +1566,11 @@ static void anx7411_i2c_remove(struct i2c_client *client)
> anx7411_partner_unregister_altmode(plat);
> anx7411_unregister_partner(plat);
>
> - if (plat->workqueue)
> + if (plat->workqueue) {
> + disable_irq(plat->intp_irq);
> + cancel_work_sync(&plat->work);
> destroy_workqueue(plat->workqueue);
> + }
Is the workqueu necessary at all? It's threaded irq.
Thanks,
> i2c_unregister_device(plat->spi_client);
>
> --
> 2.25.1
--
heikki
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [PATCH] usb: typec: anx7411 - stop the IRQ before destroying the workqueue
2026-09-07 10:53 ` Heikki Krogerus
@ 2026-09-08 3:16 ` Linkai Gong
2026-09-08 6:02 ` Linkai Gong
1 sibling, 0 replies; 8+ messages in thread
From: Linkai Gong @ 2026-09-08 3:16 UTC (permalink / raw)
To: Heikki Krogerus; +Cc: Greg Kroah-Hartman, Xin Ji, linux-usb, linux-kernel
On Mon, Sep 07, 2026 at 12:53:35PM +0200, Heikki Krogerus wrote:
> Is the workqueu necessary at all? It's threaded irq.
You are right. The threaded handler only queues work, so the
extra workqueue does not buy much.
I will send a v2 that runs the handler body in the threaded IRQ
and drops the workqueue. That also removes the remove() race.
Thanks,
Linkai
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] usb: typec: anx7411 - stop the IRQ before destroying the workqueue
2026-09-07 10:53 ` Heikki Krogerus
2026-09-08 3:16 ` Linkai Gong
@ 2026-09-08 6:02 ` Linkai Gong
1 sibling, 0 replies; 8+ messages in thread
From: Linkai Gong @ 2026-09-08 6:02 UTC (permalink / raw)
To: Heikki Krogerus; +Cc: Greg Kroah-Hartman, Xin Ji, linux-usb, linux-kernel
On Mon, Sep 07, 2026 at 12:53:35PM +0200, Heikki Krogerus wrote:
> Is the workqueu necessary at all? It's threaded irq.
Sorry, I spoke too soon. You are right that the workqueue looks
redundant, but I will keep this patch to the remove() race only.
I can drop the workqueue in a separate follow-up if you prefer.
Thanks,
Linkai
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v2] usb: typec: anx7411 - stop the IRQ before destroying the workqueue
2026-09-03 8:22 [PATCH] usb: typec: anx7411 - stop the IRQ before destroying the workqueue Linkai Gong
2026-09-07 10:53 ` Heikki Krogerus
@ 2026-09-08 6:03 ` Linkai Gong
2026-09-09 14:23 ` Heikki Krogerus
2026-09-10 1:11 ` [PATCH v3] " Linkai Gong
1 sibling, 2 replies; 8+ messages in thread
From: Linkai Gong @ 2026-09-08 6:03 UTC (permalink / raw)
To: Heikki Krogerus, Greg Kroah-Hartman; +Cc: Xin Ji, linux-usb, linux-kernel
The IRQ is devm-managed, so it can still queue plat->work while
remove() is tearing the queue down. Disable it first.
Fixes: fe6d8a9c8e64 ("usb: typec: anx7411: Add Analogix PD ANX7411 support")
Signed-off-by: Linkai Gong <gonglinkai@kylinos.cn>
---
v2:
- keep the minimal remove() race fix; drop the workqueue later if wanted
drivers/usb/typec/anx7411.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/usb/typec/anx7411.c b/drivers/usb/typec/anx7411.c
index 41df115912b9..c3d36da692e4 100644
--- a/drivers/usb/typec/anx7411.c
+++ b/drivers/usb/typec/anx7411.c
@@ -1566,8 +1566,11 @@ static void anx7411_i2c_remove(struct i2c_client *client)
anx7411_partner_unregister_altmode(plat);
anx7411_unregister_partner(plat);
- if (plat->workqueue)
+ if (plat->workqueue) {
+ disable_irq(plat->intp_irq);
+ cancel_work_sync(&plat->work);
destroy_workqueue(plat->workqueue);
+ }
i2c_unregister_device(plat->spi_client);
--
2.25.1
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [PATCH v2] usb: typec: anx7411 - stop the IRQ before destroying the workqueue
2026-09-08 6:03 ` [PATCH v2] " Linkai Gong
@ 2026-09-09 14:23 ` Heikki Krogerus
2026-09-10 1:13 ` Linkai Gong
2026-09-10 1:11 ` [PATCH v3] " Linkai Gong
1 sibling, 1 reply; 8+ messages in thread
From: Heikki Krogerus @ 2026-09-09 14:23 UTC (permalink / raw)
To: Linkai Gong; +Cc: Greg Kroah-Hartman, Xin Ji, linux-usb, linux-kernel
On Tue, Sep 08, 2026 at 02:03:33PM +0800, Linkai Gong wrote:
> The IRQ is devm-managed, so it can still queue plat->work while
> remove() is tearing the queue down. Disable it first.
>
> Fixes: fe6d8a9c8e64 ("usb: typec: anx7411: Add Analogix PD ANX7411 support")
Not for stable?
> Signed-off-by: Linkai Gong <gonglinkai@kylinos.cn>
> ---
> v2:
> - keep the minimal remove() race fix; drop the workqueue later if wanted
I don't see any difference compared to v1?
thanks,
> drivers/usb/typec/anx7411.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/usb/typec/anx7411.c b/drivers/usb/typec/anx7411.c
> index 41df115912b9..c3d36da692e4 100644
> --- a/drivers/usb/typec/anx7411.c
> +++ b/drivers/usb/typec/anx7411.c
> @@ -1566,8 +1566,11 @@ static void anx7411_i2c_remove(struct i2c_client *client)
> anx7411_partner_unregister_altmode(plat);
> anx7411_unregister_partner(plat);
>
> - if (plat->workqueue)
> + if (plat->workqueue) {
> + disable_irq(plat->intp_irq);
> + cancel_work_sync(&plat->work);
> destroy_workqueue(plat->workqueue);
> + }
>
> i2c_unregister_device(plat->spi_client);
>
> --
> 2.25.1
--
heikki
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [PATCH v2] usb: typec: anx7411 - stop the IRQ before destroying the workqueue
2026-09-09 14:23 ` Heikki Krogerus
@ 2026-09-10 1:13 ` Linkai Gong
0 siblings, 0 replies; 8+ messages in thread
From: Linkai Gong @ 2026-09-10 1:13 UTC (permalink / raw)
To: Heikki Krogerus
Cc: Greg Kroah-Hartman, Xin Ji, linux-usb, linux-kernel, gonglinkai
On Wed, Sep 09, 2026 at 04:23:14PM +0200, Heikki Krogerus wrote:
> Not for stable?
Yes, it should go to stable. The race has been there since the driver
was added. I will send a v3 with Cc: stable.
> I don't see any difference compared to v1?
Correct, the code is the same as v1. After your question about the
workqueue I only wanted to say I am keeping this minimal remove()
fix for now; I should have replied without posting an identical
patch. Sorry for the noise.
Thanks,
Linkai
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v3] usb: typec: anx7411 - stop the IRQ before destroying the workqueue
2026-09-08 6:03 ` [PATCH v2] " Linkai Gong
2026-09-09 14:23 ` Heikki Krogerus
@ 2026-09-10 1:11 ` Linkai Gong
1 sibling, 0 replies; 8+ messages in thread
From: Linkai Gong @ 2026-09-10 1:11 UTC (permalink / raw)
To: Heikki Krogerus, Greg Kroah-Hartman
Cc: Xin Ji, linux-usb, linux-kernel, stable, gonglinkai
The IRQ is devm-managed, so it can still queue plat->work while
remove() is tearing the queue down. Disable it first.
Fixes: fe6d8a9c8e64 ("usb: typec: anx7411: Add Analogix PD ANX7411 support")
Cc: stable@vger.kernel.org
Signed-off-by: Linkai Gong <gonglinkai@kylinos.cn>
---
v3:
- add Cc: stable (Heikki)
v2:
- keep the minimal remove() race fix; drop the workqueue later if wanted
(code unchanged from v1)
drivers/usb/typec/anx7411.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/usb/typec/anx7411.c b/drivers/usb/typec/anx7411.c
index 41df115912b9..c3d36da692e4 100644
--- a/drivers/usb/typec/anx7411.c
+++ b/drivers/usb/typec/anx7411.c
@@ -1566,8 +1566,11 @@ static void anx7411_i2c_remove(struct i2c_client *client)
anx7411_partner_unregister_altmode(plat);
anx7411_unregister_partner(plat);
- if (plat->workqueue)
+ if (plat->workqueue) {
+ disable_irq(plat->intp_irq);
+ cancel_work_sync(&plat->work);
destroy_workqueue(plat->workqueue);
+ }
i2c_unregister_device(plat->spi_client);
--
2.25.1
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2026-09-10 1:13 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-03 8:22 [PATCH] usb: typec: anx7411 - stop the IRQ before destroying the workqueue Linkai Gong
2026-09-07 10:53 ` Heikki Krogerus
2026-09-08 3:16 ` Linkai Gong
2026-09-08 6:02 ` Linkai Gong
2026-09-08 6:03 ` [PATCH v2] " Linkai Gong
2026-09-09 14:23 ` Heikki Krogerus
2026-09-10 1:13 ` Linkai Gong
2026-09-10 1:11 ` [PATCH v3] " Linkai Gong
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®