diff options
| author | Sangjung Woo <sangjung.woo@samsung.com> | 2014-04-21 06:10:12 -0400 |
|---|---|---|
| committer | Chanwoo Choi <cw00.choi@samsung.com> | 2014-04-24 06:37:04 -0400 |
| commit | 10fae1184d00f09696078e572230402543ae34c8 (patch) | |
| tree | 62c9e0d81f0276608247cbf5cb46f7e61f291363 | |
| parent | 14dbd54962f9679b7573f853814b8ff15b6ec407 (diff) | |
extcon: max77693: 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-max77693.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/drivers/extcon/extcon-max77693.c b/drivers/extcon/extcon-max77693.c index 39cd095d103c..f0f18e29ae07 100644 --- a/drivers/extcon/extcon-max77693.c +++ b/drivers/extcon/extcon-max77693.c | |||
| @@ -1185,7 +1185,7 @@ static int max77693_muic_probe(struct platform_device *pdev) | |||
| 1185 | info->edev->name = DEV_NAME; | 1185 | info->edev->name = DEV_NAME; |
| 1186 | info->edev->dev.parent = &pdev->dev; | 1186 | info->edev->dev.parent = &pdev->dev; |
| 1187 | info->edev->supported_cable = max77693_extcon_cable; | 1187 | info->edev->supported_cable = max77693_extcon_cable; |
| 1188 | ret = extcon_dev_register(info->edev); | 1188 | ret = devm_extcon_dev_register(&pdev->dev, info->edev); |
| 1189 | if (ret) { | 1189 | if (ret) { |
| 1190 | dev_err(&pdev->dev, "failed to register extcon device\n"); | 1190 | dev_err(&pdev->dev, "failed to register extcon device\n"); |
| 1191 | goto err_irq; | 1191 | goto err_irq; |
| @@ -1267,7 +1267,7 @@ static int max77693_muic_probe(struct platform_device *pdev) | |||
| 1267 | MAX77693_MUIC_REG_ID, &id); | 1267 | MAX77693_MUIC_REG_ID, &id); |
| 1268 | if (ret < 0) { | 1268 | if (ret < 0) { |
| 1269 | dev_err(&pdev->dev, "failed to read revision number\n"); | 1269 | dev_err(&pdev->dev, "failed to read revision number\n"); |
| 1270 | goto err_extcon; | 1270 | goto err_irq; |
| 1271 | } | 1271 | } |
| 1272 | dev_info(info->dev, "device ID : 0x%x\n", id); | 1272 | dev_info(info->dev, "device ID : 0x%x\n", id); |
| 1273 | 1273 | ||
| @@ -1288,8 +1288,6 @@ static int max77693_muic_probe(struct platform_device *pdev) | |||
| 1288 | 1288 | ||
| 1289 | return ret; | 1289 | return ret; |
| 1290 | 1290 | ||
| 1291 | err_extcon: | ||
| 1292 | extcon_dev_unregister(info->edev); | ||
| 1293 | err_irq: | 1291 | err_irq: |
| 1294 | while (--i >= 0) | 1292 | while (--i >= 0) |
| 1295 | free_irq(muic_irqs[i].virq, info); | 1293 | free_irq(muic_irqs[i].virq, info); |
| @@ -1305,7 +1303,6 @@ static int max77693_muic_remove(struct platform_device *pdev) | |||
| 1305 | free_irq(muic_irqs[i].virq, info); | 1303 | free_irq(muic_irqs[i].virq, info); |
| 1306 | cancel_work_sync(&info->irq_work); | 1304 | cancel_work_sync(&info->irq_work); |
| 1307 | input_unregister_device(info->dock); | 1305 | input_unregister_device(info->dock); |
| 1308 | extcon_dev_unregister(info->edev); | ||
| 1309 | 1306 | ||
| 1310 | return 0; | 1307 | return 0; |
| 1311 | } | 1308 | } |
