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-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <21197831.EfDdHjke4D@kreacher>
Date:   Sat, 18 Sep 2021 15:02:23 +0200
From:   "Rafael J. Wysocki" <rjw@...ysocki.net>
To:     Linux ACPI <linux-acpi@...r.kernel.org>,
        Linux PCI <linux-pci@...r.kernel.org>
Cc:     LKML <linux-kernel@...r.kernel.org>,
        Bjorn Helgaas <helgaas@...nel.org>,
        Mika Westerberg <mika.westerberg@...ux.intel.com>,
        Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Subject: [PATCH v1 3/3] ACPI: glue: Look for ACPI bus type only if ACPI companion is not known

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

Notice that it is not necessary to look for the "ACPI bus type" of
the device in acpi_device_notify() if the device's ACPI companion
is set upfront, so modify the code to do that lookup only if it is
necessary to find the ACPI companion.

Also notice that if the device's ACPI companion is not set upfront
in acpi_device_notify(), the device cannot be either a PCI one or a
platform one, so check for these bus types only if the device's
ACPI companion is set.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@...el.com>
---
 drivers/acpi/glue.c |   28 +++++++++++++++++-----------
 1 file changed, 17 insertions(+), 11 deletions(-)

Index: linux-pm/drivers/acpi/glue.c
===================================================================
--- linux-pm.orig/drivers/acpi/glue.c
+++ linux-pm/drivers/acpi/glue.c
@@ -289,12 +289,13 @@ EXPORT_SYMBOL_GPL(acpi_unbind_one);
 
 void acpi_device_notify(struct device *dev)
 {
-	struct acpi_bus_type *type = acpi_get_bus_type(dev);
 	struct acpi_device *adev;
 	int ret;
 
 	ret = acpi_bind_one(dev, NULL);
 	if (ret) {
+		struct acpi_bus_type *type = acpi_get_bus_type(dev);
+
 		if (!type)
 			goto err;
 
@@ -306,21 +307,26 @@ void acpi_device_notify(struct device *d
 		ret = acpi_bind_one(dev, adev);
 		if (ret)
 			goto err;
-	}
-	adev = ACPI_COMPANION(dev);
 
-	if (dev_is_pci(dev)) {
-		pci_acpi_setup(dev, adev);
+		if (type->setup) {
+			type->setup(dev);
+			goto done;
+		}
 	} else {
-		if (dev_is_platform(dev))
-			acpi_configure_pmsi_domain(dev);
+		adev = ACPI_COMPANION(dev);
 
-		if (type && type->setup)
-			type->setup(dev);
-		else if (adev->handler && adev->handler->bind)
-			adev->handler->bind(dev);
+		if (dev_is_pci(dev)) {
+			pci_acpi_setup(dev, adev);
+			goto done;
+		} else if (dev_is_platform(dev)) {
+			acpi_configure_pmsi_domain(dev);
+		}
 	}
 
+	if (adev->handler && adev->handler->bind)
+		adev->handler->bind(dev);
+
+done:
 	acpi_handle_debug(ACPI_HANDLE(dev), "Bound to device %s\n",
 			  dev_name(dev));
 



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ