Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755957Ab2FRG3O (ORCPT ); Mon, 18 Jun 2012 02:29:14 -0400 Received: from mga11.intel.com ([192.55.52.93]:63878 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753882Ab2FRG0f (ORCPT ); Mon, 18 Jun 2012 02:26:35 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.71,315,1320652800"; d="scan'208";a="181387334" From: Lin Ming To: Jeff Garzik , Aaron Lu , Holger Macht , Matthew Garrett , Alan Cox , David Woodhouse Cc: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, linux-scsi@vger.kernel.org, linux-ide@vger.kernel.org, linux-acpi@vger.kernel.org Subject: [PATCH v5 05/12] libata-acpi: set acpi state for SATA port Date: Mon, 18 Jun 2012 14:25:59 +0800 Message-Id: <1340000766-129148-6-git-send-email-ming.m.lin@intel.com> X-Mailer: git-send-email 1.7.10 In-Reply-To: <1340000766-129148-1-git-send-email-ming.m.lin@intel.com> References: <1340000766-129148-1-git-send-email-ming.m.lin@intel.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1819 Lines: 57 Currently, ata_acpi_set_state() only sets acpi sate for IDE port. Remove this limitation. Acked-by: Aaron Lu Signed-off-by: Lin Ming --- drivers/ata/libata-acpi.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/drivers/ata/libata-acpi.c b/drivers/ata/libata-acpi.c index 98826e96..2887eb0 100644 --- a/drivers/ata/libata-acpi.c +++ b/drivers/ata/libata-acpi.c @@ -852,23 +852,26 @@ void ata_acpi_on_resume(struct ata_port *ap) void ata_acpi_set_state(struct ata_port *ap, pm_message_t state) { struct ata_device *dev; - - if (!ata_ap_acpi_handle(ap) || (ap->flags & ATA_FLAG_ACPI_SATA)) - return; + acpi_handle handle; + int acpi_state; /* channel first and then drives for power on and vica versa for power off */ - if (state.event == PM_EVENT_ON) - acpi_bus_set_power(ata_ap_acpi_handle(ap), ACPI_STATE_D0); + handle = ata_ap_acpi_handle(ap); + if (handle && state.event == PM_EVENT_ON) + acpi_bus_set_power(handle, ACPI_STATE_D0); ata_for_each_dev(dev, &ap->link, ENABLED) { - if (ata_dev_acpi_handle(dev)) - acpi_bus_set_power(ata_dev_acpi_handle(dev), + handle = ata_dev_acpi_handle(dev); + if (handle) + acpi_bus_set_power(handle, state.event == PM_EVENT_ON ? ACPI_STATE_D0 : ACPI_STATE_D3); } - if (state.event != PM_EVENT_ON) - acpi_bus_set_power(ata_ap_acpi_handle(ap), ACPI_STATE_D3); + + handle = ata_ap_acpi_handle(ap); + if (handle && state.event != PM_EVENT_ON) + acpi_bus_set_power(handle, ACPI_STATE_D3); } /** -- 1.7.10 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/