8000 ACPI / scan: Add a scan handler for PRP0001 · bsd-unix/linux@7d28435 · GitHub
[go: up one dir, main page]

Skip to content 8000

Commit 7d28435

Browse files
committed
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: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Acked-by: Darren Hart <dvhart@linux.intel.com>
1 parent 4c533c8 commit 7d28435

File tree

1 file changed

+28
-5
lines changed

1 file changed

+28
-5
lines changed

drivers/acpi/scan.c

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2392,9 +2392,6 @@ static void acpi_default_enumeration(struct acpi_device *device)
23922392
struct list_head resource_list;
23932393
bool is_spi_i2c_slave = false;
23942394

2395-
if (!device->pnp.type.platform_id || device->handler)
2396-
return;
2397-
23982395
/*
23992396
* Do not enemerate SPI/I2C slaves as they will be enuerated by their
24002397
* respective parents.
@@ -2407,6 +2404,29 @@ static void acpi_default_enumeration(struct acpi_device *device)
24072404
acpi_create_platform_device(device);
24082405
}
24092406

2407+
static const struct acpi_device_id generic_device_ids[] = {
2408+
{"PRP0001", },
2409+
{"", },
2410+
};
2411+
2412+
static int acpi_generic_device_attach(struct acpi_device *adev,
2413+
const struct acpi_device_id *not_used)
2414+
{
2415+
/*
2416+
* Since PRP0001 is the only ID handled here, the test below can be
2417+
* unconditional.
2418+
*/
2419+
if (adev->data.of_compatible)
2420+
acpi_default_enumeration(adev);
2421+
2422+
return 1;
2423+
}
2424+
2425+
static struct acpi_scan_handler generic_device_handler = {
2426+
.ids = generic_device_ids,
2427+
.attach = acpi_generic_device_attach,
2428+
};
2429+
24102430
static int acpi_scan_attach_handler(struct acpi_device *device)
24112431
{
24122432
struct acpi_hardware_id *hwid;
@@ -2432,8 +2452,6 @@ static int acpi_scan_attach_handler(struct acpi_device *device)
24322452
break;
24332453
}
24342454
}
2435-
if (!ret)
2436-
acpi_default_enumeration(device);
24372455

24382456
return ret;
24392457
}
@@ -2475,6 +2493,9 @@ static void acpi_bus_attach(struct acpi_device *device)
24752493
ret = device_attach(&device->dev);
24762494
if (ret < 0)
24772495
return;
2496+
2497+
if (!ret && device->pnp.type.platform_id)
2498+
acpi_default_enumeration(device);
24782499
}
24792500
device->flags.visited = true;
24802501

@@ -2633,6 +2654,8 @@ int __init acpi_scan_init(void)
26332654
acpi_pnp_init();
26342655
acpi_int340x_thermal_init();
26352656

2657+
acpi_scan_add_handler(&generic_device_handler);
2658+
26362659
mutex_lock(&acpi_scan_lock);
26372660
/*
26382661
* Enumerate devices in the ACPI namespace.

0 commit comments

Comments
 (0)
0