diff options
author | Krzysztof Kozlowski <k.kozlowski@samsung.com> | 2014-09-12 09:16:37 -0400 |
---|---|---|
committer | Chanwoo Choi <cw00.choi@samsung.com> | 2014-09-22 02:53:23 -0400 |
commit | d715523174479455b07a8baffbe63ff13e0695bf (patch) | |
tree | 10a71f650a420cc52dfb648049fdef5146fe75cc /drivers/extcon | |
parent | 6281100ec84016facda2bbbed5be649ff0f82073 (diff) |
extcon: max77693: Use resource managed interrupt line
Use resource managed interrupt line devm_request_threaded_irq() to
simplify a little cleanup paths:
- no goto to cleanup label,
- simpler remove function.
Overall the driver size is decreased by 11 line of code.
Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Diffstat (limited to 'drivers/extcon')
-rw-r--r-- | drivers/extcon/extcon-max77693.c | 25 |
1 files changed, 7 insertions, 18 deletions
diff --git a/drivers/extcon/extcon-max77693.c b/drivers/extcon/extcon-max77693.c index 77460f2c1ca1..0574154a94a9 100644 --- a/drivers/extcon/extcon-max77693.c +++ b/drivers/extcon/extcon-max77693.c | |||
@@ -1155,13 +1155,11 @@ static int max77693_muic_probe(struct platform_device *pdev) | |||
1155 | 1155 | ||
1156 | virq = regmap_irq_get_virq(max77693->irq_data_muic, | 1156 | virq = regmap_irq_get_virq(max77693->irq_data_muic, |
1157 | muic_irq->irq); | 1157 | muic_irq->irq); |
1158 | if (!virq) { | 1158 | if (!virq) |
1159 | ret = -EINVAL; | 1159 | return -EINVAL; |
1160 | goto err_irq; | ||
1161 | } | ||
1162 | muic_irq->virq = virq; | 1160 | muic_irq->virq = virq; |
1163 | 1161 | ||
1164 | ret = request_threaded_irq(virq, NULL, | 1162 | ret = devm_request_threaded_irq(&pdev->dev, virq, NULL, |
1165 | max77693_muic_irq_handler, | 1163 | max77693_muic_irq_handler, |
1166 | IRQF_NO_SUSPEND, | 1164 | IRQF_NO_SUSPEND, |
1167 | muic_irq->name, info); | 1165 | muic_irq->name, info); |
@@ -1170,7 +1168,7 @@ static int max77693_muic_probe(struct platform_device *pdev) | |||
1170 | "failed: irq request (IRQ: %d," | 1168 | "failed: irq request (IRQ: %d," |
1171 | " error :%d)\n", | 1169 | " error :%d)\n", |
1172 | muic_irq->irq, ret); | 1170 | muic_irq->irq, ret); |
1173 | goto err_irq; | 1171 | return ret; |
1174 | } | 1172 | } |
1175 | } | 1173 | } |
1176 | 1174 | ||
@@ -1179,15 +1177,14 @@ static int max77693_muic_probe(struct platform_device *pdev) | |||
1179 | max77693_extcon_cable); | 1177 | max77693_extcon_cable); |
1180 | if (IS_ERR(info->edev)) { | 1178 | if (IS_ERR(info->edev)) { |
1181 | dev_err(&pdev->dev, "failed to allocate memory for extcon\n"); | 1179 | dev_err(&pdev->dev, "failed to allocate memory for extcon\n"); |
1182 | ret = -ENOMEM; | 1180 | return -ENOMEM; |
1183 | goto err_irq; | ||
1184 | } | 1181 | } |
1185 | info->edev->name = DEV_NAME; | 1182 | info->edev->name = DEV_NAME; |
1186 | 1183 | ||
1187 | ret = devm_extcon_dev_register(&pdev->dev, info->edev); | 1184 | ret = devm_extcon_dev_register(&pdev->dev, info->edev); |
1188 | if (ret) { | 1185 | if (ret) { |
1189 | dev_err(&pdev->dev, "failed to register extcon device\n"); | 1186 | dev_err(&pdev->dev, "failed to register extcon device\n"); |
1190 | goto err_irq; | 1187 | return ret; |
1191 | } | 1188 | } |
1192 | 1189 | ||
1193 | /* Initialize MUIC register by using platform data or default data */ | 1190 | /* Initialize MUIC register by using platform data or default data */ |
@@ -1265,7 +1262,7 @@ static int max77693_muic_probe(struct platform_device *pdev) | |||
1265 | MAX77693_MUIC_REG_ID, &id); | 1262 | MAX77693_MUIC_REG_ID, &id); |
1266 | if (ret < 0) { | 1263 | if (ret < 0) { |
1267 | dev_err(&pdev->dev, "failed to read revision number\n"); | 1264 | dev_err(&pdev->dev, "failed to read revision number\n"); |
1268 | goto err_irq; | 1265 | return ret; |
1269 | } | 1266 | } |
1270 | dev_info(info->dev, "device ID : 0x%x\n", id); | 1267 | dev_info(info->dev, "device ID : 0x%x\n", id); |
1271 | 1268 | ||
@@ -1285,20 +1282,12 @@ static int max77693_muic_probe(struct platform_device *pdev) | |||
1285 | delay_jiffies); | 1282 | delay_jiffies); |
1286 | 1283 | ||
1287 | return ret; | 1284 | return ret; |
1288 | |||
1289 | err_irq: | ||
1290 | while (--i >= 0) | ||
1291 | free_irq(muic_irqs[i].virq, info); | ||
1292 | return ret; | ||
1293 | } | 1285 | } |
1294 | 1286 | ||
1295 | static int max77693_muic_remove(struct platform_device *pdev) | 1287 | static int max77693_muic_remove(struct platform_device *pdev) |
1296 | { | 1288 | { |
1297 | struct max77693_muic_info *info = platform_get_drvdata(pdev); | 1289 | struct max77693_muic_info *info = platform_get_drvdata(pdev); |
1298 | int i; | ||
1299 | 1290 | ||
1300 | for (i = 0; i < ARRAY_SIZE(muic_irqs); i++) | ||
1301 | free_irq(muic_irqs[i].virq, info); | ||
1302 | cancel_work_sync(&info->irq_work); | 1291 | cancel_work_sync(&info->irq_work); |
1303 | input_unregister_device(info->dock); | 1292 | input_unregister_device(info->dock); |
1304 | 1293 | ||