aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon
diff options
context:
space:
mode:
authorMatthias Kaehlcke <matthias.kaehlcke@gmail.com>2007-10-24 08:59:09 -0400
committerMark M. Hoffman <mhoffman@lightlink.com>2007-11-08 08:42:46 -0500
commit4bfe66048e97d29ab229519e9a821dbd4d929bd9 (patch)
tree895466bc1b959880d6e642a1abae3db290e73de7 /drivers/hwmon
parent8de577095d65e8a51135793bf48c7be6c6c5bc77 (diff)
hwmon: (lm70) Convert semaphore to mutex
Signed-off-by: Matthias Kaehlcke <matthias.kaehlcke@gmail.com> Acked-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Mark M. Hoffman <mhoffman@lightlink.com>
Diffstat (limited to 'drivers/hwmon')
-rw-r--r--drivers/hwmon/lm70.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/drivers/hwmon/lm70.c b/drivers/hwmon/lm70.c
index dd366889ce9b..d435f003292d 100644
--- a/drivers/hwmon/lm70.c
+++ b/drivers/hwmon/lm70.c
@@ -31,14 +31,15 @@
31#include <linux/err.h> 31#include <linux/err.h>
32#include <linux/sysfs.h> 32#include <linux/sysfs.h>
33#include <linux/hwmon.h> 33#include <linux/hwmon.h>
34#include <linux/mutex.h>
34#include <linux/spi/spi.h> 35#include <linux/spi/spi.h>
35#include <asm/semaphore.h> 36
36 37
37#define DRVNAME "lm70" 38#define DRVNAME "lm70"
38 39
39struct lm70 { 40struct lm70 {
40 struct device *hwmon_dev; 41 struct device *hwmon_dev;
41 struct semaphore sem; 42 struct mutex lock;
42}; 43};
43 44
44/* sysfs hook function */ 45/* sysfs hook function */
@@ -51,7 +52,7 @@ static ssize_t lm70_sense_temp(struct device *dev,
51 s16 raw=0; 52 s16 raw=0;
52 struct lm70 *p_lm70 = dev_get_drvdata(&spi->dev); 53 struct lm70 *p_lm70 = dev_get_drvdata(&spi->dev);
53 54
54 if (down_interruptible(&p_lm70->sem)) 55 if (mutex_lock_interruptible(&p_lm70->lock))
55 return -ERESTARTSYS; 56 return -ERESTARTSYS;
56 57
57 /* 58 /*
@@ -83,7 +84,7 @@ static ssize_t lm70_sense_temp(struct device *dev,
83 val = ((int)raw/32) * 250; 84 val = ((int)raw/32) * 250;
84 status = sprintf(buf, "%d\n", val); /* millidegrees Celsius */ 85 status = sprintf(buf, "%d\n", val); /* millidegrees Celsius */
85out: 86out:
86 up(&p_lm70->sem); 87 mutex_unlock(&p_lm70->lock);
87 return status; 88 return status;
88} 89}
89 90
@@ -112,7 +113,7 @@ static int __devinit lm70_probe(struct spi_device *spi)
112 if (!p_lm70) 113 if (!p_lm70)
113 return -ENOMEM; 114 return -ENOMEM;
114 115
115 init_MUTEX(&p_lm70->sem); 116 mutex_init(&p_lm70->lock);
116 117
117 /* sysfs hook */ 118 /* sysfs hook */
118 p_lm70->hwmon_dev = hwmon_device_register(&spi->dev); 119 p_lm70->hwmon_dev = hwmon_device_register(&spi->dev);