Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Matthias Kaehlcke and committed by
Mark M. Hoffman
4bfe6604 8de57709

+6 -5
+6 -5
drivers/hwmon/lm70.c
··· 31 31 #include <linux/err.h> 32 32 #include <linux/sysfs.h> 33 33 #include <linux/hwmon.h> 34 + #include <linux/mutex.h> 34 35 #include <linux/spi/spi.h> 35 - #include <asm/semaphore.h> 36 + 36 37 37 38 #define DRVNAME "lm70" 38 39 39 40 struct lm70 { 40 41 struct device *hwmon_dev; 41 - struct semaphore sem; 42 + struct mutex lock; 42 43 }; 43 44 44 45 /* sysfs hook function */ ··· 52 51 s16 raw=0; 53 52 struct lm70 *p_lm70 = dev_get_drvdata(&spi->dev); 54 53 55 - if (down_interruptible(&p_lm70->sem)) 54 + if (mutex_lock_interruptible(&p_lm70->lock)) 56 55 return -ERESTARTSYS; 57 56 58 57 /* ··· 84 83 val = ((int)raw/32) * 250; 85 84 status = sprintf(buf, "%d\n", val); /* millidegrees Celsius */ 86 85 out: 87 - up(&p_lm70->sem); 86 + mutex_unlock(&p_lm70->lock); 88 87 return status; 89 88 } 90 89 ··· 113 112 if (!p_lm70) 114 113 return -ENOMEM; 115 114 116 - init_MUTEX(&p_lm70->sem); 115 + mutex_init(&p_lm70->lock); 117 116 118 117 /* sysfs hook */ 119 118 p_lm70->hwmon_dev = hwmon_device_register(&spi->dev);