From: Daniel Mack <daniel@caiaq.de>
To: linux-kernel@vger.kernel.org
Cc: Daniel Mack <daniel@caiaq.de>
Subject: [PATCH] drivers/base/platform.c: Add platform_get_irq_flags()
Date: Fri, 13 Mar 2009 15:29:42 +0100 [thread overview]
Message-ID: <1236954582-10143-1-git-send-email-daniel@caiaq.de> (raw)
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.
Signed-off-by: Daniel Mack <daniel@caiaq.de>
---
drivers/base/platform.c | 13 +++++++++++++
include/linux/platform_device.h | 1 +
2 files changed, 14 insertions(+), 0 deletions(-)
diff --git a/drivers/base/platform.c b/drivers/base/platform.c
index 349a101..3d6a9f4 100644
--- a/drivers/base/platform.c
+++ b/drivers/base/platform.c
@@ -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
diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h
index 9a34269..a2c6c2c 100644
--- a/include/linux/platform_device.h
+++ b/include/linux/platform_device.h
@@ -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);
--
1.6.2
next reply other threads:[~2009-03-13 14:30 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-13 14:29 Daniel Mack [this message]
2009-03-15 12:13 ` [PATCH] drivers/base/platform.c: Add platform_get_irq_flags() Daniel Mack
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1236954582-10143-1-git-send-email-daniel@caiaq.de \
--to=daniel@caiaq.de \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox