static irqreturn_t bq24190_irq_handler_thread(int irq, void *data)
{
struct bq24190_dev_info *bdi = data;
- int ret;
+ int error;
bdi->irq_event = true;
- ret = pm_runtime_get_sync(bdi->dev);
- if (ret < 0) {
- dev_warn(bdi->dev, "pm_runtime_get failed: %i\n", ret);
+ error = pm_runtime_get_sync(bdi->dev);
+ if (error < 0) {
+ dev_warn(bdi->dev, "pm_runtime_get failed: %i\n", error);
+ pm_runtime_put_noidle(bdi->dev);
return IRQ_NONE;
}
bq24190_check_status(bdi);
pm_runtime_use_autosuspend(dev);
pm_runtime_set_autosuspend_delay(dev, 600);
ret = pm_runtime_get_sync(dev);
- if (ret < 0)
- goto out1;
+ if (ret < 0) {
+ dev_err(dev, "pm_runtime_get failed: %i\n", ret);
+ goto out_pmrt;
+ }
ret = bq24190_hw_init(bdi);
if (ret < 0) {
dev_err(dev, "Hardware init failed\n");
- goto out2;
+ goto out_pmrt;
}
charger_cfg.drv_data = bdi;
if (IS_ERR(bdi->charger)) {
dev_err(dev, "Can't register charger\n");
ret = PTR_ERR(bdi->charger);
- goto out2;
+ goto out_pmrt;
}
battery_cfg.drv_data = bdi;
if (IS_ERR(bdi->battery)) {
dev_err(dev, "Can't register battery\n");
ret = PTR_ERR(bdi->battery);
- goto out3;
+ goto out_charger;
}
ret = bq24190_sysfs_create_group(bdi);
if (ret) {
dev_err(dev, "Can't create sysfs entries\n");
- goto out4;
+ goto out_battery;
}
bdi->initialized = true;
"bq24190-charger", bdi);
if (ret < 0) {
dev_err(dev, "Can't set up irq handler\n");
- goto out5;
+ goto out_sysfs;
}
if (bdi->extcon) {
&bdi->extcon_nb);
if (ret) {
dev_err(dev, "Can't register extcon\n");
- goto out5;
+ goto out_sysfs;
}
/* Sync initial cable state */
return 0;
-out5:
+out_sysfs:
bq24190_sysfs_remove_group(bdi);
-out4:
+out_battery:
power_supply_unregister(bdi->battery);
-out3:
+out_charger:
power_supply_unregister(bdi->charger);
-out2:
+out_pmrt:
pm_runtime_put_sync(dev);
-
-out1:
pm_runtime_dont_use_autosuspend(dev);
pm_runtime_disable(dev);
return ret;