[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <200803261715.05328.bjorn.helgaas@hp.com>
Date: Wed, 26 Mar 2008 17:15:03 -0600
From: Bjorn Helgaas <bjorn.helgaas@...com>
To: Len Brown <lenb@...nel.org>
Cc: linux-acpi@...r.kernel.org, linux-kernel@...r.kernel.org,
Adam Belay <ambx1@....rr.com>,
Li Shaohua <shaohua.li@...el.com>,
Matthieu Castet <castet.matthieu@...e.fr>,
Thomas Renninger <trenn@...e.de>,
Rene Herman <rene.herman@...access.nl>,
Jaroslav Kysela <perex@...ex.cz>,
Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [patch 28/37] PNP: add pnp_get_resource() interface
PNP: add pnp_get_resource() interface
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.
I used EXPORT_SYMBOL, not EXPORT_SYMBOL_GPL, because it doesn't
seem right to break existing non-GPL PNP drivers.
Signed-off-by: Bjorn Helgaas <bjorn.helgaas@...com>
---
drivers/pnp/resource.c | 27 +++++++++++++++++++++++++++
include/linux/pnp.h | 1 +
2 files changed, 28 insertions(+)
Index: work7/include/linux/pnp.h
===================================================================
--- work7.orig/include/linux/pnp.h 2008-03-26 11:10:22.000000000 -0600
+++ work7/include/linux/pnp.h 2008-03-26 16:50:05.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: work7/drivers/pnp/resource.c
===================================================================
--- work7.orig/drivers/pnp/resource.c 2008-03-26 11:10:29.000000000 -0600
+++ work7/drivers/pnp/resource.c 2008-03-26 16:50:42.000000000 -0600
@@ -560,6 +560,33 @@
return 0;
}
+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)
{
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists