From eec15edbb0e14485998635ea7c62e30911b465f0 Mon Sep 17 00:00:00 2001 From: Zhang Rui Date: Fri, 30 May 2014 04:23:01 +0200 Subject: ACPI / PNP: use device ID list for PNPACPI device enumeration ACPI can be used to enumerate PNP devices, but the code does not handle this in the right way currently. Namely, if an ACPI device object 1. Has a _CRS method, 2. Has an identification of "three capital characters followed by four hex digits", 3. Is not in the excluded IDs list, it will be enumerated to PNP bus (that is, a PNP device object will be create for it). This means that, actually, the PNP bus type is used as the default bus type for enumerating _HID devices in ACPI. However, more and more _HID devices need to be enumerated to the platform bus instead (that is, platform device objects need to be created for them). As a result, the device ID list in acpi_platform.c is used to enforce creating platform device objects rather than PNP device objects for matching devices. That list has been continuously growing recently, unfortunately, and it is pretty much guaranteed to grow even more in the future. To address that problem it is better to enumerate _HID devices as platform devices by default. To this end, change the way of enumerating PNP devices by adding a PNP ACPI scan handler that will use a device ID list to create PNP devices for the ACPI device objects whose device IDs are present in that list. The initial device ID list in the PNP ACPI scan handler contains all of the pnp_device_id strings from all the existing PNP drivers, so this change should be transparent to the PNP core and all of the PNP drivers. Still, in the future it should be possible to reduce its size by converting PNP drivers that need not be PNP for any technical reasons into platform drivers. Signed-off-by: Zhang Rui [rjw: Rewrote the changelog, modified the PNP ACPI scan handler code] Signed-off-by: Rafael J. Wysocki Reviewed-by: Mika Westerberg --- drivers/acpi/internal.h | 1 + 1 file changed, 1 insertion(+) (limited to 'drivers/acpi/internal.h') diff --git a/drivers/acpi/internal.h b/drivers/acpi/internal.h index bb7de413d06..5c16cb6bc76 100644 --- a/drivers/acpi/internal.h +++ b/drivers/acpi/internal.h @@ -30,6 +30,7 @@ void acpi_pci_root_init(void); void acpi_pci_link_init(void); void acpi_processor_init(void); void acpi_platform_init(void); +void acpi_pnp_init(void); int acpi_sysfs_init(void); #ifdef CONFIG_ACPI_CONTAINER void acpi_container_init(void); -- cgit v1.2.3 From a1ec657213b4abb00e59385171554a3e11eec27c Mon Sep 17 00:00:00 2001 From: "Rafael J. Wysocki" Date: Fri, 30 May 2014 04:28:20 +0200 Subject: ACPI / scan: always register container scan handler Prevent platform devices from being created for ACPI containers if CONFIG_ACPI_CONTAINER is unset by compiling out the container scan handler's callbacks only in that case and still compiling its device ID list in and registering the scan handler in either case. This change is based on a prototype from Zhang Rui. Signed-off-by: Rafael J. Wysocki Reviewed-by: Mika Westerberg --- drivers/acpi/internal.h | 4 ---- 1 file changed, 4 deletions(-) (limited to 'drivers/acpi/internal.h') diff --git a/drivers/acpi/internal.h b/drivers/acpi/internal.h index 5c16cb6bc76..cc93efd22a2 100644 --- a/drivers/acpi/internal.h +++ b/drivers/acpi/internal.h @@ -32,11 +32,7 @@ void acpi_processor_init(void); void acpi_platform_init(void); void acpi_pnp_init(void); int acpi_sysfs_init(void); -#ifdef CONFIG_ACPI_CONTAINER void acpi_container_init(void); -#else -static inline void acpi_container_init(void) {} -#endif #ifdef CONFIG_ACPI_DOCK void register_dock_dependent_device(struct acpi_device *adev, acpi_handle dshandle); -- cgit v1.2.3 From cccd420859a419756bc4ed25d52989a47d702561 Mon Sep 17 00:00:00 2001 From: "Rafael J. Wysocki" Date: Fri, 30 May 2014 04:29:14 +0200 Subject: ACPI / scan: always register memory hotplug scan handler Prevent platform devices from being created for ACPI memory device objects if CONFIG_ACPI_HOTPLUG_MEMORY is unset by compiling out the memory hotplug scan handler's callbacks only in that case and still compiling its device ID list in and registering the scan handler in either case. Also unset the memory hotplug scan handler's .attach() callback if acpi_no_memhotplug is set, but still register the scan handler to avoid creating platform devices for ACPI memory devices in that case too. This change is based on a prototype from Zhang Rui. Signed-off-by: Rafael J. Wysocki Reviewed-by: Mika Westerberg --- drivers/acpi/internal.h | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'drivers/acpi/internal.h') diff --git a/drivers/acpi/internal.h b/drivers/acpi/internal.h index cc93efd22a2..5ad27bf8e4b 100644 --- a/drivers/acpi/internal.h +++ b/drivers/acpi/internal.h @@ -33,6 +33,7 @@ void acpi_platform_init(void); void acpi_pnp_init(void); int acpi_sysfs_init(void); void acpi_container_init(void); +void acpi_memory_hotplug_init(void); #ifdef CONFIG_ACPI_DOCK void register_dock_dependent_device(struct acpi_device *adev, acpi_handle dshandle); @@ -44,11 +45,6 @@ static inline void register_dock_dependent_device(struct acpi_device *adev, static inline int dock_notify(struct acpi_device *adev, u32 event) { return -ENODEV; } static inline void acpi_dock_add(struct acpi_device *adev) {} #endif -#ifdef CONFIG_ACPI_HOTPLUG_MEMORY -void acpi_memory_hotplug_init(void); -#else -static inline void acpi_memory_hotplug_init(void) {} -#endif #ifdef CONFIG_X86 void acpi_cmos_rtc_init(void); #else -- cgit v1.2.3 From d6ddaaac8f5c37ad84db3e6e019981f392389cf0 Mon Sep 17 00:00:00 2001 From: "Rafael J. Wysocki" Date: Fri, 30 May 2014 14:34:05 +0200 Subject: ACPI / scan: always register ACPI LPSS scan handler Prevent platform devices from being created for ACPI LPSS devices if CONFIG_X86_INTEL_LPSS is unset by compiling out the LPSS scan handler's callbacks only in that case and still compiling its device ID list in and registering the scan handler in either case. This change is based on a prototype from Zhang Rui. Signed-off-by: Rafael J. Wysocki Reviewed-by: Mika Westerberg --- drivers/acpi/internal.h | 4 ---- 1 file changed, 4 deletions(-) (limited to 'drivers/acpi/internal.h') diff --git a/drivers/acpi/internal.h b/drivers/acpi/internal.h index 5ad27bf8e4b..7de5b603f27 100644 --- a/drivers/acpi/internal.h +++ b/drivers/acpi/internal.h @@ -65,11 +65,7 @@ int acpi_debugfs_init(void); #else static inline void acpi_debugfs_init(void) { return; } #endif -#ifdef CONFIG_X86_INTEL_LPSS void acpi_lpss_init(void); -#else -static inline void acpi_lpss_init(void) {} -#endif acpi_status acpi_hotplug_schedule(struct acpi_device *adev, u32 src); bool acpi_queue_hotplug_work(struct work_struct *work); -- cgit v1.2.3