1 --- a/drivers/power/jz4740-battery.c
2 +++ b/drivers/power/jz4740-battery.c
3 @@ -47,6 +47,8 @@ struct jz_battery {
5 struct power_supply battery;
6 struct delayed_work work;
11 static inline struct jz_battery *psy_to_jz_battery(struct power_supply *psy)
12 @@ -68,6 +70,8 @@ static long jz_battery_read_voltage(stru
16 + mutex_lock(&battery->lock);
18 INIT_COMPLETION(battery->read_completion);
20 enable_irq(battery->irq);
21 @@ -91,6 +95,8 @@ static long jz_battery_read_voltage(stru
22 battery->cell->disable(battery->pdev);
23 disable_irq(battery->irq);
25 + mutex_unlock(&battery->lock);
30 @@ -240,6 +246,11 @@ static int __devinit jz_battery_probe(st
31 struct jz_battery *jz_battery;
32 struct power_supply *battery;
35 + dev_err(&pdev->dev, "No platform_data supplied\n");
39 jz_battery = kzalloc(sizeof(*jz_battery), GFP_KERNEL);
41 dev_err(&pdev->dev, "Failed to allocate driver structure\n");
42 @@ -291,6 +302,7 @@ static int __devinit jz_battery_probe(st
43 jz_battery->pdev = pdev;
45 init_completion(&jz_battery->read_completion);
46 + mutex_init(&jz_battery->lock);
48 INIT_DELAYED_WORK(&jz_battery->work, jz_battery_work);