linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 0/2] PM: ACPI: PCI: Address issues related to signaling wakeup from bridges
@ 2020-11-24 19:41 Rafael J. Wysocki
  2020-11-24 19:44 ` [PATCH v1 1/2] PM: ACPI: PCI: Drop acpi_pm_set_bridge_wakeup() Rafael J. Wysocki
  2020-11-24 19:46 ` [PATCH v1 2/2] PM: ACPI: Refresh wakeup device power configuration every time Rafael J. Wysocki
  0 siblings, 2 replies; 6+ messages in thread
From: Rafael J. Wysocki @ 2020-11-24 19:41 UTC (permalink / raw)
  To: Linux ACPI
  Cc: LKML, Linux PM, Linux PCI, Mika Westerberg, Rafael J. Wysocki,
	Bjorn Helgaas, Kai-Heng Feng

Hi,

These patches fix two problems related to wakeup signaling configuration for
bridges.

The first one is that wakeup signaling may be disabled prematurely for a
bridge (patch [1/2]) and the second one is that device wakeup power
configuration may need to be changed when enabling wakeup signaling for
a bridge for the second (and every next) time in a row (patch [2/2]).

Please see patch changelogs for details.

Thanks!




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

* [PATCH v1 1/2] PM: ACPI: PCI: Drop acpi_pm_set_bridge_wakeup()
  2020-11-24 19:41 [PATCH v1 0/2] PM: ACPI: PCI: Address issues related to signaling wakeup from bridges Rafael J. Wysocki
@ 2020-11-24 19:44 ` Rafael J. Wysocki
  2020-11-25  8:06   ` Mika Westerberg
  2020-12-04 23:21   ` Bjorn Helgaas
  2020-11-24 19:46 ` [PATCH v1 2/2] PM: ACPI: Refresh wakeup device power configuration every time Rafael J. Wysocki
  1 sibling, 2 replies; 6+ messages in thread
From: Rafael J. Wysocki @ 2020-11-24 19:44 UTC (permalink / raw)
  To: Linux ACPI
  Cc: LKML, Linux PM, Linux PCI, Mika Westerberg, Rafael J. Wysocki,
	Bjorn Helgaas, Kai-Heng Feng

From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

The idea behind acpi_pm_set_bridge_wakeup() was to allow bridges to
be reference counted for wakeup enabling, because they may be enabled
to signal wakeup on behalf of their subordinate devices and that
may happen for multiple times in a row, whereas for the other devices
it only makes sense to enable wakeup signaling once.

However, this becomes problematic if the bridge itself is suspended,
because it is treated as a "regular" device in that case and the
reference counting doesn't work.

For instance, suppose that there are two devices below a bridge and
they both can signal wakeup.  Every time one of them is suspended,
wakeup signaling is enabled for the bridge, so when they both have
been suspended, the bridge's wakeup reference counter value is 2.

Say that the bridge is suspended subsequently and acpi_pci_wakeup()
is called for it.  Because the bridge can signal wakeup, that
function will invoke acpi_pm_set_device_wakeup() to configure it
and __acpi_pm_set_device_wakeup() will be called with the last
argument equal to 1.  This causes __acpi_device_wakeup_enable()
invoked by it to omit the reference counting, because the reference
counter of the target device (the bridge) is 2 at that time.

Now say that the bridge resumes and one of the device below it
resumes too, so the bridge's reference counter becomes 0 and
wakeup signaling is disabled for it, but there is still the other
suspended device which may need the bridge to signal wakeup on its
behalf and that is not going to work.

To address this scenario, use wakeup enable reference counting for
all devices, not just for bridges, so drop the last argument from
__acpi_device_wakeup_enable() and __acpi_pm_set_device_wakeup(),
which causes acpi_pm_set_device_wakeup() and
acpi_pm_set_bridge_wakeup() to become identical, so drop the latter
and use the former instead of it everywhere.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
 drivers/acpi/device_pm.c |   41 ++++++++++++-----------------------------
 drivers/pci/pci-acpi.c   |    4 ++--
 include/acpi/acpi_bus.h  |    5 -----
 3 files changed, 14 insertions(+), 36 deletions(-)

Index: linux-pm/include/acpi/acpi_bus.h
===================================================================
--- linux-pm.orig/include/acpi/acpi_bus.h
+++ linux-pm/include/acpi/acpi_bus.h
@@ -620,7 +620,6 @@ acpi_status acpi_remove_pm_notifier(stru
 bool acpi_pm_device_can_wakeup(struct device *dev);
 int acpi_pm_device_sleep_state(struct device *, int *, int);
 int acpi_pm_set_device_wakeup(struct device *dev, bool enable);
-int acpi_pm_set_bridge_wakeup(struct device *dev, bool enable);
 #else
 static inline void acpi_pm_wakeup_event(struct device *dev)
 {
@@ -651,10 +650,6 @@ static inline int acpi_pm_set_device_wak
 {
 	return -ENODEV;
 }
-static inline int acpi_pm_set_bridge_wakeup(struct device *dev, bool enable)
-{
-	return -ENODEV;
-}
 #endif
 
 #ifdef CONFIG_ACPI_SYSTEM_POWER_STATES_SUPPORT
Index: linux-pm/drivers/acpi/device_pm.c
===================================================================
--- linux-pm.orig/drivers/acpi/device_pm.c
+++ linux-pm/drivers/acpi/device_pm.c
@@ -749,7 +749,7 @@ static void acpi_pm_notify_work_func(str
 static DEFINE_MUTEX(acpi_wakeup_lock);
 
 static int __acpi_device_wakeup_enable(struct acpi_device *adev,
-				       u32 target_state, int max_count)
+				       u32 target_state)
 {
 	struct acpi_device_wakeup *wakeup = &adev->wakeup;
 	acpi_status status;
@@ -757,9 +757,10 @@ static int __acpi_device_wakeup_enable(s
 
 	mutex_lock(&acpi_wakeup_lock);
 
-	if (wakeup->enable_count >= max_count)
+	if (wakeup->enable_count >= INT_MAX) {
+		acpi_handle_info(adev->handle, "Wakeup enable count out of bounds!\n");
 		goto out;
-
+	}
 	if (wakeup->enable_count > 0)
 		goto inc;
 
@@ -799,7 +800,7 @@ out:
  */
 static int acpi_device_wakeup_enable(struct acpi_device *adev, u32 target_state)
 {
-	return __acpi_device_wakeup_enable(adev, target_state, 1);
+	return __acpi_device_wakeup_enable(adev, target_state);
 }
 
 /**
@@ -829,8 +830,12 @@ out:
 	mutex_unlock(&acpi_wakeup_lock);
 }
 
-static int __acpi_pm_set_device_wakeup(struct device *dev, bool enable,
-				       int max_count)
+/**
+ * acpi_pm_set_device_wakeup - Enable/disable remote wakeup for given device.
+ * @dev: Device to enable/disable to generate wakeup events.
+ * @enable: Whether to enable or disable the wakeup functionality.
+ */
+int acpi_pm_set_device_wakeup(struct device *dev, bool enable)
 {
 	struct acpi_device *adev;
 	int error;
@@ -850,37 +855,15 @@ static int __acpi_pm_set_device_wakeup(s
 		return 0;
 	}
 
-	error = __acpi_device_wakeup_enable(adev, acpi_target_system_state(),
-					    max_count);
+	error = __acpi_device_wakeup_enable(adev, acpi_target_system_state());
 	if (!error)
 		dev_dbg(dev, "Wakeup enabled by ACPI\n");
 
 	return error;
 }
-
-/**
- * acpi_pm_set_device_wakeup - Enable/disable remote wakeup for given device.
- * @dev: Device to enable/disable to generate wakeup events.
- * @enable: Whether to enable or disable the wakeup functionality.
- */
-int acpi_pm_set_device_wakeup(struct device *dev, bool enable)
-{
-	return __acpi_pm_set_device_wakeup(dev, enable, 1);
-}
 EXPORT_SYMBOL_GPL(acpi_pm_set_device_wakeup);
 
 /**
- * acpi_pm_set_bridge_wakeup - Enable/disable remote wakeup for given bridge.
- * @dev: Bridge device to enable/disable to generate wakeup events.
- * @enable: Whether to enable or disable the wakeup functionality.
- */
-int acpi_pm_set_bridge_wakeup(struct device *dev, bool enable)
-{
-	return __acpi_pm_set_device_wakeup(dev, enable, INT_MAX);
-}
-EXPORT_SYMBOL_GPL(acpi_pm_set_bridge_wakeup);
-
-/**
  * acpi_dev_pm_low_power - Put ACPI device into a low-power state.
  * @dev: Device to put into a low-power state.
  * @adev: ACPI device node corresponding to @dev.
Index: linux-pm/drivers/pci/pci-acpi.c
===================================================================
--- linux-pm.orig/drivers/pci/pci-acpi.c
+++ linux-pm/drivers/pci/pci-acpi.c
@@ -1060,7 +1060,7 @@ static int acpi_pci_propagate_wakeup(str
 {
 	while (bus->parent) {
 		if (acpi_pm_device_can_wakeup(&bus->self->dev))
-			return acpi_pm_set_bridge_wakeup(&bus->self->dev, enable);
+			return acpi_pm_set_device_wakeup(&bus->self->dev, enable);
 
 		bus = bus->parent;
 	}
@@ -1068,7 +1068,7 @@ static int acpi_pci_propagate_wakeup(str
 	/* We have reached the root bus. */
 	if (bus->bridge) {
 		if (acpi_pm_device_can_wakeup(bus->bridge))
-			return acpi_pm_set_bridge_wakeup(bus->bridge, enable);
+			return acpi_pm_set_device_wakeup(bus->bridge, enable);
 	}
 	return 0;
 }




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

* [PATCH v1 2/2] PM: ACPI: Refresh wakeup device power configuration every time
  2020-11-24 19:41 [PATCH v1 0/2] PM: ACPI: PCI: Address issues related to signaling wakeup from bridges Rafael J. Wysocki
  2020-11-24 19:44 ` [PATCH v1 1/2] PM: ACPI: PCI: Drop acpi_pm_set_bridge_wakeup() Rafael J. Wysocki
@ 2020-11-24 19:46 ` Rafael J. Wysocki
  2020-11-25  8:09   ` Mika Westerberg
  1 sibling, 1 reply; 6+ messages in thread
From: Rafael J. Wysocki @ 2020-11-24 19:46 UTC (permalink / raw)
  To: Linux ACPI
  Cc: LKML, Linux PM, Linux PCI, Mika Westerberg, Rafael J. Wysocki,
	Bjorn Helgaas, Kai-Heng Feng

From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

When wakeup signaling is enabled for a bridge for the second (or every
next) time in a row, its existing device wakeup power configuration
may not match the new conditions.  For example, some devices below
it may have been put into low-power states and that changes the
device wakeup power conditions or similar.  This causes functional
problems to appear on some systems (for example,  because of it the
Thunderbolt port on Dell Precision 5550 cannot detect devices plugged
in after it has been suspended).

For this reason, modify __acpi_device_wakeup_enable() to refresh the
device wakeup power configuration of the target device on every
invocation, not just when it is called for that device first time
in a row.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reported-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
Tested-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
---
 drivers/acpi/device_pm.c |   27 ++++++++++++++++++++-------
 1 file changed, 20 insertions(+), 7 deletions(-)

Index: linux-pm/drivers/acpi/device_pm.c
===================================================================
--- linux-pm.orig/drivers/acpi/device_pm.c
+++ linux-pm/drivers/acpi/device_pm.c
@@ -757,16 +757,26 @@ static int __acpi_device_wakeup_enable(s
 
 	mutex_lock(&acpi_wakeup_lock);
 
-	if (wakeup->enable_count >= INT_MAX) {
-		acpi_handle_info(adev->handle, "Wakeup enable count out of bounds!\n");
-		goto out;
-	}
+	/*
+	 * If the device wakeup power is already enabled, disable it and enable
+	 * it again in case it depends on the configuration of subordinate
+	 * devices and the conditions have changed since it was enabled last
+	 * time.
+	 */
 	if (wakeup->enable_count > 0)
-		goto inc;
+		acpi_disable_wakeup_device_power(adev);
 
 	error = acpi_enable_wakeup_device_power(adev, target_state);
-	if (error)
+	if (error) {
+		if (wakeup->enable_count > 0) {
+			acpi_disable_gpe(wakeup->gpe_device, wakeup->gpe_number);
+			wakeup->enable_count = 0;
+		}
 		goto out;
+	}
+
+	if (wakeup->enable_count > 0)
+		goto inc;
 
 	status = acpi_enable_gpe(wakeup->gpe_device, wakeup->gpe_number);
 	if (ACPI_FAILURE(status)) {
@@ -779,7 +789,10 @@ static int __acpi_device_wakeup_enable(s
 			  (unsigned int)wakeup->gpe_number);
 
 inc:
-	wakeup->enable_count++;
+	if (wakeup->enable_count < INT_MAX)
+		wakeup->enable_count++;
+	else
+		acpi_handle_info(adev->handle, "Wakeup enable count out of bounds!\n");
 
 out:
 	mutex_unlock(&acpi_wakeup_lock);




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

* Re: [PATCH v1 1/2] PM: ACPI: PCI: Drop acpi_pm_set_bridge_wakeup()
  2020-11-24 19:44 ` [PATCH v1 1/2] PM: ACPI: PCI: Drop acpi_pm_set_bridge_wakeup() Rafael J. Wysocki
@ 2020-11-25  8:06   ` Mika Westerberg
  2020-12-04 23:21   ` Bjorn Helgaas
  1 sibling, 0 replies; 6+ messages in thread
From: Mika Westerberg @ 2020-11-25  8:06 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Linux ACPI, LKML, Linux PM, Linux PCI, Rafael J. Wysocki,
	Bjorn Helgaas, Kai-Heng Feng

On Tue, Nov 24, 2020 at 08:44:00PM +0100, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> 
> The idea behind acpi_pm_set_bridge_wakeup() was to allow bridges to
> be reference counted for wakeup enabling, because they may be enabled
> to signal wakeup on behalf of their subordinate devices and that
> may happen for multiple times in a row, whereas for the other devices
> it only makes sense to enable wakeup signaling once.
> 
> However, this becomes problematic if the bridge itself is suspended,
> because it is treated as a "regular" device in that case and the
> reference counting doesn't work.
> 
> For instance, suppose that there are two devices below a bridge and
> they both can signal wakeup.  Every time one of them is suspended,
> wakeup signaling is enabled for the bridge, so when they both have
> been suspended, the bridge's wakeup reference counter value is 2.
> 
> Say that the bridge is suspended subsequently and acpi_pci_wakeup()
> is called for it.  Because the bridge can signal wakeup, that
> function will invoke acpi_pm_set_device_wakeup() to configure it
> and __acpi_pm_set_device_wakeup() will be called with the last
> argument equal to 1.  This causes __acpi_device_wakeup_enable()
> invoked by it to omit the reference counting, because the reference
> counter of the target device (the bridge) is 2 at that time.
> 
> Now say that the bridge resumes and one of the device below it
> resumes too, so the bridge's reference counter becomes 0 and
> wakeup signaling is disabled for it, but there is still the other
> suspended device which may need the bridge to signal wakeup on its
> behalf and that is not going to work.
> 
> To address this scenario, use wakeup enable reference counting for
> all devices, not just for bridges, so drop the last argument from
> __acpi_device_wakeup_enable() and __acpi_pm_set_device_wakeup(),
> which causes acpi_pm_set_device_wakeup() and
> acpi_pm_set_bridge_wakeup() to become identical, so drop the latter
> and use the former instead of it everywhere.
> 
> 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] 6+ messages in thread

* Re: [PATCH v1 2/2] PM: ACPI: Refresh wakeup device power configuration every time
  2020-11-24 19:46 ` [PATCH v1 2/2] PM: ACPI: Refresh wakeup device power configuration every time Rafael J. Wysocki
@ 2020-11-25  8:09   ` Mika Westerberg
  0 siblings, 0 replies; 6+ messages in thread
From: Mika Westerberg @ 2020-11-25  8:09 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Linux ACPI, LKML, Linux PM, Linux PCI, Rafael J. Wysocki,
	Bjorn Helgaas, Kai-Heng Feng

On Tue, Nov 24, 2020 at 08:46:38PM +0100, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> 
> When wakeup signaling is enabled for a bridge for the second (or every
> next) time in a row, its existing device wakeup power configuration
> may not match the new conditions.  For example, some devices below
> it may have been put into low-power states and that changes the
> device wakeup power conditions or similar.  This causes functional
> problems to appear on some systems (for example,  because of it the
> Thunderbolt port on Dell Precision 5550 cannot detect devices plugged
> in after it has been suspended).
> 
> For this reason, modify __acpi_device_wakeup_enable() to refresh the
> device wakeup power configuration of the target device on every
> invocation, not just when it is called for that device first time
> in a row.
> 
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> Reported-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
> Tested-by: Kai-Heng Feng <kai.heng.feng@canonical.com>

Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>

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

* Re: [PATCH v1 1/2] PM: ACPI: PCI: Drop acpi_pm_set_bridge_wakeup()
  2020-11-24 19:44 ` [PATCH v1 1/2] PM: ACPI: PCI: Drop acpi_pm_set_bridge_wakeup() Rafael J. Wysocki
  2020-11-25  8:06   ` Mika Westerberg
@ 2020-12-04 23:21   ` Bjorn Helgaas
  1 sibling, 0 replies; 6+ messages in thread
From: Bjorn Helgaas @ 2020-12-04 23:21 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Linux ACPI, LKML, Linux PM, Linux PCI, Mika Westerberg,
	Rafael J. Wysocki, Kai-Heng Feng

On Tue, Nov 24, 2020 at 08:44:00PM +0100, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> 
> The idea behind acpi_pm_set_bridge_wakeup() was to allow bridges to
> be reference counted for wakeup enabling, because they may be enabled
> to signal wakeup on behalf of their subordinate devices and that
> may happen for multiple times in a row, whereas for the other devices
> it only makes sense to enable wakeup signaling once.
> 
> However, this becomes problematic if the bridge itself is suspended,
> because it is treated as a "regular" device in that case and the
> reference counting doesn't work.
> 
> For instance, suppose that there are two devices below a bridge and
> they both can signal wakeup.  Every time one of them is suspended,
> wakeup signaling is enabled for the bridge, so when they both have
> been suspended, the bridge's wakeup reference counter value is 2.
> 
> Say that the bridge is suspended subsequently and acpi_pci_wakeup()
> is called for it.  Because the bridge can signal wakeup, that
> function will invoke acpi_pm_set_device_wakeup() to configure it
> and __acpi_pm_set_device_wakeup() will be called with the last
> argument equal to 1.  This causes __acpi_device_wakeup_enable()
> invoked by it to omit the reference counting, because the reference
> counter of the target device (the bridge) is 2 at that time.
> 
> Now say that the bridge resumes and one of the device below it
> resumes too, so the bridge's reference counter becomes 0 and
> wakeup signaling is disabled for it, but there is still the other
> suspended device which may need the bridge to signal wakeup on its
> behalf and that is not going to work.
> 
> To address this scenario, use wakeup enable reference counting for
> all devices, not just for bridges, so drop the last argument from
> __acpi_device_wakeup_enable() and __acpi_pm_set_device_wakeup(),
> which causes acpi_pm_set_device_wakeup() and
> acpi_pm_set_bridge_wakeup() to become identical, so drop the latter
> and use the former instead of it everywhere.
> 
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

Acked-by: Bjorn Helgaas <bhelgaas@google.com>

> ---
>  drivers/acpi/device_pm.c |   41 ++++++++++++-----------------------------
>  drivers/pci/pci-acpi.c   |    4 ++--
>  include/acpi/acpi_bus.h  |    5 -----
>  3 files changed, 14 insertions(+), 36 deletions(-)
> 
> Index: linux-pm/include/acpi/acpi_bus.h
> ===================================================================
> --- linux-pm.orig/include/acpi/acpi_bus.h
> +++ linux-pm/include/acpi/acpi_bus.h
> @@ -620,7 +620,6 @@ acpi_status acpi_remove_pm_notifier(stru
>  bool acpi_pm_device_can_wakeup(struct device *dev);
>  int acpi_pm_device_sleep_state(struct device *, int *, int);
>  int acpi_pm_set_device_wakeup(struct device *dev, bool enable);
> -int acpi_pm_set_bridge_wakeup(struct device *dev, bool enable);
>  #else
>  static inline void acpi_pm_wakeup_event(struct device *dev)
>  {
> @@ -651,10 +650,6 @@ static inline int acpi_pm_set_device_wak
>  {
>  	return -ENODEV;
>  }
> -static inline int acpi_pm_set_bridge_wakeup(struct device *dev, bool enable)
> -{
> -	return -ENODEV;
> -}
>  #endif
>  
>  #ifdef CONFIG_ACPI_SYSTEM_POWER_STATES_SUPPORT
> Index: linux-pm/drivers/acpi/device_pm.c
> ===================================================================
> --- linux-pm.orig/drivers/acpi/device_pm.c
> +++ linux-pm/drivers/acpi/device_pm.c
> @@ -749,7 +749,7 @@ static void acpi_pm_notify_work_func(str
>  static DEFINE_MUTEX(acpi_wakeup_lock);
>  
>  static int __acpi_device_wakeup_enable(struct acpi_device *adev,
> -				       u32 target_state, int max_count)
> +				       u32 target_state)
>  {
>  	struct acpi_device_wakeup *wakeup = &adev->wakeup;
>  	acpi_status status;
> @@ -757,9 +757,10 @@ static int __acpi_device_wakeup_enable(s
>  
>  	mutex_lock(&acpi_wakeup_lock);
>  
> -	if (wakeup->enable_count >= max_count)
> +	if (wakeup->enable_count >= INT_MAX) {
> +		acpi_handle_info(adev->handle, "Wakeup enable count out of bounds!\n");
>  		goto out;
> -
> +	}
>  	if (wakeup->enable_count > 0)
>  		goto inc;
>  
> @@ -799,7 +800,7 @@ out:
>   */
>  static int acpi_device_wakeup_enable(struct acpi_device *adev, u32 target_state)
>  {
> -	return __acpi_device_wakeup_enable(adev, target_state, 1);
> +	return __acpi_device_wakeup_enable(adev, target_state);
>  }
>  
>  /**
> @@ -829,8 +830,12 @@ out:
>  	mutex_unlock(&acpi_wakeup_lock);
>  }
>  
> -static int __acpi_pm_set_device_wakeup(struct device *dev, bool enable,
> -				       int max_count)
> +/**
> + * acpi_pm_set_device_wakeup - Enable/disable remote wakeup for given device.
> + * @dev: Device to enable/disable to generate wakeup events.
> + * @enable: Whether to enable or disable the wakeup functionality.
> + */
> +int acpi_pm_set_device_wakeup(struct device *dev, bool enable)
>  {
>  	struct acpi_device *adev;
>  	int error;
> @@ -850,37 +855,15 @@ static int __acpi_pm_set_device_wakeup(s
>  		return 0;
>  	}
>  
> -	error = __acpi_device_wakeup_enable(adev, acpi_target_system_state(),
> -					    max_count);
> +	error = __acpi_device_wakeup_enable(adev, acpi_target_system_state());
>  	if (!error)
>  		dev_dbg(dev, "Wakeup enabled by ACPI\n");
>  
>  	return error;
>  }
> -
> -/**
> - * acpi_pm_set_device_wakeup - Enable/disable remote wakeup for given device.
> - * @dev: Device to enable/disable to generate wakeup events.
> - * @enable: Whether to enable or disable the wakeup functionality.
> - */
> -int acpi_pm_set_device_wakeup(struct device *dev, bool enable)
> -{
> -	return __acpi_pm_set_device_wakeup(dev, enable, 1);
> -}
>  EXPORT_SYMBOL_GPL(acpi_pm_set_device_wakeup);
>  
>  /**
> - * acpi_pm_set_bridge_wakeup - Enable/disable remote wakeup for given bridge.
> - * @dev: Bridge device to enable/disable to generate wakeup events.
> - * @enable: Whether to enable or disable the wakeup functionality.
> - */
> -int acpi_pm_set_bridge_wakeup(struct device *dev, bool enable)
> -{
> -	return __acpi_pm_set_device_wakeup(dev, enable, INT_MAX);
> -}
> -EXPORT_SYMBOL_GPL(acpi_pm_set_bridge_wakeup);
> -
> -/**
>   * acpi_dev_pm_low_power - Put ACPI device into a low-power state.
>   * @dev: Device to put into a low-power state.
>   * @adev: ACPI device node corresponding to @dev.
> Index: linux-pm/drivers/pci/pci-acpi.c
> ===================================================================
> --- linux-pm.orig/drivers/pci/pci-acpi.c
> +++ linux-pm/drivers/pci/pci-acpi.c
> @@ -1060,7 +1060,7 @@ static int acpi_pci_propagate_wakeup(str
>  {
>  	while (bus->parent) {
>  		if (acpi_pm_device_can_wakeup(&bus->self->dev))
> -			return acpi_pm_set_bridge_wakeup(&bus->self->dev, enable);
> +			return acpi_pm_set_device_wakeup(&bus->self->dev, enable);
>  
>  		bus = bus->parent;
>  	}
> @@ -1068,7 +1068,7 @@ static int acpi_pci_propagate_wakeup(str
>  	/* We have reached the root bus. */
>  	if (bus->bridge) {
>  		if (acpi_pm_device_can_wakeup(bus->bridge))
> -			return acpi_pm_set_bridge_wakeup(bus->bridge, enable);
> +			return acpi_pm_set_device_wakeup(bus->bridge, enable);
>  	}
>  	return 0;
>  }
> 
> 
> 

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

end of thread, other threads:[~2020-12-04 23:22 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-24 19:41 [PATCH v1 0/2] PM: ACPI: PCI: Address issues related to signaling wakeup from bridges Rafael J. Wysocki
2020-11-24 19:44 ` [PATCH v1 1/2] PM: ACPI: PCI: Drop acpi_pm_set_bridge_wakeup() Rafael J. Wysocki
2020-11-25  8:06   ` Mika Westerberg
2020-12-04 23:21   ` Bjorn Helgaas
2020-11-24 19:46 ` [PATCH v1 2/2] PM: ACPI: Refresh wakeup device power configuration every time Rafael J. Wysocki
2020-11-25  8:09   ` Mika Westerberg

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