linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH] PM / wakeirq: fix wakeirq setting after wakup re-configuration from sysfs
@ 2016-04-06 11:45 Grygorii Strashko
  2016-04-07 17:56 ` Tony Lindgren
  0 siblings, 1 reply; 3+ messages in thread
From: Grygorii Strashko @ 2016-04-06 11:45 UTC (permalink / raw)
  To: linux-arm-kernel

Now wakeirq stops working for device if wakeup option for
this device will be reconfigured through sysfs, like:

echo disabled > /sys/devices/platform/extcon_usb1/power/wakeup
echo enabled > /sys/devices/platform/extcon_usb1/power/wakeup

Once above set of commands is executed the device's wakeup_source
opject will be recreated and dev->power.wakeup->wakeirq field will
contain NULL. As result, device_wakeup_arm_wake_irqs() will not arm
wakeirq for the affected device.

Hece, lets try to fix it in the following way:
  check for dev->wakeirq field when device_wakeup_attach() is called
  and if !NULL re-attach wakeirq to the device

Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
---
 drivers/base/power/wakeup.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/base/power/wakeup.c b/drivers/base/power/wakeup.c
index a2657f1..52a0c25 100644
--- a/drivers/base/power/wakeup.c
+++ b/drivers/base/power/wakeup.c
@@ -246,6 +246,8 @@ static int device_wakeup_attach(struct device *dev, struct wakeup_source *ws)
 		return -EEXIST;
 	}
 	dev->power.wakeup = ws;
+	if (dev->power.wakeirq)
+		device_wakeup_attach_irq(dev, dev->power.wakeirq);
 	spin_unlock_irq(&dev->power.lock);
 	return 0;
 }
-- 
2.8.0

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [RFC PATCH] PM / wakeirq: fix wakeirq setting after wakup re-configuration from sysfs
  2016-04-06 11:45 [RFC PATCH] PM / wakeirq: fix wakeirq setting after wakup re-configuration from sysfs Grygorii Strashko
@ 2016-04-07 17:56 ` Tony Lindgren
  2016-04-07 21:25   ` Rafael J. Wysocki
  0 siblings, 1 reply; 3+ messages in thread
From: Tony Lindgren @ 2016-04-07 17:56 UTC (permalink / raw)
  To: linux-arm-kernel

* Grygorii Strashko <grygorii.strashko@ti.com> [160406 04:47]:
> Now wakeirq stops working for device if wakeup option for
> this device will be reconfigured through sysfs, like:
> 
> echo disabled > /sys/devices/platform/extcon_usb1/power/wakeup
> echo enabled > /sys/devices/platform/extcon_usb1/power/wakeup
> 
> Once above set of commands is executed the device's wakeup_source
> opject will be recreated and dev->power.wakeup->wakeirq field will
> contain NULL. As result, device_wakeup_arm_wake_irqs() will not arm
> wakeirq for the affected device.
> 
> Hece, lets try to fix it in the following way:
>   check for dev->wakeirq field when device_wakeup_attach() is called
>   and if !NULL re-attach wakeirq to the device

Yeah I think that's all there is to it, thanks for fixing it:

Acked-by: Tony Lindgren <tony@atomide.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [RFC PATCH] PM / wakeirq: fix wakeirq setting after wakup re-configuration from sysfs
  2016-04-07 17:56 ` Tony Lindgren
@ 2016-04-07 21:25   ` Rafael J. Wysocki
  0 siblings, 0 replies; 3+ messages in thread
From: Rafael J. Wysocki @ 2016-04-07 21:25 UTC (permalink / raw)
  To: linux-arm-kernel

On Thursday, April 07, 2016 10:56:01 AM Tony Lindgren wrote:
> * Grygorii Strashko <grygorii.strashko@ti.com> [160406 04:47]:
> > Now wakeirq stops working for device if wakeup option for
> > this device will be reconfigured through sysfs, like:
> > 
> > echo disabled > /sys/devices/platform/extcon_usb1/power/wakeup
> > echo enabled > /sys/devices/platform/extcon_usb1/power/wakeup
> > 
> > Once above set of commands is executed the device's wakeup_source
> > opject will be recreated and dev->power.wakeup->wakeirq field will
> > contain NULL. As result, device_wakeup_arm_wake_irqs() will not arm
> > wakeirq for the affected device.
> > 
> > Hece, lets try to fix it in the following way:
> >   check for dev->wakeirq field when device_wakeup_attach() is called
> >   and if !NULL re-attach wakeirq to the device
> 
> Yeah I think that's all there is to it, thanks for fixing it:
> 
> Acked-by: Tony Lindgren <tony@atomide.com>

Applied, thanks!

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-04-07 21:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-06 11:45 [RFC PATCH] PM / wakeirq: fix wakeirq setting after wakup re-configuration from sysfs Grygorii Strashko
2016-04-07 17:56 ` Tony Lindgren
2016-04-07 21:25   ` Rafael J. Wysocki

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).