For CMOS RTC devices, the pnpacpi scan handler does not work because
there is already a cmos rtc scan handler installed, thus we need to
check those devices and enumerate them to PNP bus explicitly.

Signed-off-by: Zhang Rui <[email protected]>
---
 drivers/pnp/pnpacpi/core.c |   22 +++++++++++++++++-----
 1 file changed, 17 insertions(+), 5 deletions(-)

diff --git a/drivers/pnp/pnpacpi/core.c b/drivers/pnp/pnpacpi/core.c
index 36dda39..1ee7eb7 100644
--- a/drivers/pnp/pnpacpi/core.c
+++ b/drivers/pnp/pnpacpi/core.c
@@ -176,10 +176,6 @@ static const struct acpi_device_id acpi_pnp_device_ids[]= {
        /* system */
        {"PNP0c02"}, /* General ID for reserving resources */
        {"PNP0c01"}, /* memory controller */
-       /* rtc_cmos */
-       {"PNP0b00"},
-       {"PNP0b01"},
-       {"PNP0b02"},
        /* c6xdigio */
         {"PNP0400"}, /* Standard LPT Printer Port */
         {"PNP0401"}, /* ECP Printer Port */
@@ -669,6 +665,22 @@ void __init acpi_pnp_init(void)
        acpi_scan_add_handler(&pnpacpi_handler);
 }
 
+/*
+ * For CMOS RTC devices, the pnpacpi scan handler does not work because
+ * there is already a cmos rtc scan handler installed, thus we need to
+ * check those devices and enumerate them to PNP bus explicitly.
+ */
+static int is_cmos_rtc_device(struct acpi_device *adev)
+{
+       struct acpi_device_id ids[] = {
+               { "PNP0B00" },
+               { "PNP0B01" },
+               { "PNP0B02" },
+               {""},
+       };
+       return !acpi_match_device_ids(adev, ids);
+}
+
 static acpi_status __init pnpacpi_add_device_handler(acpi_handle handle,
                                                     u32 lvl, void *context,
                                                     void **rv)
@@ -677,7 +689,7 @@ static acpi_status __init 
pnpacpi_add_device_handler(acpi_handle handle,
 
        if (acpi_bus_get_device(handle, &device))
                return AE_CTRL_DEPTH;
-       if (device->handler == &pnpacpi_handler)
+       if (device->handler == &pnpacpi_handler || is_cmos_rtc_device(device))
                pnpacpi_add_device(device);
        return AE_OK;
 }
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to