aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSangjung Woo <sangjung.woo@samsung.com>2014-04-21 06:10:11 -0400
committerChanwoo Choi <cw00.choi@samsung.com>2014-04-24 06:37:04 -0400
commit14dbd54962f9679b7573f853814b8ff15b6ec407 (patch)
treec457906c3bfa3dca3fa41bf0631da49940433fe0
parentd92c2f12f8a940444f28795ccbfa845fc358963e (diff)
extcon: max14577: Use devm_extcon_dev_register()
Use the resource-managed extcon device register function (i.e. devm_extcon_dev_register()) instead of extcon_dev_register(). If extcon device is attached with this function, that extcon device is automatically unregistered on driver detach. That reduces tiresome managing code. Signed-off-by: Sangjung Woo <sangjung.woo@samsung.com> Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
-rw-r--r--drivers/extcon/extcon-max14577.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/drivers/extcon/extcon-max14577.c b/drivers/extcon/extcon-max14577.c
index 2acf7461c905..d17dd4ff4d0f 100644
--- a/drivers/extcon/extcon-max14577.c
+++ b/drivers/extcon/extcon-max14577.c
@@ -747,7 +747,7 @@ static int max14577_muic_probe(struct platform_device *pdev)
747 747
748 info->edev->name = dev_name(&pdev->dev); 748 info->edev->name = dev_name(&pdev->dev);
749 info->edev->supported_cable = max14577_extcon_cable; 749 info->edev->supported_cable = max14577_extcon_cable;
750 ret = extcon_dev_register(info->edev); 750 ret = devm_extcon_dev_register(&pdev->dev, info->edev);
751 if (ret) { 751 if (ret) {
752 dev_err(&pdev->dev, "failed to register extcon device\n"); 752 dev_err(&pdev->dev, "failed to register extcon device\n");
753 return ret; 753 return ret;
@@ -766,7 +766,7 @@ static int max14577_muic_probe(struct platform_device *pdev)
766 MAX14577_REG_DEVICEID, &id); 766 MAX14577_REG_DEVICEID, &id);
767 if (ret < 0) { 767 if (ret < 0) {
768 dev_err(&pdev->dev, "failed to read revision number\n"); 768 dev_err(&pdev->dev, "failed to read revision number\n");
769 goto err_extcon; 769 return ret;
770 } 770 }
771 dev_info(info->dev, "device ID : 0x%x\n", id); 771 dev_info(info->dev, "device ID : 0x%x\n", id);
772 772
@@ -786,10 +786,6 @@ static int max14577_muic_probe(struct platform_device *pdev)
786 delay_jiffies); 786 delay_jiffies);
787 787
788 return ret; 788 return ret;
789
790err_extcon:
791 extcon_dev_unregister(info->edev);
792 return ret;
793} 789}
794 790
795static int max14577_muic_remove(struct platform_device *pdev) 791static int max14577_muic_remove(struct platform_device *pdev)
@@ -797,7 +793,6 @@ static int max14577_muic_remove(struct platform_device *pdev)
797 struct max14577_muic_info *info = platform_get_drvdata(pdev); 793 struct max14577_muic_info *info = platform_get_drvdata(pdev);
798 794
799 cancel_work_sync(&info->irq_work); 795 cancel_work_sync(&info->irq_work);
800 extcon_dev_unregister(info->edev);
801 796
802 return 0; 797 return 0;
803} 798}