PNP: add pnp_resource_type_name() helper function
authorBjorn Helgaas <bjorn.helgaas@hp.com>
Fri, 27 Jun 2008 22:56:55 +0000 (16:56 -0600)
committerAndi Kleen <andi@basil.nowhere.org>
Wed, 16 Jul 2008 21:27:05 +0000 (23:27 +0200)
This patch adds a "pnp_resource_type_name(struct resource *)" that
returns the string resource type.  This will be used by the sysfs
"show resources" function and the debug resource dump function.

Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
Signed-off-by: Len Brown <len.brown@intel.com>
Signed-off-by: Andi Kleen <ak@linux.intel.com>
drivers/pnp/base.h
drivers/pnp/support.c

index 4c2a625649943b1af8a70208cf6415ff408b7125..c91315826da2259a6271bbfa47b6becb38c2d235 100644 (file)
@@ -43,6 +43,7 @@ int pnp_check_mem(struct pnp_dev *dev, struct resource *res);
 int pnp_check_irq(struct pnp_dev *dev, struct resource *res);
 int pnp_check_dma(struct pnp_dev *dev, struct resource *res);
 
+char *pnp_resource_type_name(struct resource *res);
 void dbg_pnp_show_resources(struct pnp_dev *dev, char *desc);
 
 void pnp_init_resource(struct resource *res);
index 7f594ccf49580072008ea6570f1ff4b323187522..eb07345f5cf708aa52ad20353893760f94174dff 100644 (file)
@@ -52,6 +52,21 @@ void pnp_eisa_id_to_string(u32 id, char *str)
        str[7] = '\0';
 }
 
+char *pnp_resource_type_name(struct resource *res)
+{
+       switch (pnp_resource_type(res)) {
+       case IORESOURCE_IO:
+               return "io";
+       case IORESOURCE_MEM:
+               return "mem";
+       case IORESOURCE_IRQ:
+               return "irq";
+       case IORESOURCE_DMA:
+               return "dma";
+       }
+       return NULL;
+}
+
 void dbg_pnp_show_resources(struct pnp_dev *dev, char *desc)
 {
 #ifdef DEBUG