From patchwork Sat Feb 9 14:31:07 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rafael Wysocki X-Patchwork-Id: 2120251 Return-Path: X-Original-To: patchwork-linux-acpi@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 66BE4DF24C for ; Sat, 9 Feb 2013 14:24:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760656Ab3BIOYv (ORCPT ); Sat, 9 Feb 2013 09:24:51 -0500 Received: from hydra.sisk.pl ([212.160.235.94]:36254 "EHLO hydra.sisk.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757574Ab3BIOYu (ORCPT ); Sat, 9 Feb 2013 09:24:50 -0500 Received: from vostro.rjw.lan (aept181.neoplus.adsl.tpnet.pl [79.191.149.181]) by hydra.sisk.pl (Postfix) with ESMTPSA id 719A4E3DB7; Sat, 9 Feb 2013 15:24:45 +0100 (CET) From: "Rafael J. Wysocki" To: ACPI Devel Maling List Cc: Bjorn Helgaas , Mika Westerberg , Yinghai Lu , Jiang Liu , Toshi Kani , LKML , Yasuaki Ishimatsu Subject: [PATCH 2/2] ACPI / scan: Full transition to D3cold in acpi_device_unregister() Date: Sat, 09 Feb 2013 15:31:07 +0100 Message-ID: <4046675.Lno9M3IXL1@vostro.rjw.lan> User-Agent: KMail/4.9.5 (Linux/3.8.0-rc6; KDE/4.9.5; x86_64; ; ) In-Reply-To: <2074190.mMzUc3TOxk@vostro.rjw.lan> References: <1873429.MS5RQDxTye@vostro.rjw.lan> <1468930.acVuhKfKYv@vostro.rjw.lan> <2074190.mMzUc3TOxk@vostro.rjw.lan> MIME-Version: 1.0 Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org From: Rafael J. Wysocki In order to drop reference counts of all power resources used by an ACPI device node being removed, acpi_device_unregister() calls acpi_power_transition(device, ACPI_STATE_D3_COLD), which effectively transitions the device node into D3cold if it uses any power resources. However, for some device nodes it may not be appropriate to remove power from them entirely before putting them into D3hot before. On the other hand, executing _PS3 for devices that don't use power resources before removing them shouldn't really hurt. In fact, that is done by acpi_bus_hot_remove_device(), but this is not the right place to do it, because the bus trimming may have caused power to be removed from the device node in question already before. For these reasons, make acpi_device_unregister() carry out full power-off transition for all device nodes supporting that and remove the direct evaluation of _PS3 from acpi_bus_hot_remove_device(). Signed-off-by: Rafael J. Wysocki --- drivers/acpi/scan.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Index: test/drivers/acpi/scan.c =================================================================== --- test.orig/drivers/acpi/scan.c +++ test/drivers/acpi/scan.c @@ -125,12 +125,6 @@ void acpi_bus_hot_remove_device(void *co /* Device node has been released. */ device = NULL; - /* power off device */ - status = acpi_evaluate_object(handle, "_PS3", NULL, NULL); - if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) - printk(KERN_WARNING PREFIX - "Power-off device failed\n"); - if (ACPI_SUCCESS(acpi_get_handle(handle, "_LCK", &temp))) { arg_list.count = 1; arg_list.pointer = &arg; @@ -780,10 +774,11 @@ static void acpi_device_unregister(struc device_del(&device->dev); /* - * Drop the reference counts of all power resources the device depends - * on and turn off the ones that have no more references. + * Transition the device to D3cold to drop the reference counts of all + * power resources the device depends on and turn off the ones that have + * no more references. */ - acpi_power_transition(device, ACPI_STATE_D3_COLD); + acpi_device_set_power(device, ACPI_STATE_D3_COLD); put_device(&device->dev); }