Skip to contentSkip to conversation

drivers/base/platform.c: Add platform_get_irq_flags()

PATCH Superseded Daniel Mack 1 participant 2 messages Mar 13, 2009 – Mar 15, 2009 Driver core

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drivers/base/platform.c: Add platform_get_irq_flags()

For drivers using platform_get_irq(), a function to get the irq flags supplied by the platform_device definition would be helpful. This patch adds it.

---
 drivers/base/platform.c         |   13 +++++++++++++
 include/linux/platform_device.h |    1 +
 2 files changed, 14 insertions(+), 0 deletions(-)
drivers/base/platform.c +13 -0
index 349a101..3d6a9f4 100644
@@ -63,6 +63,19 @@ int platform_get_irq(struct platform_device *dev, unsigned int num)
 EXPORT_SYMBOL_GPL(platform_get_irq);
 
 /**
+ * platform_get_irq_flags - get flags of an IRQ for a device
+ * @dev: platform device
+ * @num: IRQ number index
+ */
+int platform_get_irq_flags(struct platform_device *dev, unsigned int num)
+{
+	struct resource *r = platform_get_resource(dev, IORESOURCE_IRQ, num);
+
+	return r ? r->flags : -ENXIO;
+}
+EXPORT_SYMBOL_GPL(platform_get_irq_flags);
+
+/**
  * platform_get_resource_byname - get a resource for a device by name
  * @dev: platform device
  * @type: resource type
include/linux/platform_device.h +1 -0
index 9a34269..a2c6c2c 100644
@@ -31,6 +31,7 @@ extern struct device platform_bus;
 
 extern struct resource *platform_get_resource(struct platform_device *, unsigned int, unsigned int);
 extern int platform_get_irq(struct platform_device *, unsigned int);
+extern int platform_get_irq_flags(struct platform_device *, unsigned int);
 extern struct resource *platform_get_resource_byname(struct platform_device *, unsigned int, char *);
 extern int platform_get_irq_byname(struct platform_device *, char *);
 extern int platform_add_devices(struct platform_device **, int);
Signature · 1 line
1.6.2
#1 lore raw
Quoted 3 lines · Daniel Mack

For drivers using platform_get_irq(), a function to get the irq flags supplied by the platform_device definition would be helpful. This patch adds it.

Any oppinion on that? Sorry I didn't Cc: anyone on that post, but I couldn't figure out who's specifically in charge of maintaining that code.

Daniel

Quoted 44 lines
---
 drivers/base/platform.c         |   13 +++++++++++++
 include/linux/platform_device.h |    1 +
 2 files changed, 14 insertions(+), 0 deletions(-)
drivers/base/platform.c +13 -0
index 349a101..3d6a9f4 100644
@@ -63,6 +63,19 @@ int platform_get_irq(struct platform_device *dev, unsigned int num)
 EXPORT_SYMBOL_GPL(platform_get_irq);
 
 /**
+ * platform_get_irq_flags - get flags of an IRQ for a device
+ * @dev: platform device
+ * @num: IRQ number index
+ */
+int platform_get_irq_flags(struct platform_device *dev, unsigned int num)
+{
+	struct resource *r = platform_get_resource(dev, IORESOURCE_IRQ, num);
+
+	return r ? r->flags : -ENXIO;
+}
+EXPORT_SYMBOL_GPL(platform_get_irq_flags);
+
+/**
  * platform_get_resource_byname - get a resource for a device by name
  * @dev: platform device
  * @type: resource type
include/linux/platform_device.h +1 -0
index 9a34269..a2c6c2c 100644
@@ -31,6 +31,7 @@ extern struct device platform_bus;
 
 extern struct resource *platform_get_resource(struct platform_device *, unsigned int, unsigned int);
 extern int platform_get_irq(struct platform_device *, unsigned int);
+extern int platform_get_irq_flags(struct platform_device *, unsigned int);
 extern struct resource *platform_get_resource_byname(struct platform_device *, unsigned int, char *);
 extern int platform_get_irq_byname(struct platform_device *, char *);
 extern int platform_add_devices(struct platform_device **, int);
Signature · 1 line
1.6.2