From patchwork Thu Mar 1 09:02:53 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lin Ming X-Patchwork-Id: 143962 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 044E91007D2 for ; Thu, 1 Mar 2012 20:06:48 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932373Ab2CAJGp (ORCPT ); Thu, 1 Mar 2012 04:06:45 -0500 Received: from mga09.intel.com ([134.134.136.24]:56688 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758627Ab2CAJEb (ORCPT ); Thu, 1 Mar 2012 04:04:31 -0500 Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga102.jf.intel.com with ESMTP; 01 Mar 2012 01:04:26 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.67,351,1309762800"; d="scan'208";a="116439265" Received: from minggr.sh.intel.com ([10.239.36.45]) by orsmga002.jf.intel.com with ESMTP; 01 Mar 2012 01:03:33 -0800 From: Lin Ming To: Zhang Rui , Jeff Garzik , Alan Stern , "Rafael J. Wysocki" , Tejun Heo , Aaron Lu Cc: linux-kernel@vger.kernel.org, linux-ide@vger.kernel.org, linux-scsi@vger.kernel.org, linux-pm@vger.kernel.org, linux-acpi Subject: [RFC PATCH v2 4/8] libata-acpi: set acpi state for SATA port Date: Thu, 1 Mar 2012 17:02:53 +0800 Message-Id: <1330592577-16546-5-git-send-email-ming.m.lin@intel.com> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: <1330592577-16546-1-git-send-email-ming.m.lin@intel.com> References: <1330592577-16546-1-git-send-email-ming.m.lin@intel.com> Sender: linux-ide-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ide@vger.kernel.org Currently, ata_acpi_set_state() only sets acpi sate for IDE port. Remove this limitation. Signed-off-by: Lin Ming Acked-by: Aaron Lu --- drivers/ata/libata-acpi.c | 21 ++++++++++++--------- 1 files changed, 12 insertions(+), 9 deletions(-) diff --git a/drivers/ata/libata-acpi.c b/drivers/ata/libata-acpi.c index b03e468..104c1d0 100644 --- a/drivers/ata/libata-acpi.c +++ b/drivers/ata/libata-acpi.c @@ -841,23 +841,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); } /**