From: benjamin Deering <ben_deer...@swissmail.org>

Protect calls in bq27x00_external_power_changed with the mutex that
is used to protect the same calls in other places in the driver.
---
 drivers/power/bq27x00_battery.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/power/bq27x00_battery.c b/drivers/power/bq27x00_battery.c
index 59e68db..325b006 100644
--- a/drivers/power/bq27x00_battery.c
+++ b/drivers/power/bq27x00_battery.c
@@ -512,9 +512,10 @@ static int bq27x00_battery_get_property(struct 
power_supply *psy,
 static void bq27x00_external_power_changed(struct power_supply *psy)
 {
        struct bq27x00_device_info *di = to_bq27x00_device_info(psy);
-
+       mutex_lock(&di->lock);
        cancel_delayed_work_sync(&di->work);
        schedule_delayed_work(&di->work, 0);
+       mutex_lock(&di->unlock);
 }
 
 static int bq27x00_powersupply_init(struct bq27x00_device_info *di)
-- 
1.7.7

_______________________________________________
Shr-devel mailing list
Shr-devel@lists.shr-project.org
http://lists.shr-project.org/mailman/listinfo/shr-devel

Reply via email to