lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <6681740.NxX6Su8EKC@vostro.rjw.lan>
Date:	Fri, 18 Jan 2013 13:35:11 +0100
From:	"Rafael J. Wysocki" <rjw@...k.pl>
To:	ACPI Devel Maling List <linux-acpi@...r.kernel.org>
Cc:	LKML <linux-kernel@...r.kernel.org>,
	"Moore, Robert" <robert.moore@...el.com>,
	Bjorn Helgaas <bhelgaas@...gle.com>,
	Yinghai Lu <yinghai@...nel.org>
Subject: [PATCH] ACPI / scan: Fold acpi_bus_scan() into acpi_bus_add()

From: Rafael J. Wysocki <rafael.j.wysocki@...el.com>

The only difference between acpi_bus_scan() into acpi_bus_add() is
the invocation of acpi_update_all_gpes() in the latter which in fact
is unnecessary, because acpi_update_all_gpes() has already been
called by acpi_scan_init() and the way it is implemented causes the
next invocations of it to do nothing.

For this reason, drop the acpi_update_all_gpes() call from
acpi_bus_add() and fold acpi_bus_scan() into it.  Additionally,
rename acpi_bus_scan_fixed() to acpi_bus_add_fixed(), because
acpi_bus_scan() is not present any more, and rearrange the code
in acpi_scan_init() slightly.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@...el.com>
---
 drivers/acpi/scan.c |   52 +++++++++++++++++++++-------------------------------
 1 file changed, 21 insertions(+), 31 deletions(-)

Index: linux-pm/drivers/acpi/scan.c
===================================================================
--- linux-pm.orig/drivers/acpi/scan.c
+++ linux-pm/drivers/acpi/scan.c
@@ -1584,24 +1584,6 @@ static acpi_status acpi_bus_device_attac
 	return status;
 }
 
-static int acpi_bus_scan(acpi_handle handle)
-{
-	void *device = NULL;
-
-	if (ACPI_SUCCESS(acpi_bus_check_add(handle, 0, NULL, &device)))
-		acpi_walk_namespace(ACPI_TYPE_ANY, handle, ACPI_UINT32_MAX,
-				    acpi_bus_check_add, NULL, NULL, &device);
-
-	if (!device)
-		return -ENODEV;
-
-	if (ACPI_SUCCESS(acpi_bus_device_attach(handle, 0, NULL, NULL)))
-		acpi_walk_namespace(ACPI_TYPE_ANY, handle, ACPI_UINT32_MAX,
-				    acpi_bus_device_attach, NULL, NULL, NULL);
-
-	return 0;
-}
-
 /**
  * acpi_bus_add - Add ACPI device node objects in a given namespace scope.
  * @handle: Root of the namespace scope to scan.
@@ -1616,13 +1598,19 @@ static int acpi_bus_scan(acpi_handle han
  */
 int acpi_bus_add(acpi_handle handle)
 {
-	int err;
+	void *device = NULL;
+
+	if (ACPI_SUCCESS(acpi_bus_check_add(handle, 0, NULL, &device)))
+		acpi_walk_namespace(ACPI_TYPE_ANY, handle, ACPI_UINT32_MAX,
+				    acpi_bus_check_add, NULL, NULL, &device);
+
+	if (!device)
+		return -ENODEV;
 
-	err = acpi_bus_scan(handle);
-	if (err)
-		return err;
+	if (ACPI_SUCCESS(acpi_bus_device_attach(handle, 0, NULL, NULL)))
+		acpi_walk_namespace(ACPI_TYPE_ANY, handle, ACPI_UINT32_MAX,
+				    acpi_bus_device_attach, NULL, NULL, NULL);
 
-	acpi_update_all_gpes();
 	return 0;
 }
 EXPORT_SYMBOL(acpi_bus_add);
@@ -1670,7 +1658,7 @@ int acpi_bus_trim(struct acpi_device *st
 }
 EXPORT_SYMBOL_GPL(acpi_bus_trim);
 
-static int acpi_bus_scan_fixed(void)
+static int acpi_bus_add_fixed(void)
 {
 	int result = 0;
 	struct acpi_device *device = NULL;
@@ -1709,18 +1697,20 @@ int __init acpi_scan_init(void)
 	/*
 	 * Enumerate devices in the ACPI namespace.
 	 */
-	result = acpi_bus_scan(ACPI_ROOT_OBJECT);
+	result = acpi_bus_add(ACPI_ROOT_OBJECT);
 	if (result)
 		return result;
 
 	result = acpi_bus_get_device(ACPI_ROOT_OBJECT, &acpi_root);
-	if (!result)
-		result = acpi_bus_scan_fixed();
-
 	if (result)
+		return result;
+
+	result = acpi_bus_add_fixed();
+	if (result) {
 		acpi_device_unregister(acpi_root);
-	else
-		acpi_update_all_gpes();
+		return result;
+	}
 
-	return result;
+	acpi_update_all_gpes();
+	return 0;
 }

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ