aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mfd
diff options
context:
space:
mode:
authorLaxman Dewangan <ldewangan@nvidia.com>2016-04-21 08:25:57 -0400
committerLee Jones <lee.jones@linaro.org>2016-05-09 08:27:39 -0400
commit6167c5bcef722819ff536dc63ec89825001161ed (patch)
tree8f473d160bce8a159f514dac6f32f04848a43154 /drivers/mfd
parent3dc6f4aaafbe9e745fd1183b7a7a91aeeae99fcd (diff)
mfd: tps65910: Use devm_mfd_add_devices and devm_regmap_add_irq_chip
Use devm_mfd_add_devices() for adding MFD child devices and devm_regmap_add_irq_chip() for IRQ chip registration. This reduces the error code path and .remove callback for removing MFD child devices and deleting IRQ chip data. Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>
Diffstat (limited to 'drivers/mfd')
-rw-r--r--drivers/mfd/tps65910.c25
1 files changed, 4 insertions, 21 deletions
diff --git a/drivers/mfd/tps65910.c b/drivers/mfd/tps65910.c
index 8086e5dae311..11cab1582f2f 100644
--- a/drivers/mfd/tps65910.c
+++ b/drivers/mfd/tps65910.c
@@ -252,9 +252,10 @@ static int tps65910_irq_init(struct tps65910 *tps65910, int irq,
252 } 252 }
253 253
254 tps65910->chip_irq = irq; 254 tps65910->chip_irq = irq;
255 ret = regmap_add_irq_chip(tps65910->regmap, tps65910->chip_irq, 255 ret = devm_regmap_add_irq_chip(tps65910->dev, tps65910->regmap,
256 IRQF_ONESHOT, pdata->irq_base, 256 tps65910->chip_irq,
257 tps6591x_irqs_chip, &tps65910->irq_data); 257 IRQF_ONESHOT, pdata->irq_base,
258 tps6591x_irqs_chip, &tps65910->irq_data);
258 if (ret < 0) { 259 if (ret < 0) {
259 dev_warn(tps65910->dev, "Failed to add irq_chip %d\n", ret); 260 dev_warn(tps65910->dev, "Failed to add irq_chip %d\n", ret);
260 tps65910->chip_irq = 0; 261 tps65910->chip_irq = 0;
@@ -262,13 +263,6 @@ static int tps65910_irq_init(struct tps65910 *tps65910, int irq,
262 return ret; 263 return ret;
263} 264}
264 265
265static int tps65910_irq_exit(struct tps65910 *tps65910)
266{
267 if (tps65910->chip_irq > 0)
268 regmap_del_irq_chip(tps65910->chip_irq, tps65910->irq_data);
269 return 0;
270}
271
272static bool is_volatile_reg(struct device *dev, unsigned int reg) 266static bool is_volatile_reg(struct device *dev, unsigned int reg)
273{ 267{
274 struct tps65910 *tps65910 = dev_get_drvdata(dev); 268 struct tps65910 *tps65910 = dev_get_drvdata(dev);
@@ -516,22 +510,12 @@ static int tps65910_i2c_probe(struct i2c_client *i2c,
516 regmap_irq_get_domain(tps65910->irq_data)); 510 regmap_irq_get_domain(tps65910->irq_data));
517 if (ret < 0) { 511 if (ret < 0) {
518 dev_err(&i2c->dev, "mfd_add_devices failed: %d\n", ret); 512 dev_err(&i2c->dev, "mfd_add_devices failed: %d\n", ret);
519 tps65910_irq_exit(tps65910);
520 return ret; 513 return ret;
521 } 514 }
522 515
523 return ret; 516 return ret;
524} 517}
525 518
526static int tps65910_i2c_remove(struct i2c_client *i2c)
527{
528 struct tps65910 *tps65910 = i2c_get_clientdata(i2c);
529
530 tps65910_irq_exit(tps65910);
531
532 return 0;
533}
534
535static const struct i2c_device_id tps65910_i2c_id[] = { 519static const struct i2c_device_id tps65910_i2c_id[] = {
536 { "tps65910", TPS65910 }, 520 { "tps65910", TPS65910 },
537 { "tps65911", TPS65911 }, 521 { "tps65911", TPS65911 },
@@ -546,7 +530,6 @@ static struct i2c_driver tps65910_i2c_driver = {
546 .of_match_table = of_match_ptr(tps65910_of_match), 530 .of_match_table = of_match_ptr(tps65910_of_match),
547 }, 531 },
548 .probe = tps65910_i2c_probe, 532 .probe = tps65910_i2c_probe,
549 .remove = tps65910_i2c_remove,
550 .id_table = tps65910_i2c_id, 533 .id_table = tps65910_i2c_id,
551}; 534};
552 535