mirror of
https://github.com/torvalds/linux.git
synced 2024-11-05 11:32:04 +00:00
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>
This commit is contained in:
parent
6281100ec8
commit
d715523174
@ -1155,13 +1155,11 @@ static int max77693_muic_probe(struct platform_device *pdev)
|
|||||||
|
|
||||||
virq = regmap_irq_get_virq(max77693->irq_data_muic,
|
virq = regmap_irq_get_virq(max77693->irq_data_muic,
|
||||||
muic_irq->irq);
|
muic_irq->irq);
|
||||||
if (!virq) {
|
if (!virq)
|
||||||
ret = -EINVAL;
|
return -EINVAL;
|
||||||
goto err_irq;
|
|
||||||
}
|
|
||||||
muic_irq->virq = virq;
|
muic_irq->virq = virq;
|
||||||
|
|
||||||
ret = request_threaded_irq(virq, NULL,
|
ret = devm_request_threaded_irq(&pdev->dev, virq, NULL,
|
||||||
max77693_muic_irq_handler,
|
max77693_muic_irq_handler,
|
||||||
IRQF_NO_SUSPEND,
|
IRQF_NO_SUSPEND,
|
||||||
muic_irq->name, info);
|
muic_irq->name, info);
|
||||||
@ -1170,7 +1168,7 @@ static int max77693_muic_probe(struct platform_device *pdev)
|
|||||||
"failed: irq request (IRQ: %d,"
|
"failed: irq request (IRQ: %d,"
|
||||||
" error :%d)\n",
|
" error :%d)\n",
|
||||||
muic_irq->irq, ret);
|
muic_irq->irq, ret);
|
||||||
goto err_irq;
|
return ret;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1179,15 +1177,14 @@ static int max77693_muic_probe(struct platform_device *pdev)
|
|||||||
max77693_extcon_cable);
|
max77693_extcon_cable);
|
||||||
if (IS_ERR(info->edev)) {
|
if (IS_ERR(info->edev)) {
|
||||||
dev_err(&pdev->dev, "failed to allocate memory for extcon\n");
|
dev_err(&pdev->dev, "failed to allocate memory for extcon\n");
|
||||||
ret = -ENOMEM;
|
return -ENOMEM;
|
||||||
goto err_irq;
|
|
||||||
}
|
}
|
||||||
info->edev->name = DEV_NAME;
|
info->edev->name = DEV_NAME;
|
||||||
|
|
||||||
ret = devm_extcon_dev_register(&pdev->dev, info->edev);
|
ret = devm_extcon_dev_register(&pdev->dev, info->edev);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
dev_err(&pdev->dev, "failed to register extcon device\n");
|
dev_err(&pdev->dev, "failed to register extcon device\n");
|
||||||
goto err_irq;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Initialize MUIC register by using platform data or default data */
|
/* Initialize MUIC register by using platform data or default data */
|
||||||
@ -1265,7 +1262,7 @@ static int max77693_muic_probe(struct platform_device *pdev)
|
|||||||
MAX77693_MUIC_REG_ID, &id);
|
MAX77693_MUIC_REG_ID, &id);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
dev_err(&pdev->dev, "failed to read revision number\n");
|
dev_err(&pdev->dev, "failed to read revision number\n");
|
||||||
goto err_irq;
|
return ret;
|
||||||
}
|
}
|
||||||
dev_info(info->dev, "device ID : 0x%x\n", id);
|
dev_info(info->dev, "device ID : 0x%x\n", id);
|
||||||
|
|
||||||
@ -1285,20 +1282,12 @@ static int max77693_muic_probe(struct platform_device *pdev)
|
|||||||
delay_jiffies);
|
delay_jiffies);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
err_irq:
|
|
||||||
while (--i >= 0)
|
|
||||||
free_irq(muic_irqs[i].virq, info);
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int max77693_muic_remove(struct platform_device *pdev)
|
static int max77693_muic_remove(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
struct max77693_muic_info *info = platform_get_drvdata(pdev);
|
struct max77693_muic_info *info = platform_get_drvdata(pdev);
|
||||||
int i;
|
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_SIZE(muic_irqs); i++)
|
|
||||||
free_irq(muic_irqs[i].virq, info);
|
|
||||||
cancel_work_sync(&info->irq_work);
|
cancel_work_sync(&info->irq_work);
|
||||||
input_unregister_device(info->dock);
|
input_unregister_device(info->dock);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user