diff options
Diffstat (limited to 'drivers/hwmon/lm70.c')
| -rw-r--r-- | drivers/hwmon/lm70.c | 11 |
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 | ||
| 39 | struct lm70 { | 40 | struct 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 */ |
| 85 | out: | 86 | out: |
| 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); |
