lkml.org 
[lkml]   [2012]   [Dec]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 6/16] ACPI: Change the ordering of acpi_bus_check_add()
Date
From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>


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 <rafael.j.wysocki@intel.com>
Acked-by: Yinghai Lu <yinghai@kernel.org>
---
drivers/acpi/scan.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)

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;



\
 
 \ /
  Last update: 2012-12-20 03:21    [W:0.218 / U:1.116 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site