This adds a pnp_get_resource() that works the same way as
platform_get_resource(). This will enable us to consolidate
many pnp_resource_table references in one place, which will
make it easier to make the table dynamic.
Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
Acked-By: Rene Herman <rene.herman@gmail.com>
---
drivers/pnp/resource.c | 27 +++++++++++++++++++++++++++
include/linux/pnp.h | 1 +
2 files changed, 28 insertions(+)
Index: work10/include/linux/pnp.h
===================================================================
--- work10.orig/include/linux/pnp.h 2008-04-28 16:09:24.000000000 -0600
+++ work10/include/linux/pnp.h 2008-04-28 16:09:26.000000000 -0600
@@ -25,6 +25,7 @@
/*
* Resource Management
*/
+struct resource *pnp_get_resource(struct pnp_dev *, unsigned int, unsigned int);
/* Use these instead of directly reading pnp_dev to get resource information */
#define pnp_port_start(dev,bar) ((dev)->res.port_resource[(bar)].start)
Index: work10/drivers/pnp/resource.c
===================================================================
--- work10.orig/drivers/pnp/resource.c 2008-04-28 16:09:19.000000000 -0600
+++ work10/drivers/pnp/resource.c 2008-04-28 16:09:26.000000000 -0600
@@ -487,6 +487,33 @@
#endif
}
+struct resource *pnp_get_resource(struct pnp_dev *dev,
+ unsigned int type, unsigned int num)
+{
+ struct pnp_resource_table *res = &dev->res;
+
+ switch (type) {
+ case IORESOURCE_IO:
+ if (num >= PNP_MAX_PORT)
+ return NULL;
+ return &res->port_resource[num];
+ case IORESOURCE_MEM:
+ if (num >= PNP_MAX_MEM)
+ return NULL;
+ return &res->mem_resource[num];
+ case IORESOURCE_IRQ:
+ if (num >= PNP_MAX_IRQ)
+ return NULL;
+ return &res->irq_resource[num];
+ case IORESOURCE_DMA:
+ if (num >= PNP_MAX_DMA)
+ return NULL;
+ return &res->dma_resource[num];
+ }
+ return NULL;
+}
+EXPORT_SYMBOL(pnp_get_resource);
+
/* format is: pnp_reserve_irq=irq1[,irq2] .... */
static int __init pnp_setup_reserve_irq(char *str)
{
--
--
| Arjan van de Ven | [patch] Add basic sanity checks to the syscall execution patch |
| Ingo Molnar | Re: [patch] high-res timers: UP resume fix |
| Satyam Sharma | Re: 2.6.23-rc4-mm1 |
| Bart Van Assche | Integration of SCST in the mainstream Linux kernel |
git: | |
| Eric Wong | Re: [RFC] Git config file reader in Perl (WIP) |
| Raimund Bauer | [wishlist] graphical diff |
| Junio C Hamano | Re: git-diff on touched files: bug or feature? |
| Steve | Re: Libification project (SoC) |
| François Rousseau | carp, ospf can't see carp state |
| Benjamin Bennett | Re: Multi-Threaded SSH/SCP made by university of Puttsburgh |
| Nuno Magalhães | Can't scp, ssh is slow to authenticate. |
| Brian | drm at vga1? |
| Olof Johansson | [PATCH 3/3] pasemi_mac: Disable interface on close |
| Ilpo Järvinen | Re: [bug] stuck localhost TCP connections, v2.6.26-rc3+ |
| Chris Snook | [RFC] introducing the Atheros L2 Fast Ethernet driver |
| Steven Whitehouse | My 802.3ad is my bond |
