From patchwork Wed Nov 18 00:05:19 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Helgaas X-Patchwork-Id: 60860 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id nAI05DHE027977 for ; Wed, 18 Nov 2009 00:05:23 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752697AbZKRAFP (ORCPT ); Tue, 17 Nov 2009 19:05:15 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752289AbZKRAFP (ORCPT ); Tue, 17 Nov 2009 19:05:15 -0500 Received: from g5t0007.atlanta.hp.com ([15.192.0.44]:1662 "EHLO g5t0007.atlanta.hp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752697AbZKRAFN (ORCPT ); Tue, 17 Nov 2009 19:05:13 -0500 Received: from g1t0038.austin.hp.com (g1t0038.austin.hp.com [16.236.32.44]) by g5t0007.atlanta.hp.com (Postfix) with ESMTP id DFE62144A3; Wed, 18 Nov 2009 00:05:19 +0000 (UTC) Received: from ldl (linux.corp.hp.com [15.11.146.101]) by g1t0038.austin.hp.com (Postfix) with ESMTP id B4A0D30387; Wed, 18 Nov 2009 00:05:19 +0000 (UTC) Received: from localhost (ldl.fc.hp.com [127.0.0.1]) by ldl (Postfix) with ESMTP id 98235CF0010; Tue, 17 Nov 2009 17:05:19 -0700 (MST) Received: from ldl ([127.0.0.1]) by localhost (ldl.fc.hp.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id v+gqy0kdc7ks; Tue, 17 Nov 2009 17:05:19 -0700 (MST) Received: from eh.fc.hp.com (eh.fc.hp.com [15.11.146.105]) by ldl (Postfix) with ESMTP id 8125CCF0007; Tue, 17 Nov 2009 17:05:19 -0700 (MST) Received: from bob.kio (localhost [127.0.0.1]) by eh.fc.hp.com (Postfix) with ESMTP id 681182613F; Tue, 17 Nov 2009 17:05:19 -0700 (MST) Subject: [PATCH v1 2/5] PNP: add interface to retrieve ACPI device from a PNPACPI device To: Zhao Yakui From: Bjorn Helgaas Cc: Corey Minyard , Bela Lubkin , linux-acpi@vger.kernel.org, Myron Stowe , openipmi-developer@lists.sourceforge.net, Len Brown Date: Tue, 17 Nov 2009 17:05:19 -0700 Message-ID: <20091118000519.14214.61241.stgit@bob.kio> In-Reply-To: <20091118000427.14214.14043.stgit@bob.kio> References: <20091118000427.14214.14043.stgit@bob.kio> User-Agent: StGit/0.15 MIME-Version: 1.0 Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org diff --git a/drivers/pnp/pnpacpi/core.c b/drivers/pnp/pnpacpi/core.c index b2348fc..8dd0f37 100644 --- a/drivers/pnp/pnpacpi/core.c +++ b/drivers/pnp/pnpacpi/core.c @@ -144,7 +144,7 @@ static int pnpacpi_resume(struct pnp_dev *dev) } #endif -static struct pnp_protocol pnpacpi_protocol = { +struct pnp_protocol pnpacpi_protocol = { .name = "Plug and Play ACPI", .get = pnpacpi_get_resources, .set = pnpacpi_set_resources, diff --git a/include/linux/pnp.h b/include/linux/pnp.h index fddfafa..7c4193e 100644 --- a/include/linux/pnp.h +++ b/include/linux/pnp.h @@ -334,6 +334,19 @@ extern struct pnp_protocol pnpbios_protocol; #define pnp_device_is_pnpbios(dev) 0 #endif +#ifdef CONFIG_PNPACPI +extern struct pnp_protocol pnpacpi_protocol; + +static inline struct acpi_device *pnp_acpi_device(struct pnp_dev *dev) +{ + if (dev->protocol == &pnpacpi_protocol) + return dev->data; + return NULL; +} +#else +#define pnp_acpi_device(dev) 0 +#endif + /* status */ #define PNP_READY 0x0000 #define PNP_ATTACHED 0x0001