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

hwmon: (s3c-hwmon) Use a real mutex

The semaphore which protects the ADC is semantically a mutex. Use a
real mutex.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Ben Dooks <ben-linux@fluff.org>
Signed-off-by: Jean Delvare <khali@linux-fr.org>

authored by

Thomas Gleixner and committed by
Jean Delvare
9c627e3b caaa0f36

+4 -4
+4 -4
drivers/hwmon/s3c-hwmon.c
··· 51 51 * @attr: The holders for the channel attributes. 52 52 */ 53 53 struct s3c_hwmon { 54 - struct semaphore lock; 54 + struct mutex lock; 55 55 struct s3c_adc_client *client; 56 56 struct device *hwmon_dev; 57 57 ··· 73 73 { 74 74 int ret; 75 75 76 - ret = down_interruptible(&hwmon->lock); 76 + ret = mutex_lock_interruptible(&hwmon->lock); 77 77 if (ret < 0) 78 78 return ret; 79 79 80 80 dev_dbg(dev, "reading channel %d\n", channel); 81 81 82 82 ret = s3c_adc_read(hwmon->client, channel); 83 - up(&hwmon->lock); 83 + mutex_unlock(&hwmon->lock); 84 84 85 85 return ret; 86 86 } ··· 296 296 297 297 platform_set_drvdata(dev, hwmon); 298 298 299 - init_MUTEX(&hwmon->lock); 299 + mutex_init(&hwmon->lock); 300 300 301 301 /* Register with the core ADC driver. */ 302 302