summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Dannenberg <dannenberg@ti.com>2015-09-28 17:33:51 -0500
committerSebastian Reichel <sre@kernel.org>2015-09-29 16:48:07 +0200
commitdfc602524b9f4ecc6de9a3050667412176db7c55 (patch)
treebdc9773bd788b51a5d8f0c06b5e280629f530b5e
parent9b1cf1e44d91e80b17a315d04193b1764ca82a15 (diff)
downloadop-kernel-dev-dfc602524b9f4ecc6de9a3050667412176db7c55.zip
op-kernel-dev-dfc602524b9f4ecc6de9a3050667412176db7c55.tar.gz
power: bq24257: Use managed power supply register
Use the devm_* managed version of the function to register the power supply and remove the associated unregister function. This will simplify error handling moving forward as it allows the unregister to happen automatically. It also saves a few lines of code. As this changes the order of putting the bq24257 into reset vs. unregistering the power-supply during driver remove re-tested various driver unload scenario to make sure that this doesn't cause any unintended side effects such as erroneous interrupts. Signed-off-by: Andreas Dannenberg <dannenberg@ti.com> Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
-rw-r--r--drivers/power/bq24257_charger.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/power/bq24257_charger.c b/drivers/power/bq24257_charger.c
index d2d077c..6757b41 100644
--- a/drivers/power/bq24257_charger.c
+++ b/drivers/power/bq24257_charger.c
@@ -590,8 +590,10 @@ static int bq24257_power_supply_init(struct bq24257_device *bq)
psy_cfg.supplied_to = bq24257_charger_supplied_to;
psy_cfg.num_supplicants = ARRAY_SIZE(bq24257_charger_supplied_to);
- bq->charger = power_supply_register(bq->dev, &bq24257_power_supply_desc,
- &psy_cfg);
+ bq->charger = devm_power_supply_register(bq->dev,
+ &bq24257_power_supply_desc,
+ &psy_cfg);
+
if (IS_ERR(bq->charger))
return PTR_ERR(bq->charger);
@@ -742,8 +744,6 @@ static int bq24257_remove(struct i2c_client *client)
cancel_delayed_work_sync(&bq->iilimit_setup_work);
- power_supply_unregister(bq->charger);
-
bq24257_field_write(bq, F_RESET, 1); /* reset to defaults */
return 0;
OpenPOWER on IntegriCloud