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: <20240412143719.11398-7-Jonathan.Cameron@huawei.com>
Date: Fri, 12 Apr 2024 15:37:07 +0100
From: Jonathan Cameron <Jonathan.Cameron@...wei.com>
To: <linux-pm@...r.kernel.org>, <loongarch@...ts.linux.dev>,
	<linux-acpi@...r.kernel.org>, <linux-arch@...r.kernel.org>,
	<linux-kernel@...r.kernel.org>, <linux-arm-kernel@...ts.infradead.org>,
	<kvmarm@...ts.linux.dev>, <x86@...nel.org>, Russell King
	<linux@...linux.org.uk>, "Rafael J . Wysocki" <rafael@...nel.org>, Miguel
 Luis <miguel.luis@...cle.com>, James Morse <james.morse@....com>, Salil Mehta
	<salil.mehta@...wei.com>, Jean-Philippe Brucker <jean-philippe@...aro.org>,
	Catalin Marinas <catalin.marinas@....com>, Will Deacon <will@...nel.org>
CC: <linuxarm@...wei.com>, <justin.he@....com>, <jianyong.wu@....com>
Subject: [PATCH v5 06/18] ACPI: scan: Add parameter to allow defering some actions in acpi_scan_check_and_detach.

Precursor patch adds the ability to pass a flag (not yet used) into
acpi_scan_check_and detach().  Done in a separate patch with no
functional changes to reduce complexity of the actual deferal which
follows.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@...wei.com>

---
v5: New patch resulting from rebase.
    - Internal review suggested we could also do this with flags
      so I'm looking for feedback on which option people find
      more readable.
---
 drivers/acpi/scan.c | 25 ++++++++++++++++++++-----
 1 file changed, 20 insertions(+), 5 deletions(-)

diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
index 7c157bf92695..79b1f4d2b6bd 100644
--- a/drivers/acpi/scan.c
+++ b/drivers/acpi/scan.c
@@ -244,13 +244,19 @@ static int acpi_scan_try_to_offline(struct acpi_device *device)
 	return 0;
 }
 
-static int acpi_scan_check_and_detach(struct acpi_device *adev, void *check)
+struct acpi_scan_c_and_d_param {
+	bool check_status;
+	bool eject;
+};
+
+static int acpi_scan_check_and_detach(struct acpi_device *adev, void *p)
 {
 	struct acpi_scan_handler *handler = adev->handler;
+	struct acpi_scan_c_and_d_param *param = p;
 
-	acpi_dev_for_each_child_reverse(adev, acpi_scan_check_and_detach, check);
+	acpi_dev_for_each_child_reverse(adev, acpi_scan_check_and_detach, p);
 
-	if (check) {
+	if (param->check_status) {
 		acpi_bus_get_status(adev);
 		/*
 		 * Skip devices that are still there and take the enabled
@@ -288,7 +294,11 @@ static int acpi_scan_check_and_detach(struct acpi_device *adev, void *check)
 
 static void acpi_scan_check_subtree(struct acpi_device *adev)
 {
-	acpi_scan_check_and_detach(adev, (void *)true);
+	struct acpi_scan_c_and_d_param p = {
+		.check_status = true, /* Not update until after ej0 */
+		.eject = false,
+	};
+	acpi_scan_check_and_detach(adev, &p);
 }
 
 static int acpi_scan_hot_remove(struct acpi_device *device)
@@ -2600,7 +2610,12 @@ EXPORT_SYMBOL(acpi_bus_scan);
  */
 void acpi_bus_trim(struct acpi_device *adev)
 {
-	acpi_scan_check_and_detach(adev, NULL);
+	struct acpi_scan_c_and_d_param p = {
+		.check_status = false,
+		.eject = false,
+	};
+
+	acpi_scan_check_and_detach(adev, &p);
 }
 EXPORT_SYMBOL_GPL(acpi_bus_trim);
 
-- 
2.39.2


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ