Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

power: bq24190_charger: install irq_handler_thread() at end of probe() #2

Merged
merged 6 commits into from
Oct 6, 2016
31 changes: 16 additions & 15 deletions drivers/power/bq24190_charger.c
Original file line number Diff line number Diff line change
Expand Up @@ -1366,22 +1366,13 @@ static int bq24190_probe(struct i2c_client *client,
return -EINVAL;
}

ret = devm_request_threaded_irq(dev, bdi->irq, NULL,
bq24190_irq_handler_thread,
IRQF_TRIGGER_RISING | IRQF_ONESHOT,
"bq24190-charger", bdi);
if (ret < 0) {
dev_err(dev, "Can't set up irq handler\n");
goto out1;
}

pm_runtime_enable(dev);
pm_runtime_resume(dev);

ret = bq24190_hw_init(bdi);
if (ret < 0) {
dev_err(dev, "Hardware init failed\n");
goto out2;
goto out1;
}

charger_cfg.drv_data = bdi;
Expand All @@ -1392,7 +1383,7 @@ static int bq24190_probe(struct i2c_client *client,
if (IS_ERR(bdi->charger)) {
dev_err(dev, "Can't register charger\n");
ret = PTR_ERR(bdi->charger);
goto out2;
goto out1;
}

battery_cfg.drv_data = bdi;
Expand All @@ -1401,24 +1392,34 @@ static int bq24190_probe(struct i2c_client *client,
if (IS_ERR(bdi->battery)) {
dev_err(dev, "Can't register battery\n");
ret = PTR_ERR(bdi->battery);
goto out3;
goto out2;
}

ret = bq24190_sysfs_create_group(bdi);
if (ret) {
dev_err(dev, "Can't create sysfs entries\n");
goto out3;
}

ret = devm_request_threaded_irq(dev, bdi->irq, NULL,
bq24190_irq_handler_thread,
IRQF_TRIGGER_RISING | IRQF_ONESHOT,
"bq24190-charger", bdi);
if (ret < 0) {
dev_err(dev, "Can't set up irq handler\n");
goto out4;
}

return 0;

out4:
power_supply_unregister(bdi->battery);
bq24190_sysfs_remove_group(bdi);
out3:
power_supply_unregister(bdi->charger);
power_supply_unregister(bdi->battery);
out2:
pm_runtime_disable(dev);
power_supply_unregister(bdi->charger);
out1:
pm_runtime_disable(dev);
if (bdi->gpio_int)
gpio_free(bdi->gpio_int);

Expand Down