From patchwork Thu Dec 20 01:51:39 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Rafael J. Wysocki" X-Patchwork-Id: 207587 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 57EDA2C0080 for ; Thu, 20 Dec 2012 12:57:27 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752503Ab2LTB4G (ORCPT ); Wed, 19 Dec 2012 20:56:06 -0500 Received: from hydra.sisk.pl ([212.160.235.94]:38320 "EHLO hydra.sisk.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752354Ab2LTBzu (ORCPT ); Wed, 19 Dec 2012 20:55:50 -0500 Received: from vostro.rjw.lan (afck23.neoplus.adsl.tpnet.pl [95.49.62.23]) by hydra.sisk.pl (Postfix) with ESMTPSA id A9842E530F; Thu, 20 Dec 2012 02:57:07 +0100 (CET) From: "Rafael J. Wysocki" To: ACPI Devel Maling List Cc: Toshi Kani , Bjorn Helgaas , LKML , linux-pci@vger.kernel.org, Yinghai Lu , Myron Stowe , Yijing Wang , Jiang Liu Subject: [PATCH 6/16] ACPI: Change the ordering of acpi_bus_check_add() Date: Thu, 20 Dec 2012 02:51:39 +0100 Message-ID: <2653336.2sGpJboDsC@vostro.rjw.lan> User-Agent: KMail/4.9.3 (Linux/3.7.0; KDE/4.9.3; x86_64; ; ) In-Reply-To: <1855256.SyhOJGYMIh@vostro.rjw.lan> References: <8498184.VilrUmatxI@vostro.rjw.lan> <4082842.31rfDviYHK@vostro.rjw.lan> <1855256.SyhOJGYMIh@vostro.rjw.lan> MIME-Version: 1.0 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org From: Rafael J. Wysocki If acpi_bus_check_add() is called for a handle already having an existing struct acpi_device object attached, it is not necessary to check the type and status of the device correspondig to it, so change the ordering of acpi_bus_check_add() to avoid that. Signed-off-by: Rafael J. Wysocki Acked-by: Yinghai Lu --- drivers/acpi/scan.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-pci" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Index: linux/drivers/acpi/scan.c =================================================================== --- linux.orig/drivers/acpi/scan.c +++ linux/drivers/acpi/scan.c @@ -1582,6 +1582,10 @@ static acpi_status acpi_bus_check_add(ac acpi_status status; int result; + acpi_bus_get_device(handle, &device); + if (device) + goto out; + result = acpi_bus_type_and_status(handle, &type, &sta); if (result) return AE_OK; @@ -1598,18 +1602,14 @@ static acpi_status acpi_bus_check_add(ac return AE_CTRL_DEPTH; } - acpi_bus_get_device(handle, &device); - if (!device) { - acpi_add_single_object(&device, handle, type, sta, - ACPI_BUS_ADD_BASIC); - if (!device) - return AE_CTRL_DEPTH; + acpi_add_single_object(&device, handle, type, sta, ACPI_BUS_ADD_BASIC); + if (!device) + return AE_CTRL_DEPTH; - device->add_type = context ? - ACPI_BUS_ADD_START : ACPI_BUS_ADD_MATCH; - acpi_hot_add_bind(device); - } + device->add_type = context ? ACPI_BUS_ADD_START : ACPI_BUS_ADD_MATCH; + acpi_hot_add_bind(device); + out: if (!*return_value) *return_value = device;