[patch 10/10] hwmon: s3c-hwmon: Convert semaphore to mutex

Thomas Gleixner
2010-01-29T20:40:24Z

[-- Attachment #1: hwmon-23c-hwmon-sema.patch --]
[-- Type: text/plain, Size: 1315 bytes --]

hwmon->lock is used as a mutex. Make it a real mutex.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Ben Dooks <ben-linux@fluff.org>
Cc: Jean Delvare <khali@linux-fr.org>
Cc: lm-sensors@lm-sensors.org
---
drivers/hwmon/s3c-hwmon.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

Index: linux-2.6-tip/drivers/hwmon/s3c-hwmon.c
===================================================================
--- linux-2.6-tip.orig/drivers/hwmon/s3c-hwmon.c
+++ linux-2.6-tip/drivers/hwmon/s3c-hwmon.c
@@ -51,7 +51,7 @@ struct s3c_hwmon_attr {
* @attr: The holders for the channel attributes.
*/
struct s3c_hwmon {
- struct semaphore lock;
+ struct mutex lock;
struct s3c_adc_client *client;
struct device *hwmon_dev;

@@ -73,14 +73,14 @@ static int s3c_hwmon_read_ch(struct devi
{
int ret;

- ret = down_interruptible(&hwmon->lock);
+ ret = mutex_lock_interruptible(&hwmon->lock);
if (ret < 0)
return ret;

dev_dbg(dev, "reading channel %d\n", channel);

ret = s3c_adc_read(hwmon->client, channel);
- up(&hwmon->lock);
+ mutex_unlock(&hwmon->lock);

return ret;
}
@@ -296,7 +296,7 @@ static int __devinit s3c_hwmon_probe(str

platform_set_drvdata(dev, hwmon);

- init_MUTEX(&hwmon->lock);
+ mutex_init(&hwmon->lock);

/* Register with the core ADC driver. */