mfd: cros_ec: Free IRQ automatically
Free the IRQ we might have requested when removing the cros_ec device, so we can unload and reload the driver properly. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com> Acked-by: Vincent Palatin <vpalatin@chromium.org> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>
This commit is contained in:
parent
0dbbf25561
commit
eb3f2f2396
|
@ -119,9 +119,9 @@ int cros_ec_register(struct cros_ec_device *ec_dev)
|
|||
}
|
||||
|
||||
if (ec_dev->irq) {
|
||||
err = request_threaded_irq(ec_dev->irq, NULL, ec_irq_thread,
|
||||
IRQF_TRIGGER_LOW | IRQF_ONESHOT,
|
||||
"chromeos-ec", ec_dev);
|
||||
err = devm_request_threaded_irq(dev, ec_dev->irq, NULL,
|
||||
ec_irq_thread, IRQF_TRIGGER_LOW | IRQF_ONESHOT,
|
||||
"chromeos-ec", ec_dev);
|
||||
if (err) {
|
||||
dev_err(dev, "Failed to request IRQ %d: %d",
|
||||
ec_dev->irq, err);
|
||||
|
@ -135,7 +135,7 @@ int cros_ec_register(struct cros_ec_device *ec_dev)
|
|||
dev_err(dev,
|
||||
"Failed to register Embedded Controller subdevice %d\n",
|
||||
err);
|
||||
goto fail_mfd;
|
||||
return err;
|
||||
}
|
||||
|
||||
if (ec_dev->max_passthru) {
|
||||
|
@ -153,7 +153,7 @@ int cros_ec_register(struct cros_ec_device *ec_dev)
|
|||
dev_err(dev,
|
||||
"Failed to register Power Delivery subdevice %d\n",
|
||||
err);
|
||||
goto fail_mfd;
|
||||
return err;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -162,7 +162,7 @@ int cros_ec_register(struct cros_ec_device *ec_dev)
|
|||
if (err) {
|
||||
mfd_remove_devices(dev);
|
||||
dev_err(dev, "Failed to register sub-devices\n");
|
||||
goto fail_mfd;
|
||||
return err;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -178,11 +178,6 @@ int cros_ec_register(struct cros_ec_device *ec_dev)
|
|||
dev_info(dev, "Chrome EC device registered\n");
|
||||
|
||||
return 0;
|
||||
|
||||
fail_mfd:
|
||||
if (ec_dev->irq)
|
||||
free_irq(ec_dev->irq, ec_dev);
|
||||
return err;
|
||||
}
|
||||
EXPORT_SYMBOL(cros_ec_register);
|
||||
|
||||
|
@ -190,9 +185,6 @@ int cros_ec_remove(struct cros_ec_device *ec_dev)
|
|||
{
|
||||
mfd_remove_devices(ec_dev->dev);
|
||||
|
||||
if (ec_dev->irq)
|
||||
free_irq(ec_dev->irq, ec_dev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(cros_ec_remove);
|
||||
|
|
Loading…
Reference in New Issue