twl4030_charger: use devm_request_threaded_irq
This simplifies the error paths. Signed-off-by: NeilBrown <neilb@suse.de> Acked-by: Pavel Machek <pavel@ucw.cz> Signed-off-by: Sebastian Reichel <sre@kernel.org>
This commit is contained in:
parent
1ae25d626c
commit
1b7cac2341
|
@ -619,21 +619,21 @@ static int __init twl4030_bci_probe(struct platform_device *pdev)
|
||||||
goto fail_register_usb;
|
goto fail_register_usb;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = request_threaded_irq(bci->irq_chg, NULL,
|
ret = devm_request_threaded_irq(&pdev->dev, bci->irq_chg, NULL,
|
||||||
twl4030_charger_interrupt, IRQF_ONESHOT, pdev->name,
|
twl4030_charger_interrupt, IRQF_ONESHOT, pdev->name,
|
||||||
bci);
|
bci);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
dev_err(&pdev->dev, "could not request irq %d, status %d\n",
|
dev_err(&pdev->dev, "could not request irq %d, status %d\n",
|
||||||
bci->irq_chg, ret);
|
bci->irq_chg, ret);
|
||||||
goto fail_chg_irq;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = request_threaded_irq(bci->irq_bci, NULL,
|
ret = devm_request_threaded_irq(&pdev->dev, bci->irq_bci, NULL,
|
||||||
twl4030_bci_interrupt, IRQF_ONESHOT, pdev->name, bci);
|
twl4030_bci_interrupt, IRQF_ONESHOT, pdev->name, bci);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
dev_err(&pdev->dev, "could not request irq %d, status %d\n",
|
dev_err(&pdev->dev, "could not request irq %d, status %d\n",
|
||||||
bci->irq_bci, ret);
|
bci->irq_bci, ret);
|
||||||
goto fail_bci_irq;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
INIT_WORK(&bci->work, twl4030_bci_usb_work);
|
INIT_WORK(&bci->work, twl4030_bci_usb_work);
|
||||||
|
@ -656,7 +656,7 @@ static int __init twl4030_bci_probe(struct platform_device *pdev)
|
||||||
TWL4030_INTERRUPTS_BCIIMR1A);
|
TWL4030_INTERRUPTS_BCIIMR1A);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
dev_err(&pdev->dev, "failed to unmask interrupts: %d\n", ret);
|
dev_err(&pdev->dev, "failed to unmask interrupts: %d\n", ret);
|
||||||
goto fail_unmask_interrupts;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
reg = ~(u32)(TWL4030_VBATOV | TWL4030_VBUSOV | TWL4030_ACCHGOV);
|
reg = ~(u32)(TWL4030_VBATOV | TWL4030_VBUSOV | TWL4030_ACCHGOV);
|
||||||
|
@ -675,11 +675,7 @@ static int __init twl4030_bci_probe(struct platform_device *pdev)
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
fail_unmask_interrupts:
|
fail:
|
||||||
free_irq(bci->irq_bci, bci);
|
|
||||||
fail_bci_irq:
|
|
||||||
free_irq(bci->irq_chg, bci);
|
|
||||||
fail_chg_irq:
|
|
||||||
power_supply_unregister(bci->usb);
|
power_supply_unregister(bci->usb);
|
||||||
fail_register_usb:
|
fail_register_usb:
|
||||||
power_supply_unregister(bci->ac);
|
power_supply_unregister(bci->ac);
|
||||||
|
@ -704,8 +700,6 @@ static int __exit twl4030_bci_remove(struct platform_device *pdev)
|
||||||
twl_i2c_write_u8(TWL4030_MODULE_INTERRUPTS, 0xff,
|
twl_i2c_write_u8(TWL4030_MODULE_INTERRUPTS, 0xff,
|
||||||
TWL4030_INTERRUPTS_BCIIMR2A);
|
TWL4030_INTERRUPTS_BCIIMR2A);
|
||||||
|
|
||||||
free_irq(bci->irq_bci, bci);
|
|
||||||
free_irq(bci->irq_chg, bci);
|
|
||||||
power_supply_unregister(bci->usb);
|
power_supply_unregister(bci->usb);
|
||||||
power_supply_unregister(bci->ac);
|
power_supply_unregister(bci->ac);
|
||||||
kfree(bci);
|
kfree(bci);
|
||||||
|
|
Loading…
Reference in a new issue