提交 7d284352 编写于 作者: R Rafael J. Wysocki

ACPI / scan: Add a scan handler for PRP0001

If the special PRP0001 device ID is present in the given device's list
of ACPI/PNP IDs and the device has a valid "compatible" property in
the _DSD, it should be enumerated using the default mechanism,
unless some scan handlers match the IDs preceding PRP0001 in the
device's list of ACPI/PNP IDs.  In addition to that, no scan handlers
matching the IDs following PRP0001 in that list should be attached
to the device.

To make that happen, define a scan handler that will match PRP0001
and trigger the default enumeration for the matching devices if the
"compatible" property is present for them.

Since that requires the check for platform_id and device->handler
to be removed from acpi_default_enumeration(), move the fallback
invocation of acpi_default_enumeration() to acpi_bus_attach()
(after it's checked if there's a matching ACPI driver for the
device), which is a better place to call it, and do the platform_id
check in there too (device->handler is guaranteed to be unset at
the point where the function is looking for a matching ACPI driver).
Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: NDarren Hart <dvhart@linux.intel.com>
上级 4c533c80
...@@ -2392,9 +2392,6 @@ static void acpi_default_enumeration(struct acpi_device *device) ...@@ -2392,9 +2392,6 @@ static void acpi_default_enumeration(struct acpi_device *device)
struct list_head resource_list; struct list_head resource_list;
bool is_spi_i2c_slave = false; bool is_spi_i2c_slave = false;
if (!device->pnp.type.platform_id || device->handler)
return;
/* /*
* Do not enemerate SPI/I2C slaves as they will be enuerated by their * Do not enemerate SPI/I2C slaves as they will be enuerated by their
* respective parents. * respective parents.
...@@ -2407,6 +2404,29 @@ static void acpi_default_enumeration(struct acpi_device *device) ...@@ -2407,6 +2404,29 @@ static void acpi_default_enumeration(struct acpi_device *device)
acpi_create_platform_device(device); acpi_create_platform_device(device);
} }
static const struct acpi_device_id generic_device_ids[] = {
{"PRP0001", },
{"", },
};
static int acpi_generic_device_attach(struct acpi_device *adev,
const struct acpi_device_id *not_used)
{
/*
* Since PRP0001 is the only ID handled here, the test below can be
* unconditional.
*/
if (adev->data.of_compatible)
acpi_default_enumeration(adev);
return 1;
}
static struct acpi_scan_handler generic_device_handler = {
.ids = generic_device_ids,
.attach = acpi_generic_device_attach,
};
static int acpi_scan_attach_handler(struct acpi_device *device) static int acpi_scan_attach_handler(struct acpi_device *device)
{ {
struct acpi_hardware_id *hwid; struct acpi_hardware_id *hwid;
...@@ -2432,8 +2452,6 @@ static int acpi_scan_attach_handler(struct acpi_device *device) ...@@ -2432,8 +2452,6 @@ static int acpi_scan_attach_handler(struct acpi_device *device)
break; break;
} }
} }
if (!ret)
acpi_default_enumeration(device);
return ret; return ret;
} }
...@@ -2475,6 +2493,9 @@ static void acpi_bus_attach(struct acpi_device *device) ...@@ -2475,6 +2493,9 @@ static void acpi_bus_attach(struct acpi_device *device)
ret = device_attach(&device->dev); ret = device_attach(&device->dev);
if (ret < 0) if (ret < 0)
return; return;
if (!ret && device->pnp.type.platform_id)
acpi_default_enumeration(device);
} }
device->flags.visited = true; device->flags.visited = true;
...@@ -2633,6 +2654,8 @@ int __init acpi_scan_init(void) ...@@ -2633,6 +2654,8 @@ int __init acpi_scan_init(void)
acpi_pnp_init(); acpi_pnp_init();
acpi_int340x_thermal_init(); acpi_int340x_thermal_init();
acpi_scan_add_handler(&generic_device_handler);
mutex_lock(&acpi_scan_lock); mutex_lock(&acpi_scan_lock);
/* /*
* Enumerate devices in the ACPI namespace. * Enumerate devices in the ACPI namespace.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册