diff options
author | Laxman Dewangan <ldewangan@nvidia.com> | 2016-04-21 08:25:56 -0400 |
---|---|---|
committer | Lee Jones <lee.jones@linaro.org> | 2016-05-09 08:27:38 -0400 |
commit | 3dc6f4aaafbe9e745fd1183b7a7a91aeeae99fcd (patch) | |
tree | a5d098ba2814d47d522bd2ce419fac0420357466 /drivers/mfd | |
parent | b36c82724fa10da7cc73693c6c2c3ab9a6c8034b (diff) |
mfd: sec: 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>
Tested-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Diffstat (limited to 'drivers/mfd')
-rw-r--r-- | drivers/mfd/sec-core.c | 20 | ||||
-rw-r--r-- | drivers/mfd/sec-irq.c | 14 |
2 files changed, 8 insertions, 26 deletions
diff --git a/drivers/mfd/sec-core.c b/drivers/mfd/sec-core.c index 400e1d7d8d08..ca6b80d08ffc 100644 --- a/drivers/mfd/sec-core.c +++ b/drivers/mfd/sec-core.c | |||
@@ -481,29 +481,16 @@ static int sec_pmic_probe(struct i2c_client *i2c, | |||
481 | /* If this happens the probe function is problem */ | 481 | /* If this happens the probe function is problem */ |
482 | BUG(); | 482 | BUG(); |
483 | } | 483 | } |
484 | ret = mfd_add_devices(sec_pmic->dev, -1, sec_devs, num_sec_devs, NULL, | 484 | ret = devm_mfd_add_devices(sec_pmic->dev, -1, sec_devs, num_sec_devs, |
485 | 0, NULL); | 485 | NULL, 0, NULL); |
486 | if (ret) | 486 | if (ret) |
487 | goto err_mfd; | 487 | return ret; |
488 | 488 | ||
489 | device_init_wakeup(sec_pmic->dev, sec_pmic->wakeup); | 489 | device_init_wakeup(sec_pmic->dev, sec_pmic->wakeup); |
490 | sec_pmic_configure(sec_pmic); | 490 | sec_pmic_configure(sec_pmic); |
491 | sec_pmic_dump_rev(sec_pmic); | 491 | sec_pmic_dump_rev(sec_pmic); |
492 | 492 | ||
493 | return ret; | 493 | return ret; |
494 | |||
495 | err_mfd: | ||
496 | sec_irq_exit(sec_pmic); | ||
497 | return ret; | ||
498 | } | ||
499 | |||
500 | static int sec_pmic_remove(struct i2c_client *i2c) | ||
501 | { | ||
502 | struct sec_pmic_dev *sec_pmic = i2c_get_clientdata(i2c); | ||
503 | |||
504 | mfd_remove_devices(sec_pmic->dev); | ||
505 | sec_irq_exit(sec_pmic); | ||
506 | return 0; | ||
507 | } | 494 | } |
508 | 495 | ||
509 | static void sec_pmic_shutdown(struct i2c_client *i2c) | 496 | static void sec_pmic_shutdown(struct i2c_client *i2c) |
@@ -583,7 +570,6 @@ static struct i2c_driver sec_pmic_driver = { | |||
583 | .of_match_table = of_match_ptr(sec_dt_match), | 570 | .of_match_table = of_match_ptr(sec_dt_match), |
584 | }, | 571 | }, |
585 | .probe = sec_pmic_probe, | 572 | .probe = sec_pmic_probe, |
586 | .remove = sec_pmic_remove, | ||
587 | .shutdown = sec_pmic_shutdown, | 573 | .shutdown = sec_pmic_shutdown, |
588 | .id_table = sec_pmic_id, | 574 | .id_table = sec_pmic_id, |
589 | }; | 575 | }; |
diff --git a/drivers/mfd/sec-irq.c b/drivers/mfd/sec-irq.c index d77de431cc50..5eb59c233d52 100644 --- a/drivers/mfd/sec-irq.c +++ b/drivers/mfd/sec-irq.c | |||
@@ -483,10 +483,11 @@ int sec_irq_init(struct sec_pmic_dev *sec_pmic) | |||
483 | return -EINVAL; | 483 | return -EINVAL; |
484 | } | 484 | } |
485 | 485 | ||
486 | ret = regmap_add_irq_chip(sec_pmic->regmap_pmic, sec_pmic->irq, | 486 | ret = devm_regmap_add_irq_chip(sec_pmic->dev, sec_pmic->regmap_pmic, |
487 | IRQF_TRIGGER_FALLING | IRQF_ONESHOT, | 487 | sec_pmic->irq, |
488 | sec_pmic->irq_base, sec_irq_chip, | 488 | IRQF_TRIGGER_FALLING | IRQF_ONESHOT, |
489 | &sec_pmic->irq_data); | 489 | sec_pmic->irq_base, sec_irq_chip, |
490 | &sec_pmic->irq_data); | ||
490 | if (ret != 0) { | 491 | if (ret != 0) { |
491 | dev_err(sec_pmic->dev, "Failed to register IRQ chip: %d\n", ret); | 492 | dev_err(sec_pmic->dev, "Failed to register IRQ chip: %d\n", ret); |
492 | return ret; | 493 | return ret; |
@@ -500,8 +501,3 @@ int sec_irq_init(struct sec_pmic_dev *sec_pmic) | |||
500 | 501 | ||
501 | return 0; | 502 | return 0; |
502 | } | 503 | } |
503 | |||
504 | void sec_irq_exit(struct sec_pmic_dev *sec_pmic) | ||
505 | { | ||
506 | regmap_del_irq_chip(sec_pmic->irq, sec_pmic->irq_data); | ||
507 | } | ||