aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2014-05-29 22:27:31 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2014-05-30 10:04:36 -0400
commitd34afa9de4447367b734ec407e5a9e10617d6ec3 (patch)
tree0474cb7d35a0e28a25da51d6abbce4c4feae9e95
parent549e68455c6706796d9d244364dfbf5c575bd1a5 (diff)
ACPI / scan: Change the meaning of missing .attach() in scan handlers
Currently, some scan handlers can be compiled out entirely, which leaves the device objects they normally attach to without a scan handler. This isn't a problem as long as we don't have any default enumeration mechanism that applies to all devices without a scan handler. However, if such a default enumeration is added, it still should not be applied to devices that are normally attached to by scan handlers, because that may result in creating "physical" device objects of a wrong type for them. Since we are going to create platform device objects for all ACPI device objects with pnp.type.platform_id set by default, clear pnp.type.platform_id where there is a matching scan handler without an .attach() callback and otherwise simply treat that scan handler as though the .attach() callback was present but always returned 0. This will allow us to compile out scan handler callbacks and leave the device ID lists used by them so as to prevent creating platform device objects for the matching ACPI devices. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
-rw-r--r--drivers/acpi/scan.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
index ebbd23c94ba2..611bb5db7e57 100644
--- a/drivers/acpi/scan.c
+++ b/drivers/acpi/scan.c
@@ -84,7 +84,7 @@ EXPORT_SYMBOL_GPL(acpi_initialize_hp_context);
84 84
85int acpi_scan_add_handler(struct acpi_scan_handler *handler) 85int acpi_scan_add_handler(struct acpi_scan_handler *handler)
86{ 86{
87 if (!handler || !handler->attach) 87 if (!handler)
88 return -EINVAL; 88 return -EINVAL;
89 89
90 list_add_tail(&handler->list_node, &acpi_scan_handlers_list); 90 list_add_tail(&handler->list_node, &acpi_scan_handlers_list);
@@ -2081,6 +2081,10 @@ static int acpi_scan_attach_handler(struct acpi_device *device)
2081 2081
2082 handler = acpi_scan_match_handler(hwid->id, &devid); 2082 handler = acpi_scan_match_handler(hwid->id, &devid);
2083 if (handler) { 2083 if (handler) {
2084 if (!handler->attach) {
2085 device->pnp.type.platform_id = 0;
2086 continue;
2087 }
2084 device->handler = handler; 2088 device->handler = handler;
2085 ret = handler->attach(device, devid); 2089 ret = handler->attach(device, devid);
2086 if (ret > 0) 2090 if (ret > 0)