* [PATCH] ACPI/PCI: PM: Add missing wakeup.flags.valid checks
@ 2019-05-16 10:42 Rafael J. Wysocki
2019-05-17 7:32 ` Mika Westerberg
2019-05-27 11:01 ` Rafael J. Wysocki
0 siblings, 2 replies; 3+ messages in thread
From: Rafael J. Wysocki @ 2019-05-16 10:42 UTC (permalink / raw)
To: Linux ACPI
Cc: Linux PM, LKML, Linux PCI, Bjorn Helgaas, Mika Westerberg,
Andy Shevchenko
From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Both acpi_pci_need_resume() and acpi_dev_needs_resume() check if the
current ACPI wakeup configuration of the device matches what is
expected as far as system wakeup from sleep states is concerned, as
reflected by the device_may_wakeup() return value for the device.
However, they only should do that if wakeup.flags.valid is set for
the device's ACPI companion, because otherwise the wakeup.prepare_count
value for it is meaningless.
Add the missing wakeup.flags.valid checks to these functions.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
drivers/acpi/device_pm.c | 4 ++--
drivers/pci/pci-acpi.c | 3 ++-
2 files changed, 4 insertions(+), 3 deletions(-)
Index: linux-pm/drivers/pci/pci-acpi.c
===================================================================
--- linux-pm.orig/drivers/pci/pci-acpi.c
+++ linux-pm/drivers/pci/pci-acpi.c
@@ -666,7 +666,8 @@ static bool acpi_pci_need_resume(struct
if (!adev || !acpi_device_power_manageable(adev))
return false;
- if (device_may_wakeup(&dev->dev) != !!adev->wakeup.prepare_count)
+ if (adev->wakeup.flags.valid &&
+ device_may_wakeup(&dev->dev) != !!adev->wakeup.prepare_count)
return true;
if (acpi_target_system_state() == ACPI_STATE_S0)
Index: linux-pm/drivers/acpi/device_pm.c
===================================================================
--- linux-pm.orig/drivers/acpi/device_pm.c
+++ linux-pm/drivers/acpi/device_pm.c
@@ -952,8 +952,8 @@ static bool acpi_dev_needs_resume(struct
u32 sys_target = acpi_target_system_state();
int ret, state;
- if (!pm_runtime_suspended(dev) || !adev ||
- device_may_wakeup(dev) != !!adev->wakeup.prepare_count)
+ if (!pm_runtime_suspended(dev) || !adev || (adev->wakeup.flags.valid &&
+ device_may_wakeup(dev) != !!adev->wakeup.prepare_count))
return true;
if (sys_target == ACPI_STATE_S0)
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] ACPI/PCI: PM: Add missing wakeup.flags.valid checks
2019-05-16 10:42 [PATCH] ACPI/PCI: PM: Add missing wakeup.flags.valid checks Rafael J. Wysocki
@ 2019-05-17 7:32 ` Mika Westerberg
2019-05-27 11:01 ` Rafael J. Wysocki
1 sibling, 0 replies; 3+ messages in thread
From: Mika Westerberg @ 2019-05-17 7:32 UTC (permalink / raw)
To: Rafael J. Wysocki
Cc: Linux ACPI, Linux PM, LKML, Linux PCI, Bjorn Helgaas, Andy Shevchenko
On Thu, May 16, 2019 at 12:42:20PM +0200, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
>
> Both acpi_pci_need_resume() and acpi_dev_needs_resume() check if the
> current ACPI wakeup configuration of the device matches what is
> expected as far as system wakeup from sleep states is concerned, as
> reflected by the device_may_wakeup() return value for the device.
>
> However, they only should do that if wakeup.flags.valid is set for
> the device's ACPI companion, because otherwise the wakeup.prepare_count
> value for it is meaningless.
>
> Add the missing wakeup.flags.valid checks to these functions.
>
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] ACPI/PCI: PM: Add missing wakeup.flags.valid checks
2019-05-16 10:42 [PATCH] ACPI/PCI: PM: Add missing wakeup.flags.valid checks Rafael J. Wysocki
2019-05-17 7:32 ` Mika Westerberg
@ 2019-05-27 11:01 ` Rafael J. Wysocki
1 sibling, 0 replies; 3+ messages in thread
From: Rafael J. Wysocki @ 2019-05-27 11:01 UTC (permalink / raw)
To: Rafael J. Wysocki, Bjorn Helgaas
Cc: Linux ACPI, Linux PM, LKML, Linux PCI, Mika Westerberg, Andy Shevchenko
On Thursday, May 16, 2019 12:42:20 PM CEST Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
>
> Both acpi_pci_need_resume() and acpi_dev_needs_resume() check if the
> current ACPI wakeup configuration of the device matches what is
> expected as far as system wakeup from sleep states is concerned, as
> reflected by the device_may_wakeup() return value for the device.
>
> However, they only should do that if wakeup.flags.valid is set for
> the device's ACPI companion, because otherwise the wakeup.prepare_count
> value for it is meaningless.
>
> Add the missing wakeup.flags.valid checks to these functions.
>
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> ---
> drivers/acpi/device_pm.c | 4 ++--
> drivers/pci/pci-acpi.c | 3 ++-
> 2 files changed, 4 insertions(+), 3 deletions(-)
>
> Index: linux-pm/drivers/pci/pci-acpi.c
> ===================================================================
> --- linux-pm.orig/drivers/pci/pci-acpi.c
> +++ linux-pm/drivers/pci/pci-acpi.c
> @@ -666,7 +666,8 @@ static bool acpi_pci_need_resume(struct
> if (!adev || !acpi_device_power_manageable(adev))
> return false;
>
> - if (device_may_wakeup(&dev->dev) != !!adev->wakeup.prepare_count)
> + if (adev->wakeup.flags.valid &&
> + device_may_wakeup(&dev->dev) != !!adev->wakeup.prepare_count)
> return true;
>
> if (acpi_target_system_state() == ACPI_STATE_S0)
> Index: linux-pm/drivers/acpi/device_pm.c
> ===================================================================
> --- linux-pm.orig/drivers/acpi/device_pm.c
> +++ linux-pm/drivers/acpi/device_pm.c
> @@ -952,8 +952,8 @@ static bool acpi_dev_needs_resume(struct
> u32 sys_target = acpi_target_system_state();
> int ret, state;
>
> - if (!pm_runtime_suspended(dev) || !adev ||
> - device_may_wakeup(dev) != !!adev->wakeup.prepare_count)
> + if (!pm_runtime_suspended(dev) || !adev || (adev->wakeup.flags.valid &&
> + device_may_wakeup(dev) != !!adev->wakeup.prepare_count))
> return true;
>
> if (sys_target == ACPI_STATE_S0)
Bjorn, I've assumed no concerns or objections from you regarding this one and
queued this up.
If that assumption is incorrect, please let me know.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-05-27 11:01 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-16 10:42 [PATCH] ACPI/PCI: PM: Add missing wakeup.flags.valid checks Rafael J. Wysocki
2019-05-17 7:32 ` Mika Westerberg
2019-05-27 11:01 ` 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).