Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1372453 > unrolled thread

[RFC PATCH] PM / wakeirq: fix wakeirq setting after wakup re-configuration from sysfs

Started byGrygorii Strashko <grygorii.strashko@ti.com>
First post2016-04-06 13:50 +0200
Last post2016-04-07 23:30 +0200
Articles 3 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [RFC PATCH] PM / wakeirq: fix wakeirq setting after wakup re-configuration from sysfs Grygorii Strashko <grygorii.strashko@ti.com> - 2016-04-06 13:50 +0200
    Re: [RFC PATCH] PM / wakeirq: fix wakeirq setting after wakup  re-configuration from sysfs Tony Lindgren <tony@atomide.com> - 2016-04-07 20:00 +0200
      Re: [RFC PATCH] PM / wakeirq: fix wakeirq setting after wakup re-configuration from sysfs "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2016-04-07 23:30 +0200

#1372453 — [RFC PATCH] PM / wakeirq: fix wakeirq setting after wakup re-configuration from sysfs

FromGrygorii Strashko <grygorii.strashko@ti.com>
Date2016-04-06 13:50 +0200
Subject[RFC PATCH] PM / wakeirq: fix wakeirq setting after wakup re-configuration from sysfs
Message-ID<rkU8b-3c1-27@gated-at.bofh.it>
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

[toc] | [next] | [standalone]


#1373613 — Re: [RFC PATCH] PM / wakeirq: fix wakeirq setting after wakup re-configuration from sysfs

FromTony Lindgren <tony@atomide.com>
Date2016-04-07 20:00 +0200
SubjectRe: [RFC PATCH] PM / wakeirq: fix wakeirq setting after wakup re-configuration from sysfs
Message-ID<rlmnN-7Av-23@gated-at.bofh.it>
In reply to#1372453
* 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>

[toc] | [prev] | [next] | [standalone]


#1373788

From"Rafael J. Wysocki" <rjw@rjwysocki.net>
Date2016-04-07 23:30 +0200
Message-ID<rlpF0-1zn-9@gated-at.bofh.it>
In reply to#1373613
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!

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web