PNP: add pnp_resource_type_name() helper function

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Linux Kernel Mailing List
Date: Wednesday, July 16, 2008 - 4:07 pm

Gitweb:     http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=9fdee4...
Commit:     9fdee4e02e3b214cde8e4f3beb6776075a3d08a7
Parent:     940e98dbc616f1df7b63b73858a966969baf261d
Author:     Bjorn Helgaas <bjorn.helgaas@hp.com>
AuthorDate: Fri Jun 27 16:56:55 2008 -0600
Committer:  Andi Kleen <andi@basil.nowhere.org>
CommitDate: Wed Jul 16 23:27:05 2008 +0200

    PNP: add pnp_resource_type_name() helper function
    
    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    |    1 +
 drivers/pnp/support.c |   15 +++++++++++++++
 2 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/drivers/pnp/base.h b/drivers/pnp/base.h
index 4c2a625..c913158 100644
--- a/drivers/pnp/base.h
+++ b/drivers/pnp/base.h
@@ -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);
diff --git a/drivers/pnp/support.c b/drivers/pnp/support.c
index 7f594cc..eb07345 100644
--- a/drivers/pnp/support.c
+++ b/drivers/pnp/support.c
@@ -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
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
PNP: add pnp_resource_type_name() helper function, Linux Kernel Mailing ..., (Wed Jul 16, 4:07 pm)