diff mbox

[RFC,5/8] PNPACPI: check and enumerate CMOS RTC devices explicitly

Message ID 1393405874-3266-6-git-send-email-rui.zhang@intel.com (mailing list archive)
State RFC, archived
Headers show

Commit Message

Zhang, Rui Feb. 26, 2014, 9:11 a.m. UTC
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 <rui.zhang@intel.com>
---
 drivers/pnp/pnpacpi/core.c |   22 +++++++++++++++++-----
 1 file changed, 17 insertions(+), 5 deletions(-)
diff mbox

Patch

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;
 }