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  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]
Date:	Fri, 23 May 2014 02:02:27 +0800
From:	Zhang Rui <>
Cc:,,,,, Zhang Rui <>
Subject: [PATCH V7 05/11] ACPI: allow scan handlers without .attach() callback

Devices that can be attached to scan handlers, are kind of different from
the others, because they are known that some special actions should be taken.

But we do not mark this difference when the configurable scan handlers
are compiled out. This is harmless currently, but it will be when
we want to take some common actions to the other "non-special" devices,
which will be done in a later patch.

This patch makes .attach() of the acpi scan handler optional.
So that the configurable scan handlers can provide NULL .attach() callback
when not supported.

Signed-off-by: Zhang Rui <>
 drivers/acpi/scan.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
index c82ab73..e9c2f6f 100644
--- a/drivers/acpi/scan.c
+++ b/drivers/acpi/scan.c
@@ -84,7 +84,7 @@ EXPORT_SYMBOL_GPL(acpi_initialize_hp_context);
 int acpi_scan_add_handler(struct acpi_scan_handler *handler)
-	if (!handler || !handler->attach)
+	if (!handler)
 		return -EINVAL;
 	list_add_tail(&handler->list_node, &acpi_scan_handlers_list);
@@ -2066,6 +2066,12 @@ static acpi_status acpi_bus_check_add(acpi_handle handle, u32 lvl_not_used,
 	return AE_OK;
+static int acpi_scan_handler_dummy_attach(struct acpi_device *device,
+				const struct acpi_device_id *devid)
+	return 1;
 static int acpi_scan_attach_handler(struct acpi_device *device)
 	struct acpi_hardware_id *hwid;
@@ -2078,7 +2084,10 @@ static int acpi_scan_attach_handler(struct acpi_device *device)
 		handler = acpi_scan_match_handler(hwid->id, &devid);
 		if (handler) {
 			device->handler = handler;
-			ret = handler->attach(device, devid);
+			if (handler->attach)
+				ret = handler->attach(device, devid);
+			else
+				ret = acpi_scan_handler_dummy_attach(device, devid);
 			if (ret > 0)

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

Powered by blists - more mailing lists