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: <20211009160548.306550-2-hdegoede@redhat.com>
Date:   Sat,  9 Oct 2021 18:05:36 +0200
From:   Hans de Goede <hdegoede@...hat.com>
To:     "Rafael J . Wysocki" <rjw@...ysocki.net>,
        Mark Gross <markgross@...nel.org>,
        Andy Shevchenko <andy@...radead.org>,
        Daniel Scally <djrscally@...il.com>,
        Laurent Pinchart <laurent.pinchart@...asonboard.com>,
        Mauro Carvalho Chehab <mchehab@...nel.org>,
        Liam Girdwood <lgirdwood@...il.com>,
        Mark Brown <broonie@...nel.org>,
        Michael Turquette <mturquette@...libre.com>,
        Stephen Boyd <sboyd@...nel.org>
Cc:     Hans de Goede <hdegoede@...hat.com>, Len Brown <lenb@...nel.org>,
        linux-acpi@...r.kernel.org, platform-driver-x86@...r.kernel.org,
        linux-kernel@...r.kernel.org,
        Sakari Ailus <sakari.ailus@...ux.intel.com>,
        Kate Hsuan <hpa@...hat.com>, linux-media@...r.kernel.org,
        linux-clk@...r.kernel.org
Subject: [PATCH v2 01/13] ACPI: Add a honor_deps flag to struct acpi_device

At the moment dependencies by _DEP are mostly ignored by the ACPI code,
other then acpi_bus_scan() instantiating all devices without _DEP-s before
instantiating devices with _DEP-s.

The on exception to this is ACPI battery devices for which _DEP-s are fully
honored.

Now another case has come-up where we want to honor the _DEP-s.
In preparation for this add a new honor_deps flag to struct acpi_device
and move the existing battery special-case over to this flag.

Signed-off-by: Hans de Goede <hdegoede@...hat.com>
---
 drivers/acpi/bus.c      | 4 ++--
 drivers/acpi/scan.c     | 4 ++++
 include/acpi/acpi_bus.h | 1 +
 3 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c
index fa923a929224..7dd6262ca488 100644
--- a/drivers/acpi/bus.c
+++ b/drivers/acpi/bus.c
@@ -103,8 +103,8 @@ int acpi_bus_get_status(struct acpi_device *device)
 		return 0;
 	}
 
-	/* Battery devices must have their deps met before calling _STA */
-	if (acpi_device_is_battery(device) && device->dep_unmet) {
+	/* If honor_deps is set, the deps must be met before calling _STA */
+	if (device->honor_deps && device->dep_unmet) {
 		acpi_set_device_status(device, 0);
 		return 0;
 	}
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
index 5b54c80b9d32..4e0a946b35ed 100644
--- a/drivers/acpi/scan.c
+++ b/drivers/acpi/scan.c
@@ -1756,6 +1756,10 @@ static void acpi_scan_dep_init(struct acpi_device *adev)
 {
 	struct acpi_dep_data *dep;
 
+	/* Always honor the deps for battery devices */
+	if (acpi_device_is_battery(adev))
+		adev->honor_deps = true;
+
 	list_for_each_entry(dep, &acpi_dep_list, node) {
 		if (dep->consumer == adev->handle)
 			adev->dep_unmet++;
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
index 13d93371790e..0ba344a5f4f8 100644
--- a/include/acpi/acpi_bus.h
+++ b/include/acpi/acpi_bus.h
@@ -381,6 +381,7 @@ struct acpi_device {
 	struct device dev;
 	unsigned int physical_node_count;
 	unsigned int dep_unmet;
+	bool honor_deps;
 	struct list_head physical_node_list;
 	struct mutex physical_node_lock;
 	void (*remove)(struct acpi_device *);
-- 
2.31.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ