Skip to contentSkip to conversation

power_supply: wm97xx_battery: Use DEFINE_MUTEX() for work_lock

PATCH Applied Axel Lin 2 participants 2 messages Nov 28, 2011 – Jan 6, 2012

lore
Share & tools
lore

Axel Lin

author
#0 lore raw

PATCH 1/1 power_supply: wm97xx_battery: Use DEFINE_MUTEX() for work_lock

work_lock can be initialized automatically with DEFINE_MUTEX() rather than explicitly calling mutex_init().

This patch also removes an unused bat_lock mutex.

---
 drivers/power/wm97xx_battery.c |    5 +----
 1 files changed, 1 insertions(+), 4 deletions(-)
drivers/power/wm97xx_battery.c +1 -4
index cf8681c..eaa454b 100644
@@ -25,9 +25,8 @@
 #include <linux/irq.h>
 #include <linux/slab.h>
 
-static DEFINE_MUTEX(bat_lock);
 static struct work_struct bat_work;
-static struct mutex work_lock;
+static DEFINE_MUTEX(work_lock);
 static int bat_status = POWER_SUPPLY_STATUS_UNKNOWN;
 static enum power_supply_property *prop;
 
@@ -181,8 +180,6 @@ static int __devinit wm97xx_bat_probe(struct platform_device *dev)
 	if (dev->id != -1)
 		return -EINVAL;
 
-	mutex_init(&work_lock);
-
 	if (!pdata) {
 		dev_err(&dev->dev, "No platform_data supplied\n");
 		return -EINVAL;
Signature · 1 line
1.7.5.4
#1 lore raw
Quoted 6 lines · Axel Lin

work_lock can be initialized automatically with DEFINE_MUTEX() rather than explicitly calling mutex_init().

This patch also removes an unused bat_lock mutex.

Applied, thanks!

Quoted 30 lines
---
 drivers/power/wm97xx_battery.c |    5 +----
 1 files changed, 1 insertions(+), 4 deletions(-)
drivers/power/wm97xx_battery.c +1 -4
index cf8681c..eaa454b 100644
@@ -25,9 +25,8 @@
 #include <linux/irq.h>
 #include <linux/slab.h>
 
-static DEFINE_MUTEX(bat_lock);
 static struct work_struct bat_work;
-static struct mutex work_lock;
+static DEFINE_MUTEX(work_lock);
 static int bat_status = POWER_SUPPLY_STATUS_UNKNOWN;
 static enum power_supply_property *prop;
 
@@ -181,8 +180,6 @@ static int __devinit wm97xx_bat_probe(struct platform_device *dev)
 	if (dev->id != -1)
 		return -EINVAL;
 
-	mutex_init(&work_lock);
-
 	if (!pdata) {
 		dev_err(&dev->dev, "No platform_data supplied\n");
 		return -EINVAL;
Signature · 1 line
1.7.5.4
Signature · 2 lines
Anton Vorontsov
Email: [email protected]