diff options
author | Bjorn Helgaas <bjorn.helgaas@hp.com> | 2009-11-17 19:05:19 -0500 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2009-12-15 17:35:26 -0500 |
commit | 9065ce4500085b9ca66b19d3c4d21a73cb410173 (patch) | |
tree | c487e3f9b3b56cc829ea2362a33b888a42d83f8f | |
parent | c4da6940a7a41c72781ff2d62ebd4b99f3749f14 (diff) |
PNP: add interface to retrieve ACPI device from a PNPACPI device
Add pnp_acpi_device(pnp_dev), which takes a PNP device and returns the
associated ACPI device (or NULL, if the device is not a PNPACPI device).
This allows us to write a PNP driver that can manage both traditional
PNPBIOS and ACPI devices, treating ACPI-only functionality as an optional
extension.
Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
Signed-off-by: Len Brown <len.brown@intel.com>
-rw-r--r-- | drivers/pnp/pnpacpi/core.c | 3 | ||||
-rw-r--r-- | include/linux/pnp.h | 13 |
2 files changed, 15 insertions, 1 deletions
diff --git a/drivers/pnp/pnpacpi/core.c b/drivers/pnp/pnpacpi/core.c index b2348fc2378e..5314bf630bc4 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) | |||
144 | } | 144 | } |
145 | #endif | 145 | #endif |
146 | 146 | ||
147 | static struct pnp_protocol pnpacpi_protocol = { | 147 | struct pnp_protocol pnpacpi_protocol = { |
148 | .name = "Plug and Play ACPI", | 148 | .name = "Plug and Play ACPI", |
149 | .get = pnpacpi_get_resources, | 149 | .get = pnpacpi_get_resources, |
150 | .set = pnpacpi_set_resources, | 150 | .set = pnpacpi_set_resources, |
@@ -154,6 +154,7 @@ static struct pnp_protocol pnpacpi_protocol = { | |||
154 | .resume = pnpacpi_resume, | 154 | .resume = pnpacpi_resume, |
155 | #endif | 155 | #endif |
156 | }; | 156 | }; |
157 | EXPORT_SYMBOL(pnpacpi_protocol); | ||
157 | 158 | ||
158 | static int __init pnpacpi_add_device(struct acpi_device *device) | 159 | static int __init pnpacpi_add_device(struct acpi_device *device) |
159 | { | 160 | { |
diff --git a/include/linux/pnp.h b/include/linux/pnp.h index fddfafaed024..7c4193eb0072 100644 --- a/include/linux/pnp.h +++ b/include/linux/pnp.h | |||
@@ -334,6 +334,19 @@ extern struct pnp_protocol pnpbios_protocol; | |||
334 | #define pnp_device_is_pnpbios(dev) 0 | 334 | #define pnp_device_is_pnpbios(dev) 0 |
335 | #endif | 335 | #endif |
336 | 336 | ||
337 | #ifdef CONFIG_PNPACPI | ||
338 | extern struct pnp_protocol pnpacpi_protocol; | ||
339 | |||
340 | static inline struct acpi_device *pnp_acpi_device(struct pnp_dev *dev) | ||
341 | { | ||
342 | if (dev->protocol == &pnpacpi_protocol) | ||
343 | return dev->data; | ||
344 | return NULL; | ||
345 | } | ||
346 | #else | ||
347 | #define pnp_acpi_device(dev) 0 | ||
348 | #endif | ||
349 | |||
337 | /* status */ | 350 | /* status */ |
338 | #define PNP_READY 0x0000 | 351 | #define PNP_READY 0x0000 |
339 | #define PNP_ATTACHED 0x0001 | 352 | #define PNP_ATTACHED 0x0001 |