[patch 44/53] PNP: add pnp_resource_type() internal interface

Bjorn Helgaas
2008-04-18T20:50:39Z

[-- Attachment #1: pnp-add-pnp_resource_type --]
[-- Type: text/plain, Size: 1116 bytes --]

Given a struct resource, this returns the type (IO, MEM, IRQ, DMA).

Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>

Index: work8/drivers/pnp/base.h
===================================================================
--- work8.orig/drivers/pnp/base.h 2008-04-17 14:07:25.000000000 -0600
+++ work8/drivers/pnp/base.h 2008-04-17 14:07:37.000000000 -0600
@@ -18,6 +18,7 @@
int pnp_check_dma(struct pnp_dev * dev, int idx);

void pnp_init_resource(struct resource *res);
+int pnp_resource_type(struct resource *res);

#define PNP_MAX_PORT 40
#define PNP_MAX_MEM 24
Index: work8/drivers/pnp/resource.c
===================================================================
--- work8.orig/drivers/pnp/resource.c 2008-04-17 14:07:48.000000000 -0600
+++ work8/drivers/pnp/resource.c 2008-04-17 14:09:25.000000000 -0600
@@ -489,6 +489,12 @@
#endif
}

+int pnp_resource_type(struct resource *res)
+{
+ return res->flags & (IORESOURCE_IO | IORESOURCE_MEM |
+ IORESOURCE_IRQ | IORESOURCE_DMA);
+}
+
struct resource *pnp_get_resource(struct pnp_dev *dev,
unsigned int type, unsigned int num)
{

--