Home
last modified time | relevance | path

Searched hist:"7 bf4e594c28afc67bc120a380ca774e43ca496d8" (Results 1 – 3 of 3) sorted by relevance

/linux/drivers/base/power/
H A Dwakeirq.cdiff 7bf4e594c28afc67bc120a380ca774e43ca496d8 Fri Jan 05 02:18:42 CET 2018 Rafael J. Wysocki <rafael.j.wysocki@intel.com> PM / wakeup: Do not fail dev_pm_attach_wake_irq() unnecessarily

Returning an error code from dev_pm_attach_wake_irq() if
device_wakeup_attach_irq() called by it returns an error is
pointless, because the wakeup source used by it may be deleted
by user space via sysfs at any time and in particular right after
dev_pm_attach_wake_irq() has returned. Moreover, it requires
the callers of dev_pm_attach_wake_irq() to create that wakeup
source via device_wakeup_enable() upfront, but that obviously is
racy with respect to the sysfs-based manipulations of it.

To avoid the race, modify device_wakeup_attach_irq() to check
that the wakeup source it is going to use is there (and return
early otherwise), make it void (as it cannot fail after that
change) and make dev_pm_attach_wake_irq() simply call it for
the device unconditionally.

Tested-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
H A Dpower.hdiff 7bf4e594c28afc67bc120a380ca774e43ca496d8 Fri Jan 05 02:18:42 CET 2018 Rafael J. Wysocki <rafael.j.wysocki@intel.com> PM / wakeup: Do not fail dev_pm_attach_wake_irq() unnecessarily

Returning an error code from dev_pm_attach_wake_irq() if
device_wakeup_attach_irq() called by it returns an error is
pointless, because the wakeup source used by it may be deleted
by user space via sysfs at any time and in particular right after
dev_pm_attach_wake_irq() has returned. Moreover, it requires
the callers of dev_pm_attach_wake_irq() to create that wakeup
source via device_wakeup_enable() upfront, but that obviously is
racy with respect to the sysfs-based manipulations of it.

To avoid the race, modify device_wakeup_attach_irq() to check
that the wakeup source it is going to use is there (and return
early otherwise), make it void (as it cannot fail after that
change) and make dev_pm_attach_wake_irq() simply call it for
the device unconditionally.

Tested-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
H A Dwakeup.cdiff 7bf4e594c28afc67bc120a380ca774e43ca496d8 Fri Jan 05 02:18:42 CET 2018 Rafael J. Wysocki <rafael.j.wysocki@intel.com> PM / wakeup: Do not fail dev_pm_attach_wake_irq() unnecessarily

Returning an error code from dev_pm_attach_wake_irq() if
device_wakeup_attach_irq() called by it returns an error is
pointless, because the wakeup source used by it may be deleted
by user space via sysfs at any time and in particular right after
dev_pm_attach_wake_irq() has returned. Moreover, it requires
the callers of dev_pm_attach_wake_irq() to create that wakeup
source via device_wakeup_enable() upfront, but that obviously is
racy with respect to the sysfs-based manipulations of it.

To avoid the race, modify device_wakeup_attach_irq() to check
that the wakeup source it is going to use is there (and return
early otherwise), make it void (as it cannot fail after that
change) and make dev_pm_attach_wake_irq() simply call it for
the device unconditionally.

Tested-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>