Skip to contentSkip to conversation

gpiolib: wm8994: Use irq_domain mappings for gpios

PATCH In review Mark Brown 3 participants 6 messages Jun 3, 2012 – Jul 5, 2012

Subsystems (2)
lore
Share & tools
lore

Mark Brown

author
#0 lore raw

PATCH 1/1 gpiolib: wm8994: Use irq_domain mappings for gpios

This has no practical impact at present since we don't support device tree so any user must have set an irq_base but this will in future allow a transition to device tree with minimal invasiveness.

---
 drivers/gpio/gpio-wm8994.c |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/gpio/gpio-wm8994.c +2 -4
index 92ea535..a1c7ba9 100644
@@ -19,6 +19,7 @@
 #include <linux/mfd/core.h>
 #include <linux/platform_device.h>
 #include <linux/seq_file.h>
+#include <linux/regmap.h>
 
 #include <linux/mfd/wm8994/core.h>
 #include <linux/mfd/wm8994/pdata.h>
@@ -109,10 +110,7 @@ static int wm8994_gpio_to_irq(struct gpio_chip *chip, unsigned offset)
 	struct wm8994_gpio *wm8994_gpio = to_wm8994_gpio(chip);
 	struct wm8994 *wm8994 = wm8994_gpio->wm8994;
 
-	if (!wm8994->irq_base)
-		return -EINVAL;
-
-	return wm8994->irq_base + offset;
+	return regmap_irq_get_virq(wm8994->irq_data, offset);
 }
 
 
Signature · 1 line
1.7.10
Acked-by on v1 1/1
#1 lore raw
Quoted 5 lines · Mark Brown

This has no practical impact at present since we don't support device tree so any user must have set an irq_base but this will in future allow a transition to device tree with minimal invasiveness.

I read some drivers/base/regmap code and I think I understand this stuff now, but seriously, it's quite hard to see the forest with all these trees, and regmap is actually one of the finest new things in recent kernels, so can could we create
Documentation/driver-model/regmap.txt?

I think this document is needed... I would write it myself if I felt I understood the regmap overall concepts well enough, but I'm certain to get something wrong.

Yours,
Linus Walleij

author
#2 lore raw
Quoted 5 lines · Linus Walleij

I read some drivers/base/regmap code and I think I understand this stuff now, but seriously, it's quite hard to see the forest with all these trees, and regmap is actually one of the finest new things in recent kernels, so can could we create
Documentation/driver-model/regmap.txt?

Of course, someone can!

Quoted 3 lines

I think this document is needed... I would write it myself if I felt I understood the regmap overall concepts well enough, but I'm certain to get something wrong.

Well, there's one sure fire way to make sure you've got a good understanding :)

More seriously I'm not sure I could readily tell what's non-obvious and worth writing a document about. Personally I always just read the commit logs for Linux stuff, they're some of the best documentation I've ever seen for software.

#3 lore raw
In reply to Linus Walleij
Quoted 5 lines · On Mon, 4 Jun 2012 19:08:43 +0200 Linus Walleij <[email protected]>…

I read some drivers/base/regmap code and I think I understand this stuff now, but seriously, it's quite hard to see the forest with all these trees, and regmap is actually one of the finest new things in recent kernels, so can could we create
Documentation/driver-model/regmap.txt?

That's actually on my list of things to do (by way of LWN, of course). I just need to get my hands dirty first, probably by converting the ov7670 driver. Unfortunately, I have some serious distractions in my life at the moment, so I can't make any promises as to when this will happen...

jon

author
#4 lore raw
Quoted 5 lines · Jonathan Corbet

That's actually on my list of things to do (by way of LWN, of course). I just need to get my hands dirty first, probably by converting the ov7670 driver. Unfortunately, I have some serious distractions in my life at the moment, so I can't make any promises as to when this will happen...

Actually I was thinking about mailing you about a LWN article at some point but that'd be a different (more tutorialish) thing to what it seemed like Linus was asking for.

#5 lore raw
In reply to Mark Brown
Quoted 5 lines · Mark Brown

This has no practical impact at present since we don't support device tree so any user must have set an irq_base but this will in future allow a transition to device tree with minimal invasiveness.

Patch applied.

Thanks,
Linus Walleij