drivers: core: clear wake irq in device_unbind_cleanup
PATCH 1/1 drivers: core: clear wake irq in device_unbind_cleanup
From: Peng Fan <[email protected]>
With dev_pm_clear_wake_irq in device_unbind_cleanup, there is no need to invoke dev_pm_clear_wake_irq in driver remove hook explicitly.
--- drivers/base/dd.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/base/dd.c +2 -0
@@ -26,6 +26,7 @@#include <linux/wait.h> #include <linux/async.h> #include <linux/pm_runtime.h> +#include <linux/pm_wakeirq.h> #include <linux/pinctrl/devinfo.h> #include <linux/slab.h>
@@ -556,6 +557,7 @@ static void device_unbind_cleanup(struct device *dev) dev->pm_domain->dismiss (dev);pm_runtime_reinit (dev);dev_pm_set_driver_flags (dev,0 ); +dev_pm_clear_wake_irq (dev); }static void device_remove (struct device *dev)
Signature · 1 line
2.37.1
Greg Kroah-Hartman
maintainerQuoted 26 lines · Peng Fan (OSS)
From: Peng Fan <[email protected]>
With
dev_pm_clear_wake_irqindevice_unbind_cleanup, there is no need to invokedev_pm_clear_wake_irqin driver remove hook explicitly.Cc Dmitry Torokhov <[email protected]>Cc Rob Herring <[email protected]>Cc Ulf Hansson <[email protected]>Signed-off-by Peng Fan <[email protected]>--- drivers/base/dd.c | 2 ++ 1 file changed, 2 insertions(+)drivers/base/dd.c +1
-0@@ -26,6 +26,7 @@#include <linux/wait.h> #include <linux/async.h> #include <linux/pm_runtime.h> +#include <linux/pm_wakeirq.h> #include <linux/pinctrl/devinfo.h> #include <linux/slab.h>
drivers/base/dd.c static void device_unbind_cleanup(struct device *dev) · line 560
Quoted 4 lines
drivers/base/dd.c +1
-0@@ -556,6 +557,7 @@ static void device_unbind_cleanup(struct device *dev) dev->pm_domain->dismiss (dev);pm_runtime_reinit (dev);dev_pm_set_driver_flags (dev,0 ); +dev_pm_clear_wake_irq (dev);
I don't understand, you say you don't need to invoke it, yet you are calling it here.
What commit id does this fix? And what bug is this resolving? What drivers are broken without this?
thanks,
greg k-h
Hi Greg
Quoted 32 lines
Subject: Re: [PATCH] drivers: core: clear wake irq in
device_unbind_cleanupQuoted 3 lines · Peng Fan (OSS)
From: Peng Fan <[email protected]>
With
dev_pm_clear_wake_irqindevice_unbind_cleanup, there is noneed
drivers/base/dd.c static void device_unbind_cleanup(struct
Quoted 23 lines
to invoke
dev_pm_clear_wake_irqin driver remove hook explicitly.Cc Dmitry Torokhov <[email protected]>Cc Rob Herring <[email protected]>Cc Ulf Hansson <[email protected]>Signed-off-by Peng Fan <[email protected]>--- drivers/base/dd.c | 2 ++ 1 file changed, 2 insertions(+)drivers/base/dd.c index renamed from drivers/base/dd.c +0
-0
f0e4b4aba885..ea3a871bdd11100644drivers/base/dd.c +1
-0@@ -26,6 +26,7 @@#include <linux/wait.h> #include <linux/async.h> #include <linux/pm_runtime.h> +#include <linux/pm_wakeirq.h> #include <linux/pinctrl/devinfo.h> #include <linux/slab.h> @@ -556,6 +557,7 @@ static void device_unbind_cleanup(structdevice *dev)
Quoted 7 lines
drivers/base/dd.c static void device_unbind_cleanup(struct device *dev) · line 560
Quoted 4 lines
drivers/base/dd.c +1
-0dev->pm_domain->dismiss (dev);pm_runtime_reinit (dev);dev_pm_set_driver_flags (dev,0 ); +dev_pm_clear_wake_irq (dev);I don't understand, you say you don't need to invoke it, yet you are calling it here.
I mean not need to invoke it in driver.remove hook. With this patch, we could remove
https://elixir.bootlin.com/linux/v6.11.7/source/drivers/input/touchscreen/ti_am335x_tsc.c#L498
and same to other drivers.
Quoted 2 lines
What commit id does this fix?
I am thinking to take this as a improvement, with core code has this, the various drivers no need explicitly invoke it in their own driver remove hook.
And what bug is this resolving? What
Quoted 1 line
drivers are broken without this?
See here:
https://lore.kernel.org/all/[email protected]/
Thanks,
Peng.
Quoted 4 lines
thanks,
greg k-h
Greg Kroah-Hartman
maintainerQuoted 42 lines · Peng Fan
Hi Greg
Quoted 32 lines
Subject: Re: [PATCH] drivers: core: clear wake irq in
device_unbind_cleanupQuoted 3 lines · Peng Fan (OSS)
From: Peng Fan <[email protected]>
With
dev_pm_clear_wake_irqindevice_unbind_cleanup, there is noneed
drivers/base/dd.c static void device_unbind_cleanup(struct
Quoted 23 lines
to invoke
dev_pm_clear_wake_irqin driver remove hook explicitly.Cc Dmitry Torokhov <[email protected]>Cc Rob Herring <[email protected]>Cc Ulf Hansson <[email protected]>Signed-off-by Peng Fan <[email protected]>--- drivers/base/dd.c | 2 ++ 1 file changed, 2 insertions(+)drivers/base/dd.c index renamed from drivers/base/dd.c +0
-0
f0e4b4aba885..ea3a871bdd11100644drivers/base/dd.c +1
-0@@ -26,6 +26,7 @@#include <linux/wait.h> #include <linux/async.h> #include <linux/pm_runtime.h> +#include <linux/pm_wakeirq.h> #include <linux/pinctrl/devinfo.h> #include <linux/slab.h> @@ -556,6 +557,7 @@ static void device_unbind_cleanup(structdevice *dev)
Quoted 7 lines
drivers/base/dd.c static void device_unbind_cleanup(struct device *dev) · line 560
Quoted 4 lines
drivers/base/dd.c +1
-0dev->pm_domain->dismiss (dev);pm_runtime_reinit (dev);dev_pm_set_driver_flags (dev,0 ); +dev_pm_clear_wake_irq (dev);I don't understand, you say you don't need to invoke it, yet you are calling it here.
Quoted 4 lines
I mean not need to invoke it in driver.remove hook. With this patch, we could remove
https://elixir.bootlin.com/linux/v6.11.7/source/drivers/input/touchscreen/ti_am335x_tsc.c#L498
and same to other drivers.
But you did not say that, and you would need to make this as part of a series.
Also, are you sure that ll drivers want to clear this irq flag? What is wrong with just doing it explicitly in the drivers that need it?
Quoted 7 lines
Quoted 2 lines
What commit id does this fix?
I am thinking to take this as a improvement, with core code has this, the various drivers no need explicitly invoke it in their own driver remove hook.
Quoted 5 lines
And what bug is this resolving? What
Quoted 1 line
drivers are broken without this?
Again, this seems to be a per-driver thing. What do you break if you attempt to do this for all drivers? What about drivers that share irqs?
How was this tested? On what platfoms?
thanks,
greg k-h
Quoted 48 lines
Subject: Re: [PATCH] drivers: core: clear wake irq in
device_unbind_cleanupQuoted 6 lines · Peng Fan
Hi Greg
Quoted 4 lines
Subject: Re: [PATCH] drivers: core: clear wake irq in
device_unbind_cleanupOn Mon, Nov 11, 2024 at 05:21:30PM +0800, Peng Fan (OSS)
Quoted 3 lines · wrote:
Quoted 3 lines
Quoted 3 lines
From: Peng Fan <[email protected]>
With
dev_pm_clear_wake_irqindevice_unbind_cleanup, there isno
Quoted 2 lines
Quoted 2 lines
need
Quoted 1 line
to invoke
dev_pm_clear_wake_irqin driver remove hookexplicitly.
Quoted 30 lines
Quoted 29 lines
drivers/base/dd.c static void device_unbind_cleanup(struct
Quoted 21 lines
Cc Dmitry Torokhov <[email protected]>Cc Rob Herring <[email protected]>Cc Ulf Hansson <[email protected]>Signed-off-by Peng Fan <[email protected]>--- drivers/base/dd.c | 2 ++ 1 file changed, 2 insertions(+)drivers/base/dd.c index renamed from drivers/base/dd.c +0
-0
f0e4b4aba885..ea3a871bdd11100644drivers/base/dd.c +1
-0@@ -26,6 +26,7 @@#include <linux/wait.h> #include <linux/async.h> #include <linux/pm_runtime.h> +#include <linux/pm_wakeirq.h> #include <linux/pinctrl/devinfo.h> #include <linux/slab.h> @@ -556,6 +557,7 @@ static void device_unbind_cleanup(structdevice *dev)
drivers/base/dd.c static void device_unbind_cleanup(struct device *dev) · line 560
Quoted 4 lines
drivers/base/dd.c +1
-0dev->pm_domain->dismiss (dev);pm_runtime_reinit (dev);dev_pm_set_driver_flags (dev,0 ); +dev_pm_clear_wake_irq (dev);I don't understand, you say you don't need to invoke it, yet you are calling it here.
Quoted 7 lines
Quoted 4 lines
I mean not need to invoke it in driver.remove hook. With this patch, we could remove
https://elixir.bootlin.com/linux/v6.11.7/source/drivers/input/touchscreen/ti_am335x_tsc.c#L498
and same to other drivers.But you did not say that, and you would need to make this as part of a series.
Sorry if I not describe clearly in commit log.
There are many drivers are invoking clear wake irq in their remove hook. I was thinking that if this patch got accepted, I could write a patch to clean up the various drivers.
Quoted 2 lines
Also, are you sure that ll drivers want to clear this irq flag?
Without clear the flag, module test will report a kernel that wake irq already initialized.
What is
Quoted 1 line
wrong with just doing it explicitly in the drivers that need it?
Nothing wrong.
Dmitry commented on my patch to see whether the clear wake irq could be done in driver core or not. So I did this patch.
Quoted 8 lines
Quoted 8 lines
Quoted 3 lines
What commit id does this fix?
I am thinking to take this as a improvement, with core code has this, the various drivers no need explicitly invoke it in their own driver remove hook.
Quoted 7 lines
Quoted 5 lines
And what bug is this resolving? What
Quoted 1 line
drivers are broken without this?
Again, this seems to be a per-driver thing.
If driver not set wake irq, clear wake irq does no harm. If driver set wake irq, clear wake irq in driver core could avoid various drivers doing this work.
What do you break if you
Quoted 1 line
attempt to do this for all drivers?
I could not guarantee on this. Sorry.
Quoted 1 line
What about drivers that share irqs?
From my understanding, wake irq here is per device, not related to shared irq.
Rafael, Ulf may help comment.
Quoted 2 lines
How was this tested? On what platfoms?
Test on NXP i.MX9 platform.
Anyway I put this patch as an optimization, if you think it is improper, I will go back to do a fix in the drivers/input/misc/nxp-bbnsm-pwrkey.c
Thanks,
Peng.
Quoted 4 lines
thanks,
greg k-h