diff options
author | Lars-Peter Clausen <lars@metafoo.de> | 2011-01-06 01:32:17 +0000 |
---|---|---|
committer | Lars-Peter Clausen <lars@metafoo.de> | 2011-01-06 01:32:17 +0000 |
commit | 4f7abc1c7a9e564f2730041899f88567f63aada3 (patch) | |
tree | 6323c3dc79da446fa622542a1c120d2f9441d46f /target/linux/xburst/patches-2.6.37/300-battery-fixes.patch | |
parent | 9abe5cf11047a9590417f6baf2226e86a3a12f54 (diff) | |
download | mtk-20170518-4f7abc1c7a9e564f2730041899f88567f63aada3.zip mtk-20170518-4f7abc1c7a9e564f2730041899f88567f63aada3.tar.gz mtk-20170518-4f7abc1c7a9e564f2730041899f88567f63aada3.tar.bz2 |
Add 2.6.37 support
SVN-Revision: 24914
Diffstat (limited to 'target/linux/xburst/patches-2.6.37/300-battery-fixes.patch')
-rw-r--r-- | target/linux/xburst/patches-2.6.37/300-battery-fixes.patch | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/target/linux/xburst/patches-2.6.37/300-battery-fixes.patch b/target/linux/xburst/patches-2.6.37/300-battery-fixes.patch new file mode 100644 index 0000000..947c671 --- /dev/null +++ b/target/linux/xburst/patches-2.6.37/300-battery-fixes.patch @@ -0,0 +1,49 @@ +--- a/drivers/power/jz4740-battery.c ++++ b/drivers/power/jz4740-battery.c +@@ -47,6 +47,8 @@ struct jz_battery { + + struct power_supply battery; + struct delayed_work work; ++ ++ struct mutex lock; + }; + + static inline struct jz_battery *psy_to_jz_battery(struct power_supply *psy) +@@ -68,6 +70,8 @@ static long jz_battery_read_voltage(stru + unsigned long val; + long voltage; + ++ mutex_lock(&battery->lock); ++ + INIT_COMPLETION(battery->read_completion); + + enable_irq(battery->irq); +@@ -91,6 +95,8 @@ static long jz_battery_read_voltage(stru + battery->cell->disable(battery->pdev); + disable_irq(battery->irq); + ++ mutex_unlock(&battery->lock); ++ + return voltage; + } + +@@ -240,6 +246,11 @@ static int __devinit jz_battery_probe(st + struct jz_battery *jz_battery; + struct power_supply *battery; + ++ if (!pdata) { ++ dev_err(&pdev->dev, "No platform_data supplied\n"); ++ return -ENXIO; ++ } ++ + jz_battery = kzalloc(sizeof(*jz_battery), GFP_KERNEL); + if (!jz_battery) { + dev_err(&pdev->dev, "Failed to allocate driver structure\n"); +@@ -291,6 +302,7 @@ static int __devinit jz_battery_probe(st + jz_battery->pdev = pdev; + + init_completion(&jz_battery->read_completion); ++ mutex_init(&jz_battery->lock); + + INIT_DELAYED_WORK(&jz_battery->work, jz_battery_work); + |