summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUmang Chheda <uchheda@codeaurora.org>2019-10-01 16:03:39 +0530
committerUmang Chheda <uchheda@codeaurora.org>2019-10-15 11:54:11 +0530
commit666e83125bd5bcd60f63ee0038587ba7a3d87887 (patch)
treec3d07e244cb2e6f26ebd2a36340bade604385c59
parenta8e92fae3a9de72877cfbd2f8b84a0d539413eb1 (diff)
power: battery: Initialize work struct before cancelling work
Votable callback accesses work structure as part of their callback, initialize work before creation of votables. Change-Id: I91741b3d54c73aab5c695a31292a32752edc77cd Signed-off-by: Umang Chheda <uchheda@codeaurora.org>
-rw-r--r--drivers/power/supply/qcom/battery.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/drivers/power/supply/qcom/battery.c b/drivers/power/supply/qcom/battery.c
index 6d5308b3dd0b..c19abd4075a3 100644
--- a/drivers/power/supply/qcom/battery.c
+++ b/drivers/power/supply/qcom/battery.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2017 The Linux Foundation. All rights reserved.
+/* Copyright (c) 2017,2019 The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@@ -1345,6 +1345,12 @@ int qcom_batt_init(void)
if (!chip->pl_ws)
goto cleanup;
+ INIT_DELAYED_WORK(&chip->status_change_work, status_change_work);
+ INIT_DELAYED_WORK(&chip->pl_taper_work, pl_taper_work);
+ INIT_WORK(&chip->pl_disable_forever_work, pl_disable_forever_work);
+ INIT_DELAYED_WORK(&chip->pl_awake_work, pl_awake_work);
+ INIT_DELAYED_WORK(&chip->fcc_step_update_work, fcc_step_update_work);
+
chip->fcc_votable = create_votable("FCC", VOTE_MIN,
pl_fcc_vote_callback,
chip);
@@ -1399,12 +1405,6 @@ int qcom_batt_init(void)
vote(chip->pl_disable_votable, PL_INDIRECT_VOTER, true, 0);
- INIT_DELAYED_WORK(&chip->status_change_work, status_change_work);
- INIT_DELAYED_WORK(&chip->pl_taper_work, pl_taper_work);
- INIT_WORK(&chip->pl_disable_forever_work, pl_disable_forever_work);
- INIT_DELAYED_WORK(&chip->pl_awake_work, pl_awake_work);
- INIT_DELAYED_WORK(&chip->fcc_step_update_work, fcc_step_update_work);
-
rc = pl_register_notifier(chip);
if (rc < 0) {
pr_err("Couldn't register psy notifier rc = %d\n", rc);