From patchwork Thu Mar 13 16:16:45 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhang Rui X-Patchwork-Id: 3827101 Return-Path: X-Original-To: patchwork-linux-acpi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 39403BF540 for ; Thu, 13 Mar 2014 16:22:20 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 714972018E for ; Thu, 13 Mar 2014 16:22:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id ADE2820163 for ; Thu, 13 Mar 2014 16:22:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754393AbaCMQSN (ORCPT ); Thu, 13 Mar 2014 12:18:13 -0400 Received: from mga02.intel.com ([134.134.136.20]:65273 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754171AbaCMQSK (ORCPT ); Thu, 13 Mar 2014 12:18:10 -0400 Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga101.jf.intel.com with ESMTP; 13 Mar 2014 09:17:13 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.97,648,1389772800"; d="scan'208";a="471738703" Received: from unknown (HELO rzhang1-mobl4.ccr.corp.intel.com) ([10.255.21.213]) by orsmga001.jf.intel.com with ESMTP; 13 Mar 2014 09:17:09 -0700 From: Zhang Rui To: linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org Cc: bhelgaas@google.com, matthew.garrett@nebula.com, rafael.j.wysocki@intel.com, dmitry.torokhov@gmail.com, Zhang Rui Subject: [PATCH V2 05/13] ACPI: check and enumerate CMOS RTC devices explicitly Date: Fri, 14 Mar 2014 00:16:45 +0800 Message-Id: <1394727413-3587-6-git-send-email-rui.zhang@intel.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1394727413-3587-1-git-send-email-rui.zhang@intel.com> References: <1394727413-3587-1-git-send-email-rui.zhang@intel.com> Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP For CMOS RTC devices, the acpi pnp 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. Note: the CMOS RTC device id is not removed from ACPI pnp scan handler id list, thus, if cmos rtc scan handler is compiled out, the ACPI pnp scan handler will be attached to the CMOS RTC devices instead, to prevent these devices from being created to platform bus. Signed-off-by: Zhang Rui --- drivers/acpi/acpi_pnp.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/drivers/acpi/acpi_pnp.c b/drivers/acpi/acpi_pnp.c index 2a7f86f..6fa482a 100644 --- a/drivers/acpi/acpi_pnp.c +++ b/drivers/acpi/acpi_pnp.c @@ -349,9 +349,29 @@ static struct acpi_scan_handler acpi_pnp_handler = { .attach = acpi_pnp_scan_handler_attach, }; +/* + * For CMOS RTC devices, the acpi pnp spcan 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); +} + bool acpi_is_pnp_device(struct acpi_device *device) { - return !!(device->handler == &acpi_pnp_handler); + if (device->handler == &acpi_pnp_handler) + return true; + if (is_cmos_rtc_device(device)) + return true; + return false; } EXPORT_SYMBOL_GPL(acpi_is_pnp_device);