Skip to contentSkip to conversation

mfd: da9052: Fix genirq abuse

PATCH In review Mark Brown 2 participants 3 messages May 13, 2012 – May 14, 2012

Subsystems (2)
lore
Share & tools
lore

Mark Brown

author
#0 lore raw

PATCH 1/1 mfd: da9052: Fix genirq abuse

Rather than using the pointer passed back by the regmap API (or complaining because that wasn't actually being set) the da9052 driver was having some fun and games peering through genirq and regmap internals. Fix the driver to use the API as expected.

---
 drivers/mfd/da9052-core.c         |    8 +++-----
 include/linux/mfd/da9052/da9052.h |    1 +
 2 files changed, 4 insertions(+), 5 deletions(-)
drivers/mfd/da9052-core.c +3 -5
index 7ff313f..7776aff 100644
@@ -659,12 +659,11 @@ int __devinit da9052_device_init(struct da9052 *da9052, u8 chip_id)
 	ret = regmap_add_irq_chip(da9052->regmap, da9052->chip_irq,
 				  IRQF_TRIGGER_LOW | IRQF_ONESHOT,
 				  da9052->irq_base, &da9052_regmap_irq_chip,
-				  NULL);
+				  &da9052->irq_data);
 	if (ret < 0)
 		goto regmap_err;
 
-	desc = irq_to_desc(da9052->chip_irq);
-	da9052->irq_base = regmap_irq_chip_get_base(desc->action->dev_id);
+	da9052->irq_base = regmap_irq_chip_get_base(da9052->irq_data);
 
 	ret = mfd_add_devices(da9052->dev, -1, da9052_subdev_info,
 			      ARRAY_SIZE(da9052_subdev_info), NULL, 0);
@@ -681,8 +680,7 @@ regmap_err:
 
 void da9052_device_exit(struct da9052 *da9052)
 {
-	regmap_del_irq_chip(da9052->chip_irq,
-			    irq_get_irq_data(da9052->irq_base)->chip_data);
+	regmap_del_irq_chip(da9052->chip_irq, da9052->irq_data);
 	mfd_remove_devices(da9052->dev);
 }
 
include/linux/mfd/da9052/da9052.h +1 -0
index 7ffbd6e..8313cd9 100644
@@ -80,6 +80,7 @@ struct da9052 {
 	struct regmap *regmap;
 
 	int irq_base;
+	struct regmap_irq_chip_data *irq_data;
 	u8 chip_id;
 
 	int chip_irq;
Signature · 1 line
1.7.10
author
#1 lore raw
Quoted 4 lines · Mark Brown

Rather than using the pointer passed back by the regmap API (or complaining because that wasn't actually being set) the da9052 driver was having some fun and games peering through genirq and regmap internals. Fix the driver to use the API as expected.

Sorry, I also meant to say that since this fix seems fairly obvious and blocks some other regmap work I've gone ahead and dropped this into my regmap tree immediately at

git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap.git topic/irq

Hopefully this should be OK - please let me know if there's any issue.

Acked-by on v1 1/1
#2 lore raw
In reply to Mark Brown

Hi Mark,

Quoted 6 lines · Mark Brown

Rather than using the pointer passed back by the regmap API (or complaining because that wasn't actually being set) the da9052 driver was having some fun and games peering through genirq and regmap internals. Fix the driver to use the API as expected.

I'm fine with you merging this one through your regmap tree.

Cheers,
Samuel.

Signature · 2 lines
Intel Open Source Technology Centre
http://oss.intel.com/