ACPI / scan: always register ACPI LPSS scan handler
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Fri, 30 May 2014 12:34:05 +0000 (14:34 +0200)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Fri, 30 May 2014 14:04:36 +0000 (16:04 +0200)
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 <rafael.j.wysocki@intel.com>
Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
drivers/acpi/Makefile
drivers/acpi/acpi_lpss.c
drivers/acpi/internal.h

index f1c9266430d99ab88ec59f7a3b6b701e1d1c00a3..ea55e0179f817c6331149315a6c7f3245e84de2d 100644 (file)
@@ -39,7 +39,7 @@ acpi-y                                += processor_core.o
 acpi-y                         += ec.o
 acpi-$(CONFIG_ACPI_DOCK)       += dock.o
 acpi-y                         += pci_root.o pci_link.o pci_irq.o
-acpi-$(CONFIG_X86_INTEL_LPSS)  += acpi_lpss.o
+acpi-y                         += acpi_lpss.o
 acpi-y                         += acpi_platform.o
 acpi-y                         += acpi_pnp.o
 acpi-y                         += power.o
index db362a96c38eb70d22524e10ed2bcf23b9b95f43..51069b2605184261ddc8034d87c72cb1113fd552 100644 (file)
 
 ACPI_MODULE_NAME("acpi_lpss");
 
+#ifdef CONFIG_X86_INTEL_LPSS
+
+#define LPSS_ADDR(desc) ((unsigned long)&desc)
+
 #define LPSS_CLK_SIZE  0x04
 #define LPSS_LTR_SIZE  0x18
 
@@ -169,40 +173,48 @@ static struct lpss_device_desc byt_i2c_dev_desc = {
        .shared_clock = &i2c_clock,
 };
 
+#else
+
+#define LPSS_ADDR(desc) (0UL)
+
+#endif /* CONFIG_X86_INTEL_LPSS */
+
 static const struct acpi_device_id acpi_lpss_device_ids[] = {
        /* Generic LPSS devices */
-       { "INTL9C60", (unsigned long)&lpss_dma_desc },
+       { "INTL9C60", LPSS_ADDR(lpss_dma_desc) },
 
        /* Lynxpoint LPSS devices */
-       { "INT33C0", (unsigned long)&lpt_dev_desc },
-       { "INT33C1", (unsigned long)&lpt_dev_desc },
-       { "INT33C2", (unsigned long)&lpt_i2c_dev_desc },
-       { "INT33C3", (unsigned long)&lpt_i2c_dev_desc },
-       { "INT33C4", (unsigned long)&lpt_uart_dev_desc },
-       { "INT33C5", (unsigned long)&lpt_uart_dev_desc },
-       { "INT33C6", (unsigned long)&lpt_sdio_dev_desc },
+       { "INT33C0", LPSS_ADDR(lpt_dev_desc) },
+       { "INT33C1", LPSS_ADDR(lpt_dev_desc) },
+       { "INT33C2", LPSS_ADDR(lpt_i2c_dev_desc) },
+       { "INT33C3", LPSS_ADDR(lpt_i2c_dev_desc) },
+       { "INT33C4", LPSS_ADDR(lpt_uart_dev_desc) },
+       { "INT33C5", LPSS_ADDR(lpt_uart_dev_desc) },
+       { "INT33C6", LPSS_ADDR(lpt_sdio_dev_desc) },
        { "INT33C7", },
 
        /* BayTrail LPSS devices */
-       { "80860F09", (unsigned long)&byt_pwm_dev_desc },
-       { "80860F0A", (unsigned long)&byt_uart_dev_desc },
-       { "80860F0E", (unsigned long)&byt_spi_dev_desc },
-       { "80860F14", (unsigned long)&byt_sdio_dev_desc },
-       { "80860F41", (unsigned long)&byt_i2c_dev_desc },
+       { "80860F09", LPSS_ADDR(byt_pwm_dev_desc) },
+       { "80860F0A", LPSS_ADDR(byt_uart_dev_desc) },
+       { "80860F0E", LPSS_ADDR(byt_spi_dev_desc) },
+       { "80860F14", LPSS_ADDR(byt_sdio_dev_desc) },
+       { "80860F41", LPSS_ADDR(byt_i2c_dev_desc) },
        { "INT33B2", },
 
-       { "INT3430", (unsigned long)&lpt_dev_desc },
-       { "INT3431", (unsigned long)&lpt_dev_desc },
-       { "INT3432", (unsigned long)&lpt_i2c_dev_desc },
-       { "INT3433", (unsigned long)&lpt_i2c_dev_desc },
-       { "INT3434", (unsigned long)&lpt_uart_dev_desc },
-       { "INT3435", (unsigned long)&lpt_uart_dev_desc },
-       { "INT3436", (unsigned long)&lpt_sdio_dev_desc },
+       { "INT3430", LPSS_ADDR(lpt_dev_desc) },
+       { "INT3431", LPSS_ADDR(lpt_dev_desc) },
+       { "INT3432", LPSS_ADDR(lpt_i2c_dev_desc) },
+       { "INT3433", LPSS_ADDR(lpt_i2c_dev_desc) },
+       { "INT3434", LPSS_ADDR(lpt_uart_dev_desc) },
+       { "INT3435", LPSS_ADDR(lpt_uart_dev_desc) },
+       { "INT3436", LPSS_ADDR(lpt_sdio_dev_desc) },
        { "INT3437", },
 
        { }
 };
 
+#ifdef CONFIG_X86_INTEL_LPSS
+
 static int is_memory(struct acpi_resource *res, void *not_used)
 {
        struct resource r;
@@ -695,3 +707,16 @@ void __init acpi_lpss_init(void)
                acpi_scan_add_handler(&lpss_handler);
        }
 }
+
+#else
+
+static struct acpi_scan_handler lpss_handler = {
+       .ids = acpi_lpss_device_ids,
+};
+
+void __init acpi_lpss_init(void)
+{
+       acpi_scan_add_handler(&lpss_handler);
+}
+
+#endif /* CONFIG_X86_INTEL_LPSS */
index 5ad27bf8e4bd82c24544da3b84870409784a1836..7de5b603f272b204305899e0147fce9b7c4042a9 100644 (file)
@@ -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);