aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/scan.c
diff options
context:
space:
mode:
authorZhang Rui <rui.zhang@intel.com>2014-05-30 08:35:34 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2014-05-30 10:04:37 -0400
commit48459340b92b00ae1a75179f168ef20d3e61f264 (patch)
tree46ee03d1984eba3272131619977ac3f2751c1ab0 /drivers/acpi/scan.c
parentd6ddaaac8f5c37ad84db3e6e019981f392389cf0 (diff)
ACPI / scan: use platform bus type by default for _HID enumeration
Because of the growing demand for enumerating ACPI devices to platform bus, change the code to enumerate ACPI device objects to platform bus by default. Namely, create platform devices for the ACPI device objects that 1. Have pnp.type.platform_id set (device objects with _HID currently). 2. Do not have a scan handler attached. 3. Are not SPI/I2C slave devices (that should be enumerated to the appropriate buses bus by their parent). Signed-off-by: Zhang Rui <rui.zhang@intel.com> [rjw: Subject and changelog, rebase and code cleanup] Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Diffstat (limited to 'drivers/acpi/scan.c')
-rw-r--r--drivers/acpi/scan.c42
1 files changed, 41 insertions, 1 deletions
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
index 611bb5db7e57..df49fc8276b9 100644
--- a/drivers/acpi/scan.c
+++ b/drivers/acpi/scan.c
@@ -2070,6 +2070,44 @@ static acpi_status acpi_bus_check_add(acpi_handle handle, u32 lvl_not_used,
2070 return AE_OK; 2070 return AE_OK;
2071} 2071}
2072 2072
2073static int acpi_check_spi_i2c_slave(struct acpi_resource *ares, void *data)
2074{
2075 bool *is_spi_i2c_slave_p = data;
2076
2077 if (ares->type != ACPI_RESOURCE_TYPE_SERIAL_BUS)
2078 return 1;
2079
2080 /*
2081 * devices that are connected to UART still need to be enumerated to
2082 * platform bus
2083 */
2084 if (ares->data.common_serial_bus.type != ACPI_RESOURCE_SERIAL_TYPE_UART)
2085 *is_spi_i2c_slave_p = true;
2086
2087 /* no need to do more checking */
2088 return -1;
2089}
2090
2091static void acpi_default_enumeration(struct acpi_device *device)
2092{
2093 struct list_head resource_list;
2094 bool is_spi_i2c_slave = false;
2095
2096 if (!device->pnp.type.platform_id || device->handler)
2097 return;
2098
2099 /*
2100 * Do not enemerate SPI/I2C slaves as they will be enuerated by their
2101 * respective parents.
2102 */
2103 INIT_LIST_HEAD(&resource_list);
2104 acpi_dev_get_resources(device, &resource_list, acpi_check_spi_i2c_slave,
2105 &is_spi_i2c_slave);
2106 acpi_dev_free_resource_list(&resource_list);
2107 if (!is_spi_i2c_slave)
2108 acpi_create_platform_device(device);
2109}
2110
2073static int acpi_scan_attach_handler(struct acpi_device *device) 2111static int acpi_scan_attach_handler(struct acpi_device *device)
2074{ 2112{
2075 struct acpi_hardware_id *hwid; 2113 struct acpi_hardware_id *hwid;
@@ -2095,6 +2133,9 @@ static int acpi_scan_attach_handler(struct acpi_device *device)
2095 break; 2133 break;
2096 } 2134 }
2097 } 2135 }
2136 if (!ret)
2137 acpi_default_enumeration(device);
2138
2098 return ret; 2139 return ret;
2099} 2140}
2100 2141
@@ -2254,7 +2295,6 @@ int __init acpi_scan_init(void)
2254 acpi_pci_root_init(); 2295 acpi_pci_root_init();
2255 acpi_pci_link_init(); 2296 acpi_pci_link_init();
2256 acpi_processor_init(); 2297 acpi_processor_init();
2257 acpi_platform_init();
2258 acpi_lpss_init(); 2298 acpi_lpss_init();
2259 acpi_cmos_rtc_init(); 2299 acpi_cmos_rtc_init();
2260 acpi_container_init(); 2300 acpi_container_init();