Patchwork [v6,7/7] libata: acpi: respect may_power_off flag

login
register
mail settings
Submitter Aaron Lu
Date Sept. 4, 2012, 2:24 p.m.
Message ID <1346768680-7287-8-git-send-email-aaron.lwe@gmail.com>
Download mbox | patch
Permalink /patch/181590/
State Not Applicable
Delegated to: David Miller
Headers show

Comments

Aaron Lu - Sept. 4, 2012, 2:24 p.m.
From: Aaron Lu <aaron.lu@intel.com>

If user does not want the device being powered off when runtime
suspended by setting may_power_off flag to 0, we will not choose D3 cold
ACPI D-State for it.

Signed-off-by: Aaron Lu <aaron.lu@intel.com>
---
 drivers/ata/libata-acpi.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
Jeff Garzik - Sept. 7, 2012, 2:38 a.m.
On 09/04/2012 10:24 AM, Aaron Lu wrote:
> From: Aaron Lu <aaron.lu@intel.com>
>
> If user does not want the device being powered off when runtime
> suspended by setting may_power_off flag to 0, we will not choose D3 cold
> ACPI D-State for it.
>
> Signed-off-by: Aaron Lu <aaron.lu@intel.com>
> ---
>   drivers/ata/libata-acpi.c | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/ata/libata-acpi.c b/drivers/ata/libata-acpi.c
> index 6c8f89c..774180d 100644
> --- a/drivers/ata/libata-acpi.c
> +++ b/drivers/ata/libata-acpi.c
> @@ -869,7 +869,9 @@ void ata_acpi_set_state(struct ata_port *ap, pm_message_t state)
>
>   		if (state.event != PM_EVENT_ON) {
>   			acpi_state = acpi_pm_device_sleep_state(
> -				&dev->sdev->sdev_gendev, NULL, ACPI_STATE_D3);
> +				&dev->sdev->sdev_gendev, NULL,
> +				dev->sdev->may_power_off ?
> +				ACPI_STATE_D3_COLD : ACPI_STATE_D3_HOT);
>   			if (acpi_state > 0)
>   				acpi_bus_set_power(handle, acpi_state);

Acked-by: Jeff Garzik <jgarzik@redhat.com>



--
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/drivers/ata/libata-acpi.c b/drivers/ata/libata-acpi.c
index 6c8f89c..774180d 100644
--- a/drivers/ata/libata-acpi.c
+++ b/drivers/ata/libata-acpi.c
@@ -869,7 +869,9 @@  void ata_acpi_set_state(struct ata_port *ap, pm_message_t state)
 
 		if (state.event != PM_EVENT_ON) {
 			acpi_state = acpi_pm_device_sleep_state(
-				&dev->sdev->sdev_gendev, NULL, ACPI_STATE_D3);
+				&dev->sdev->sdev_gendev, NULL,
+				dev->sdev->may_power_off ?
+				ACPI_STATE_D3_COLD : ACPI_STATE_D3_HOT);
 			if (acpi_state > 0)
 				acpi_bus_set_power(handle, acpi_state);
 			/* TBD: need to check if it's runtime pm request */