hwmon: Semaphore to mutex conversions
Subsystems (9)
PATCH 19/36 hwmon: Semaphore to mutex conversions
convert drivers/hwmon/*.c semaphore use to mutexes.
the conversion was generated via scripts, and the result was validated automatically via a script as well.
all affected hwmon drivers were build-tested.
---
drivers/hwmon/adm1021.c | 13 ++++--- drivers/hwmon/adm1025.c | 25 +++++++------ drivers/hwmon/adm1026.c | 87 ++++++++++++++++++++++---------------------- drivers/hwmon/adm1031.c | 49 +++++++++++++------------ drivers/hwmon/adm9240.c | 29 ++++++++------- drivers/hwmon/asb100.c | 45 ++++++++++++----------- drivers/hwmon/atxp1.c | 9 +++-- drivers/hwmon/ds1621.c | 13 ++++--- drivers/hwmon/fscher.c | 41 +++++++++++---------- drivers/hwmon/fscpos.c | 29 ++++++++------- drivers/hwmon/gl518sm.c | 25 +++++++------ drivers/hwmon/gl520sm.c | 45 ++++++++++++----------- drivers/hwmon/hdaps.c | 37 ++++++++++--------- drivers/hwmon/it87.c | 61 ++++++++++++++++--------------- drivers/hwmon/lm63.c | 29 ++++++++------- drivers/hwmon/lm75.c | 13 ++++--- drivers/hwmon/lm77.c | 21 ++++++----- drivers/hwmon/lm78.c | 47 ++++++++++++------------ drivers/hwmon/lm80.c | 27 +++++++------- drivers/hwmon/lm83.c | 13 ++++--- drivers/hwmon/lm85.c | 67 +++++++++++++++++----------------- drivers/hwmon/lm87.c | 39 ++++++++++---------- drivers/hwmon/lm90.c | 21 ++++++----- drivers/hwmon/lm92.c | 17 +++++---- drivers/hwmon/max1619.c | 13 ++++--- drivers/hwmon/pc87360.c | 61 ++++++++++++++++--------------- drivers/hwmon/sis5595.c | 47 ++++++++++++------------ drivers/hwmon/smsc47b397.c | 17 +++++---- drivers/hwmon/smsc47m1.c | 41 +++++++++++---------- drivers/hwmon/via686a.c | 33 +++++++++-------- drivers/hwmon/vt8231.c | 51 +++++++++++++------------- drivers/hwmon/w83627ehf.c | 33 +++++++++-------- drivers/hwmon/w83627hf.c | 57 +++++++++++++++-------------- drivers/hwmon/w83781d.c | 55 ++++++++++++++-------------- drivers/hwmon/w83792d.c | 9 +++-- drivers/hwmon/w83l785ts.c | 9 +++-- 36 files changed, 632 insertions(+), 596 deletions(-)
9a61bf6300533d3b64d7ff29adfec00e596de67d
drivers/hwmon/adm1021.c +7 -6
@@ -26,6 +26,7 @@#include <linux/i2c.h> #include <linux/hwmon.h> #include <linux/err.h> +#include <linux/mutex.h> /* Addresses to scan */
@@ -92,7 +93,7 @@ struct adm1021_data {struct class_device *class_dev;enum chips type; -struct semaphore update_lock; +struct mutex update_lock;char valid;/* !=0 if following fields are valid */ unsigned long last_updated;/* In jiffies */
@@ -162,10 +163,10 @@ static ssize_t set_##value(struct devicestruct adm1021_data *data =i2c_get_clientdata (client); \int temp =simple_strtoul (buf,NULL ,10 ); \ \ -down (&data->update_lock); \ +mutex_lock (&data->update_lock); \ data->value =TEMP_TO_REG (temp); \adm1021_write_value (client, reg, data->value); \ -up (&data->update_lock); \ +mutex_unlock (&data->update_lock); \return count; \ }set (temp_max,ADM1021_REG_TOS_W );
@@ -275,7 +276,7 @@ static int adm1021_detect(struct i2c_adastrlcpy (new_client->name, type_name,I2C_NAME_SIZE ); data->type = kind; data->valid =0 ; -init_MUTEX (&data->update_lock); +mutex_init (&data->update_lock);/* Tell the I2C layer a new client has arrived */ if ((err =i2c_attach_client (new_client)))
@@ -351,7 +352,7 @@ static struct adm1021_data *adm1021_updastruct i2c_client *client =to_i2c_client (dev);struct adm1021_data *data =i2c_get_clientdata (client); -down (&data->update_lock); +mutex_lock (&data->update_lock);if (time_after (jiffies, data->last_updated +HZ +HZ /2 ) || !data->valid) {
@@ -375,7 +376,7 @@ static struct adm1021_data *adm1021_upda data->valid =1 ; } -up (&data->update_lock); +mutex_unlock (&data->update_lock);return data; }
drivers/hwmon/adm1025.c +13 -12
@@ -53,6 +53,7 @@#include <linux/hwmon.h> #include <linux/hwmon-vid.h> #include <linux/err.h> +#include <linux/mutex.h> /* * Addresses to scan
@@ -133,7 +134,7 @@ static struct i2c_driver adm1025_driverstruct adm1025_data {struct i2c_client client;struct class_device *class_dev; -struct semaphore update_lock; +struct mutex update_lock;char valid;/* zero until following fields are valid */ unsigned long last_updated;/* in jiffies */
@@ -207,11 +208,11 @@ static ssize_t set_in##offset##_min(strustruct adm1025_data *data =i2c_get_clientdata (client); \long val =simple_strtol (buf,NULL ,10 ); \ \ -down (&data->update_lock); \ +mutex_lock (&data->update_lock); \ data->in_min[offset] =IN_TO_REG (val, in_scale[offset]); \i2c_smbus_write_byte_data (client,ADM1025_REG_IN_MIN (offset), \ data->in_min[offset]); \ -up (&data->update_lock); \ +mutex_unlock (&data->update_lock); \return count; \ } \ static ssize_t set_in##offset##_max(struct device *dev, struct device_attribute *attr, const char *buf, \
@@ -221,11 +222,11 @@ static ssize_t set_in##offset##_max(strustruct adm1025_data *data =i2c_get_clientdata (client); \long val =simple_strtol (buf,NULL ,10 ); \ \ -down (&data->update_lock); \ +mutex_lock (&data->update_lock); \ data->in_max[offset] =IN_TO_REG (val, in_scale[offset]); \i2c_smbus_write_byte_data (client,ADM1025_REG_IN_MAX (offset), \ data->in_max[offset]); \ -up (&data->update_lock); \ +mutex_unlock (&data->update_lock); \return count; \ } \ static DEVICE_ATTR(in##offset##_min, S_IWUSR | S_IRUGO, \
@@ -247,11 +248,11 @@ static ssize_t set_temp##offset##_min(ststruct adm1025_data *data =i2c_get_clientdata (client); \long val =simple_strtol (buf,NULL ,10 ); \ \ -down (&data->update_lock); \ +mutex_lock (&data->update_lock); \ data->temp_min[offset-1 ] =TEMP_TO_REG (val); \i2c_smbus_write_byte_data (client,ADM1025_REG_TEMP_LOW (offset-1 ), \ data->temp_min[offset-1 ]); \ -up (&data->update_lock); \ +mutex_unlock (&data->update_lock); \return count; \ } \ static ssize_t set_temp##offset##_max(struct device *dev, struct device_attribute *attr, const char *buf, \
@@ -261,11 +262,11 @@ static ssize_t set_temp##offset##_max(ststruct adm1025_data *data =i2c_get_clientdata (client); \long val =simple_strtol (buf,NULL ,10 ); \ \ -down (&data->update_lock); \ +mutex_lock (&data->update_lock); \ data->temp_max[offset-1 ] =TEMP_TO_REG (val); \i2c_smbus_write_byte_data (client,ADM1025_REG_TEMP_HIGH (offset-1 ), \ data->temp_max[offset-1 ]); \ -up (&data->update_lock); \ +mutex_unlock (&data->update_lock); \return count; \ } \ static DEVICE_ATTR(temp##offset##_min, S_IWUSR | S_IRUGO, \
@@ -404,7 +405,7 @@ static int adm1025_detect(struct i2c_ada/* We can fill in the remaining client fields */ strlcpy (new_client->name, name,I2C_NAME_SIZE ); data->valid =0 ; -init_MUTEX (&data->update_lock); +mutex_init (&data->update_lock);/* Tell the I2C layer a new client has arrived */ if ((err =i2c_attach_client (new_client)))
@@ -523,7 +524,7 @@ static struct adm1025_data *adm1025_updastruct i2c_client *client =to_i2c_client (dev);struct adm1025_data *data =i2c_get_clientdata (client); -down (&data->update_lock); +mutex_lock (&data->update_lock);if (time_after (jiffies, data->last_updated +HZ *2 ) || !data->valid) {int i;
@@ -558,7 +559,7 @@ static struct adm1025_data *adm1025_upda data->valid =1 ; } -up (&data->update_lock); +mutex_unlock (&data->update_lock);return data; }
drivers/hwmon/adm1026.c +44 -43
302 lines not on this page · raw message
drivers/hwmon/adm1031.c +25 -24
177 lines not on this page · raw message
drivers/hwmon/adm9240.c +15 -14
@@ -49,6 +49,7 @@#include <linux/hwmon.h> #include <linux/hwmon-vid.h> #include <linux/err.h> +#include <linux/mutex.h> /* Addresses to scan */ static unsigned short normal_i2c[] = {0x2c ,0x2d ,0x2e ,0x2f ,
@@ -150,7 +151,7 @@ struct adm9240_data {enum chips type;struct i2c_client client;struct class_device *class_dev; -struct semaphore update_lock; +struct mutex update_lock;char valid;unsigned long last_updated_measure;unsigned long last_updated_config;
@@ -195,11 +196,11 @@ static ssize_t set_max(struct device *destruct adm9240_data *data =i2c_get_clientdata (client);long val =simple_strtol (buf,NULL ,10 ); -down (&data->update_lock); +mutex_lock (&data->update_lock); data->temp_max[attr->index] =TEMP_TO_REG (val);i2c_smbus_write_byte_data (client,ADM9240_REG_TEMP_MAX (attr->index), data->temp_max[attr->index]); -up (&data->update_lock); +mutex_unlock (&data->update_lock);return count; }
@@ -246,11 +247,11 @@ static ssize_t set_in_min(struct devicestruct adm9240_data *data =i2c_get_clientdata (client);unsigned long val =simple_strtoul (buf,NULL ,10 ); -down (&data->update_lock); +mutex_lock (&data->update_lock); data->in_min[attr->index] =IN_TO_REG (val, attr->index);i2c_smbus_write_byte_data (client,ADM9240_REG_IN_MIN (attr->index), data->in_min[attr->index]); -up (&data->update_lock); +mutex_unlock (&data->update_lock);return count; }
@@ -263,11 +264,11 @@ static ssize_t set_in_max(struct devicestruct adm9240_data *data =i2c_get_clientdata (client);unsigned long val =simple_strtoul (buf,NULL ,10 ); -down (&data->update_lock); +mutex_lock (&data->update_lock); data->in_max[attr->index] =IN_TO_REG (val, attr->index);i2c_smbus_write_byte_data (client,ADM9240_REG_IN_MAX (attr->index), data->in_max[attr->index]); -up (&data->update_lock); +mutex_unlock (&data->update_lock);return count; }
@@ -350,7 +351,7 @@ static ssize_t set_fan_min(struct deviceint nr = attr->index;u8 new_div; -down (&data->update_lock); +mutex_lock (&data->update_lock);if (!val) { data->fan_min[nr] =255 ;
@@ -390,7 +391,7 @@ static ssize_t set_fan_min(struct devicei2c_smbus_write_byte_data (client,ADM9240_REG_FAN_MIN (nr), data->fan_min[nr]); -up (&data->update_lock); +mutex_unlock (&data->update_lock);return count; }
@@ -439,10 +440,10 @@ static ssize_t set_aout(struct device *dstruct adm9240_data *data =i2c_get_clientdata (client);unsigned long val =simple_strtol (buf,NULL ,10 ); -down (&data->update_lock); +mutex_lock (&data->update_lock); data->aout =AOUT_TO_REG (val);i2c_smbus_write_byte_data (client,ADM9240_REG_ANALOG_OUT , data->aout); -up (&data->update_lock); +mutex_unlock (&data->update_lock);return count; } static DEVICE_ATTR(aout_output, S_IRUGO | S_IWUSR, show_aout, set_aout);
@@ -539,7 +540,7 @@ static int adm9240_detect(struct i2c_ada/* fill in the remaining client fields and attach */ strlcpy (new_client->name, name,I2C_NAME_SIZE ); data->type = kind; -init_MUTEX (&data->update_lock); +mutex_init (&data->update_lock);if ((err =i2c_attach_client (new_client))) goto exit_free;
@@ -691,7 +692,7 @@ static struct adm9240_data *adm9240_updastruct adm9240_data *data =i2c_get_clientdata (client);int i; -down (&data->update_lock); +mutex_lock (&data->update_lock);/* minimum measurement cycle: 1.75 seconds */ if (time_after(jiffies, data->last_updated_measure + (HZ * 7 / 4))
@@ -771,7 +772,7 @@ static struct adm9240_data *adm9240_upda data->last_updated_config = jiffies; data->valid =1 ; } -up (&data->update_lock); +mutex_unlock (&data->update_lock);return data; }
drivers/hwmon/asb100.c +23 -22
166 lines not on this page · raw message
drivers/hwmon/atxp1.c +5 -4
@@ -26,6 +26,7 @@#include <linux/hwmon.h> #include <linux/hwmon-vid.h> #include <linux/err.h> +#include <linux/mutex.h> MODULE_LICENSE ("GPL" );MODULE_DESCRIPTION ("System voltages control via Attansic ATXP1" );
@@ -60,7 +61,7 @@ static struct i2c_driver atxp1_driver =struct atxp1_data {struct i2c_client client;struct class_device *class_dev; -struct semaphore update_lock; +struct mutex update_lock;unsigned long last_updated;u8 valid;struct {
@@ -80,7 +81,7 @@ static struct atxp1_data * atxp1_update_ client =to_i2c_client (dev); data =i2c_get_clientdata (client); -down (&data->update_lock); +mutex_lock (&data->update_lock);if (time_after (jiffies, data->last_updated +HZ ) || !data->valid) {
@@ -93,7 +94,7 @@ static struct atxp1_data * atxp1_update_ data->valid =1 ; } -up (&data->update_lock); +mutex_unlock (&data->update_lock);return (data); }
@@ -309,7 +310,7 @@ static int atxp1_detect(struct i2c_adapt data->valid =0 ; -init_MUTEX (&data->update_lock); +mutex_init (&data->update_lock); err =i2c_attach_client (new_client);
drivers/hwmon/ds1621.c +7 -6
@@ -28,6 +28,7 @@#include <linux/i2c.h> #include <linux/hwmon.h> #include <linux/err.h> +#include <linux/mutex.h> #include "lm75.h" /* Addresses to scan */
@@ -72,7 +73,7 @@ MODULE_PARM_DESC(polarity, "Output's polstruct ds1621_data {struct i2c_client client;struct class_device *class_dev; -struct semaphore update_lock; +struct mutex update_lock;char valid;/* !=0 if following fields are valid */ unsigned long last_updated;/* In jiffies */
@@ -156,10 +157,10 @@ static ssize_t set_temp_##suffix(structstruct ds1621_data *data =ds1621_update_client (dev); \u16 val =LM75_TEMP_TO_REG (simple_strtoul (buf,NULL ,10 )); \ \ -down (&data->update_lock); \ +mutex_lock (&data->update_lock); \ data->value = val; \ds1621_write_value (client, reg, data->value); \ -up (&data->update_lock); \ +mutex_unlock (&data->update_lock); \return count; \ }
@@ -242,7 +243,7 @@ static int ds1621_detect(struct i2c_adap/* Fill in remaining client fields and put it into the global list */ strlcpy (new_client->name,"ds1621" ,I2C_NAME_SIZE ); data->valid =0 ; -init_MUTEX (&data->update_lock); +mutex_init (&data->update_lock);/* Tell the I2C layer a new client has arrived */ if ((err =i2c_attach_client (new_client)))
@@ -297,7 +298,7 @@ static struct ds1621_data *ds1621_updatestruct ds1621_data *data =i2c_get_clientdata (client);u8 new_conf; -down (&data->update_lock); +mutex_lock (&data->update_lock);if (time_after (jiffies, data->last_updated +HZ +HZ /2 ) || !data->valid) {
@@ -327,7 +328,7 @@ static struct ds1621_data *ds1621_update data->valid =1 ; } -up (&data->update_lock); +mutex_unlock (&data->update_lock);return data; }
drivers/hwmon/fscher.c +21 -20
139 lines not on this page · raw message
drivers/hwmon/fscpos.c +15 -14
@@ -37,6 +37,7 @@#include <linux/init.h> #include <linux/hwmon.h> #include <linux/err.h> +#include <linux/mutex.h> /* * Addresses to scan
@@ -114,7 +115,7 @@ static struct i2c_driver fscpos_driver struct fscpos_data {struct i2c_client client;struct class_device *class_dev; -struct semaphore update_lock; +struct mutex update_lock;char valid;/* 0 until following fields are valid */ unsigned long last_updated;/* In jiffies */
@@ -208,13 +209,13 @@ static ssize_t set_fan_ripple(struct i2creturn -EINVAL ; } -down (&data->update_lock); +mutex_lock (&data->update_lock);/* bits 2..7 reserved => mask with 0x03 */ data->fan_ripple[nr -1 ] &= ~0x03 ; data->fan_ripple[nr -1 ] |= v;fscpos_write_value (client, reg, data->fan_ripple[nr -1 ]); -up (&data->update_lock); +mutex_unlock (&data->update_lock);return count; }
@@ -232,10 +233,10 @@ static ssize_t set_pwm(struct i2c_clientif (v <0 ) v =0 ;if (v >255 ) v =255 ; -down (&data->update_lock); +mutex_lock (&data->update_lock); data->pwm[nr -1 ] = v;fscpos_write_value (client, reg, data->pwm[nr -1 ]); -up (&data->update_lock); +mutex_unlock (&data->update_lock);return count; }
@@ -278,11 +279,11 @@ static ssize_t set_wdog_control(struct i/* bits 0..3 reserved => mask with 0xf0 */ unsigned long v =simple_strtoul (buf,NULL ,10 ) &0xf0 ; -down (&data->update_lock); +mutex_lock (&data->update_lock); data->wdog_control &= ~0xf0 ; data->wdog_control |= v;fscpos_write_value (client, reg, data->wdog_control); -up (&data->update_lock); +mutex_unlock (&data->update_lock);return count; }
@@ -304,10 +305,10 @@ static ssize_t set_wdog_state(struct i2creturn -EINVAL ; } -down (&data->update_lock); +mutex_lock (&data->update_lock); data->wdog_state &= ~v;fscpos_write_value (client, reg, v); -up (&data->update_lock); +mutex_unlock (&data->update_lock);return count; }
@@ -321,10 +322,10 @@ static ssize_t set_wdog_preset(struct i2 {unsigned long v =simple_strtoul (buf,NULL ,10 ) &0xff ; -down (&data->update_lock); +mutex_lock (&data->update_lock); data->wdog_preset = v;fscpos_write_value (client, reg, data->wdog_preset); -up (&data->update_lock); +mutex_unlock (&data->update_lock);return count; }
@@ -483,7 +484,7 @@ static int fscpos_detect(struct i2c_adapstrlcpy (new_client->name,"fscpos" ,I2C_NAME_SIZE ); data->valid =0 ; -init_MUTEX (&data->update_lock); +mutex_init (&data->update_lock);/* Tell the I2C layer a new client has arrived */ if ((err =i2c_attach_client (new_client)))
@@ -579,7 +580,7 @@ static struct fscpos_data *fscpos_updatestruct i2c_client *client =to_i2c_client (dev);struct fscpos_data *data =i2c_get_clientdata (client); -down (&data->update_lock); +mutex_lock (&data->update_lock);if (time_after (jiffies, data->last_updated +2 *HZ ) || !data->valid) {int i;
@@ -625,7 +626,7 @@ static struct fscpos_data *fscpos_update data->last_updated = jiffies; data->valid =1 ; } -up (&data->update_lock); +mutex_unlock (&data->update_lock);return data; }
drivers/hwmon/gl518sm.c +13 -12
@@ -43,6 +43,7 @@#include <linux/i2c.h> #include <linux/hwmon.h> #include <linux/err.h> +#include <linux/mutex.h> /* Addresses to scan */ static unsigned short normal_i2c[] = {0x2c ,0x2d ,I2C_CLIENT_END };
@@ -120,7 +121,7 @@ struct gl518_data {struct class_device *class_dev;enum chips type; -struct semaphore update_lock; +struct mutex update_lock;char valid;/* !=0 if following fields are valid */ unsigned long last_updated;/* In jiffies */
@@ -212,10 +213,10 @@ static ssize_t set_##suffix(struct devicstruct gl518_data *data =i2c_get_clientdata (client); \long val =simple_strtol (buf,NULL ,10 ); \ \ -down (&data->update_lock); \ +mutex_lock (&data->update_lock); \ data->value = type##_TO_REG(val); \gl518_write_value (client, reg, data->value); \ -up (&data->update_lock); \ +mutex_unlock (&data->update_lock); \return count; \ }
@@ -228,12 +229,12 @@ static ssize_t set_##suffix(struct devicint regvalue; \unsigned long val =simple_strtoul (buf,NULL ,10 ); \ \ -down (&data->update_lock); \ +mutex_lock (&data->update_lock); \ regvalue =gl518_read_value (client, reg); \ data->value = type##_TO_REG(val); \ regvalue = (regvalue & ~mask) | (data->value << shift); \gl518_write_value (client, reg, regvalue); \ -up (&data->update_lock); \ +mutex_unlock (&data->update_lock); \return count; \ }
@@ -265,7 +266,7 @@ static ssize_t set_fan_min1(struct devicint regvalue;unsigned long val =simple_strtoul (buf,NULL ,10 ); -down (&data->update_lock); +mutex_lock (&data->update_lock); regvalue =gl518_read_value (client,GL518_REG_FAN_LIMIT ); data->fan_min[0 ] =FAN_TO_REG (val,DIV_FROM_REG (data->fan_div[0 ]));
@@ -280,7 +281,7 @@ static ssize_t set_fan_min1(struct devic data->beep_mask &= data->alarm_mask;gl518_write_value (client,GL518_REG_ALARM , data->beep_mask); -up (&data->update_lock); +mutex_unlock (&data->update_lock);return count; }
@@ -291,7 +292,7 @@ static ssize_t set_fan_min2(struct devicint regvalue;unsigned long val =simple_strtoul (buf,NULL ,10 ); -down (&data->update_lock); +mutex_lock (&data->update_lock); regvalue =gl518_read_value (client,GL518_REG_FAN_LIMIT ); data->fan_min[1 ] =FAN_TO_REG (val,DIV_FROM_REG (data->fan_div[1 ]));
@@ -306,7 +307,7 @@ static ssize_t set_fan_min2(struct devic data->beep_mask &= data->alarm_mask;gl518_write_value (client,GL518_REG_ALARM , data->beep_mask); -up (&data->update_lock); +mutex_unlock (&data->update_lock);return count; }
@@ -407,7 +408,7 @@ static int gl518_detect(struct i2c_adaptstrlcpy (new_client->name,"gl518sm" ,I2C_NAME_SIZE ); data->type = kind; data->valid =0 ; -init_MUTEX (&data->update_lock); +mutex_init (&data->update_lock);/* Tell the I2C layer a new client has arrived */ if ((err =i2c_attach_client (new_client)))
@@ -525,7 +526,7 @@ static struct gl518_data *gl518_update_dstruct gl518_data *data =i2c_get_clientdata (client);int val; -down (&data->update_lock); +mutex_lock (&data->update_lock);if (time_after (jiffies, data->last_updated +HZ +HZ /2 ) || !data->valid) {
@@ -586,7 +587,7 @@ static struct gl518_data *gl518_update_d data->valid =1 ; } -up (&data->update_lock); +mutex_unlock (&data->update_lock);return data; }
drivers/hwmon/gl520sm.c +23 -22
164 lines not on this page · raw message
drivers/hwmon/hdaps.c +19 -18
@@ -33,6 +33,7 @@#include <linux/module.h> #include <linux/timer.h> #include <linux/dmi.h> +#include <linux/mutex.h> #include <asm/io.h> #define HDAPS_LOW_PORT 0x1600/* first port used by hdaps */
@@ -70,10 +71,10 @@ static u8 km_activity;static int rest_x;static int rest_y; -static DECLARE_MUTEX (hdaps_sem); +static DEFINE_MUTEX (hdaps_mutex);/* -* __get_latch - Get the value from a given port. Callers must hold hdaps_sem. +* __get_latch - Get the value from a given port. Callers must hold hdaps_mutex. */ static inline u8 __get_latch (u16 port) {
@@ -82,7 +83,7 @@ static inline u8 __get_latch(u16 port)/* * __check_latch - Check a port latch for a given value. Returns zero if the -* port contains the given value. Callers must hold hdaps_sem. +* port contains the given value. Callers must hold hdaps_mutex. */ static inline int __check_latch (u16 port,u8 val) {
@@ -93,7 +94,7 @@ static inline int __check_latch(u16 port/* * __wait_latch - Wait up to 100us for a port latch to get a certain value, -* returning zero if the value is obtained. Callers must hold hdaps_sem. +* returning zero if the value is obtained. Callers must hold hdaps_mutex. */ static int __wait_latch (u16 port,u8 val) {
@@ -110,7 +111,7 @@ static int __wait_latch(u16 port, u8 val/* * __device_refresh - request a refresh from the accelerometer. Does not wait -* for refresh to complete. Callers must hold hdaps_sem. +* for refresh to complete. Callers must hold hdaps_mutex. */ static void __device_refresh (void ) {
@@ -124,7 +125,7 @@ static void __device_refresh(void)/* * __device_refresh_sync - request a synchronous refresh from the * accelerometer. We wait for the refresh to complete. Returns zero if -* successful and nonzero on error. Callers must hold hdaps_sem. +* successful and nonzero on error. Callers must hold hdaps_mutex. */ static int __device_refresh_sync (void ) {
@@ -134,7 +135,7 @@ static int __device_refresh_sync(void)/* * __device_complete - indicate to the accelerometer that we are done reading -* data, and then initiate an async refresh. Callers must hold hdaps_sem. +* data, and then initiate an async refresh. Callers must hold hdaps_mutex. */ static inline void __device_complete (void ) {
@@ -152,7 +153,7 @@ static int hdaps_readb_one(unsigned int {int ret; -down (&hdaps_sem); +mutex_lock (&hdaps_mutex);/* do a sync refresh -- we need to be sure that we read fresh data */ ret =__device_refresh_sync ();
@@ -163,7 +164,7 @@ static int hdaps_readb_one(unsigned int__device_complete (); out: -up (&hdaps_sem); +mutex_unlock (&hdaps_mutex);return ret; }
@@ -198,9 +199,9 @@ static int hdaps_read_pair(unsigned int {int ret; -down (&hdaps_sem); +mutex_lock (&hdaps_mutex); ret =__hdaps_read_pair (port1, port2, val1, val2); -up (&hdaps_sem); +mutex_unlock (&hdaps_mutex);return ret; }
@@ -213,7 +214,7 @@ static int hdaps_device_init(void) {int total, ret = -ENXIO ; -down (&hdaps_sem); +mutex_lock (&hdaps_mutex);outb (0x13 ,0x1610 );outb (0x01 ,0x161f );
@@ -279,7 +280,7 @@ static int hdaps_device_init(void) } out: -up (&hdaps_sem); +mutex_unlock (&hdaps_mutex);return ret; }
@@ -313,7 +314,7 @@ static struct platform_driver hdaps_driv };/* -* hdaps_calibrate - Set our "resting" values. Callers must hold hdaps_sem. +* hdaps_calibrate - Set our "resting" values. Callers must hold hdaps_mutex. */ static void hdaps_calibrate (void ) {
@@ -325,7 +326,7 @@ static void hdaps_mousedev_poll(unsignedint x, y;/* Cannot sleep. Try nonblockingly. If we fail, try again later. */ -if (down_trylock (&hdaps_sem)) { +if (!mutex_trylock (&hdaps_mutex)) {mod_timer (&hdaps_timer,jiffies +HDAPS_POLL_PERIOD );return ; }
@@ -340,7 +341,7 @@ static void hdaps_mousedev_poll(unsignedmod_timer (&hdaps_timer, jiffies +HDAPS_POLL_PERIOD ); out: -up (&hdaps_sem); +mutex_unlock (&hdaps_mutex); }
@@ -420,9 +421,9 @@ static ssize_t hdaps_calibrate_store(strstruct device_attribute *attr, const char *buf, size_t count) { - down(&hdaps_sem); + mutex_lock(&hdaps_mutex);hdaps_calibrate (); -up (&hdaps_sem); +mutex_unlock (&hdaps_mutex);return count; }
drivers/hwmon/it87.c +31 -30
212 lines not on this page · raw message
drivers/hwmon/lm63.c +15 -14
@@ -45,6 +45,7 @@#include <linux/hwmon-sysfs.h> #include <linux/hwmon.h> #include <linux/err.h> +#include <linux/mutex.h> /* * Addresses to scan
@@ -153,7 +154,7 @@ static struct i2c_driver lm63_driver = {struct lm63_data {struct i2c_client client;struct class_device *class_dev; -struct semaphore update_lock; +struct mutex update_lock;char valid;/* zero until following fields are valid */ unsigned long last_updated;/* in jiffies */
@@ -192,13 +193,13 @@ static ssize_t set_fan(struct device *destruct lm63_data *data =i2c_get_clientdata (client);unsigned long val =simple_strtoul (buf,NULL ,10 ); -down (&data->update_lock); +mutex_lock (&data->update_lock); data->fan[1 ] =FAN_TO_REG (val);i2c_smbus_write_byte_data (client,LM63_REG_TACH_LIMIT_LSB , data->fan[1 ] &0xFF );i2c_smbus_write_byte_data (client,LM63_REG_TACH_LIMIT_MSB , data->fan[1 ] >>8 ); -up (&data->update_lock); +mutex_unlock (&data->update_lock);return count; }
@@ -222,12 +223,12 @@ static ssize_t set_pwm1(struct device *dreturn -EPERM ; val =simple_strtoul (buf,NULL ,10 ); -down (&data->update_lock); +mutex_lock (&data->update_lock); data->pwm1_value = val <=0 ?0 : val >=255 ?2 * data->pwm1_freq : (val * data->pwm1_freq *2 +127 ) /255 ;i2c_smbus_write_byte_data (client,LM63_REG_PWM_VALUE , data->pwm1_value); -up (&data->update_lock); +mutex_unlock (&data->update_lock);return count; }
@@ -253,10 +254,10 @@ static ssize_t set_temp8(struct device *struct lm63_data *data =i2c_get_clientdata (client);long val =simple_strtol (buf,NULL ,10 ); -down (&data->update_lock); +mutex_lock (&data->update_lock); data->temp8[1 ] =TEMP8_TO_REG (val);i2c_smbus_write_byte_data (client,LM63_REG_LOCAL_HIGH , data->temp8[1 ]); -up (&data->update_lock); +mutex_unlock (&data->update_lock);return count; }
@@ -284,13 +285,13 @@ static ssize_t set_temp11(struct devicelong val =simple_strtol (buf,NULL ,10 );int nr = attr->index; -down (&data->update_lock); +mutex_lock (&data->update_lock); data->temp11[nr] =TEMP11_TO_REG (val);i2c_smbus_write_byte_data (client, reg[(nr -1 ) *2 ], data->temp11[nr] >>8 );i2c_smbus_write_byte_data (client, reg[(nr -1 ) *2 +1 ], data->temp11[nr] &0xff ); -up (&data->update_lock); +mutex_unlock (&data->update_lock);return count; }
@@ -314,11 +315,11 @@ static ssize_t set_temp2_crit_hyst(struclong val =simple_strtol (buf,NULL ,10 );long hyst; -down (&data->update_lock); +mutex_lock (&data->update_lock); hyst =TEMP8_FROM_REG (data->temp8[2 ]) - val;i2c_smbus_write_byte_data (client,LM63_REG_REMOTE_TCRIT_HYST ,HYST_TO_REG (hyst)); -up (&data->update_lock); +mutex_unlock (&data->update_lock);return count; }
@@ -427,7 +428,7 @@ static int lm63_detect(struct i2c_adaptestrlcpy (new_client->name,"lm63" ,I2C_NAME_SIZE ); data->valid =0 ; -init_MUTEX (&data->update_lock); +mutex_init (&data->update_lock);/* Tell the I2C layer a new client has arrived */ if ((err =i2c_attach_client (new_client)))
@@ -530,7 +531,7 @@ static struct lm63_data *lm63_update_devstruct i2c_client *client =to_i2c_client (dev);struct lm63_data *data =i2c_get_clientdata (client); -down (&data->update_lock); +mutex_lock (&data->update_lock);if (time_after (jiffies, data->last_updated +HZ ) || !data->valid) {if (data->config &0x04 ) {/* tachometer enabled */
@@ -582,7 +583,7 @@ static struct lm63_data *lm63_update_dev data->valid =1 ; } -up (&data->update_lock); +mutex_unlock (&data->update_lock);return data; }
drivers/hwmon/lm75.c +7 -6
@@ -25,6 +25,7 @@#include <linux/i2c.h> #include <linux/hwmon.h> #include <linux/err.h> +#include <linux/mutex.h> #include "lm75.h"
@@ -47,7 +48,7 @@ I2C_CLIENT_INSMOD_1(lm75);struct lm75_data {struct i2c_client client;struct class_device *class_dev; -struct semaphore update_lock; +struct mutex update_lock;char valid;/* !=0 if following fields are valid */ unsigned long last_updated;/* In jiffies */ u16 temp_input;/* Register values */
@@ -91,10 +92,10 @@ static ssize_t set_##value(struct devicestruct lm75_data *data =i2c_get_clientdata (client); \int temp =simple_strtoul (buf,NULL ,10 ); \ \ -down (&data->update_lock); \ +mutex_lock (&data->update_lock); \ data->value =LM75_TEMP_TO_REG (temp); \lm75_write_value (client, reg, data->value); \ -up (&data->update_lock); \ +mutex_unlock (&data->update_lock); \return count; \ }set (temp_max,LM75_REG_TEMP_OS );
@@ -188,7 +189,7 @@ static int lm75_detect(struct i2c_adapte/* Fill in the remaining client fields and put it into the global list */ strlcpy (new_client->name, name,I2C_NAME_SIZE ); data->valid =0 ; -init_MUTEX (&data->update_lock); +mutex_init (&data->update_lock);/* Tell the I2C layer a new client has arrived */ if ((err =i2c_attach_client (new_client)))
@@ -264,7 +265,7 @@ static struct lm75_data *lm75_update_devstruct i2c_client *client =to_i2c_client (dev);struct lm75_data *data =i2c_get_clientdata (client); -down (&data->update_lock); +mutex_lock (&data->update_lock);if (time_after (jiffies, data->last_updated +HZ +HZ /2 ) || !data->valid) {
@@ -277,7 +278,7 @@ static struct lm75_data *lm75_update_dev data->valid =1 ; } -up (&data->update_lock); +mutex_unlock (&data->update_lock);return data; }
drivers/hwmon/lm77.c +11 -10
@@ -32,6 +32,7 @@#include <linux/i2c.h> #include <linux/hwmon.h> #include <linux/err.h> +#include <linux/mutex.h> /* Addresses to scan */ static unsigned short normal_i2c[] = {0x48 ,0x49 ,0x4a ,0x4b ,I2C_CLIENT_END };
@@ -51,7 +52,7 @@ I2C_CLIENT_INSMOD_1(lm77);struct lm77_data {struct i2c_client client;struct class_device *class_dev; -struct semaphore update_lock; +struct mutex update_lock;char valid;unsigned long last_updated;/* In jiffies */ int temp_input;/* Temperatures */
@@ -139,10 +140,10 @@ static ssize_t set_##value(struct devicestruct lm77_data *data =i2c_get_clientdata (client); \long val =simple_strtoul (buf,NULL ,10 ); \ \ -down (&data->update_lock); \ +mutex_lock (&data->update_lock); \ data->value = val; \lm77_write_value (client, reg,LM77_TEMP_TO_REG (data->value)); \ -up (&data->update_lock); \ +mutex_unlock (&data->update_lock); \return count; \ }
@@ -157,11 +158,11 @@ static ssize_t set_temp_crit_hyst(structstruct lm77_data *data =i2c_get_clientdata (client);unsigned long val =simple_strtoul (buf,NULL ,10 ); -down (&data->update_lock); +mutex_lock (&data->update_lock); data->temp_hyst = data->temp_crit - val;lm77_write_value (client,LM77_REG_TEMP_HYST ,LM77_TEMP_TO_REG (data->temp_hyst)); -up (&data->update_lock); +mutex_unlock (&data->update_lock);return count; }
@@ -173,7 +174,7 @@ static ssize_t set_temp_crit(struct devilong val =simple_strtoul (buf,NULL ,10 );int oldcrithyst; -down (&data->update_lock); +mutex_lock (&data->update_lock); oldcrithyst = data->temp_crit - data->temp_hyst; data->temp_crit = val; data->temp_hyst = data->temp_crit - oldcrithyst;
@@ -181,7 +182,7 @@ static ssize_t set_temp_crit(struct devi LM77_TEMP_TO_REG(data->temp_crit));lm77_write_value (client,LM77_REG_TEMP_HYST ,LM77_TEMP_TO_REG (data->temp_hyst)); -up (&data->update_lock); +mutex_unlock (&data->update_lock);return count; }
@@ -306,7 +307,7 @@ static int lm77_detect(struct i2c_adapte/* Fill in the remaining client fields and put it into the global list */ strlcpy (new_client->name, name,I2C_NAME_SIZE ); data->valid =0 ; -init_MUTEX (&data->update_lock); +mutex_init (&data->update_lock);/* Tell the I2C layer a new client has arrived */ if ((err =i2c_attach_client (new_client)))
@@ -380,7 +381,7 @@ static struct lm77_data *lm77_update_devstruct i2c_client *client =to_i2c_client (dev);struct lm77_data *data =i2c_get_clientdata (client); -down (&data->update_lock); +mutex_lock (&data->update_lock);if (time_after (jiffies, data->last_updated +HZ +HZ /2 ) || !data->valid) {
@@ -406,7 +407,7 @@ static struct lm77_data *lm77_update_dev data->valid =1 ; } -up (&data->update_lock); +mutex_unlock (&data->update_lock);return data; }
drivers/hwmon/lm78.c +24 -23
158 lines not on this page · raw message
drivers/hwmon/lm80.c +14 -13
@@ -28,6 +28,7 @@#include <linux/i2c.h> #include <linux/hwmon.h> #include <linux/err.h> +#include <linux/mutex.h> /* Addresses to scan */ static unsigned short normal_i2c[] = {0x28 ,0x29 ,0x2a ,0x2b ,0x2c ,
@@ -108,7 +109,7 @@ static inline long TEMP_FROM_REG(u16 temstruct lm80_data {struct i2c_client client;struct class_device *class_dev; -struct semaphore update_lock; +struct mutex update_lock;char valid;/* !=0 if following fields are valid */ unsigned long last_updated;/* In jiffies */
@@ -191,10 +192,10 @@ static ssize_t set_in_##suffix(struct destruct lm80_data *data =i2c_get_clientdata (client); \long val =simple_strtol (buf,NULL ,10 ); \ \ -down (&data->update_lock);\ +mutex_lock (&data->update_lock);\ data->value =IN_TO_REG (val); \lm80_write_value (client, reg, data->value); \ -up (&data->update_lock);\ +mutex_unlock (&data->update_lock);\return count; \ }set_in (min0, in_min[0 ],LM80_REG_IN_MIN (0 ));
@@ -241,10 +242,10 @@ static ssize_t set_fan_##suffix(struct dstruct lm80_data *data =i2c_get_clientdata (client); \long val =simple_strtoul (buf,NULL ,10 ); \ \ -down (&data->update_lock);\ +mutex_lock (&data->update_lock);\ data->value =FAN_TO_REG (val,DIV_FROM_REG (data->div)); \lm80_write_value (client, reg, data->value); \ -up (&data->update_lock);\ +mutex_unlock (&data->update_lock);\return count; \ }set_fan (min1, fan_min[0 ],LM80_REG_FAN_MIN (1 ), fan_div[0 ]);
@@ -263,7 +264,7 @@ static ssize_t set_fan_div(struct deviceu8 reg;/* Save fan_min */ -down (&data->update_lock); +mutex_lock (&data->update_lock); min =FAN_FROM_REG (data->fan_min[nr],DIV_FROM_REG (data->fan_div[nr]));
@@ -275,7 +276,7 @@ static ssize_t set_fan_div(struct devicedefault :dev_err (&client->dev,"fan_div value %ld not " "supported. Choose one of 1, 2, 4 or 8!\n" , val); -up (&data->update_lock); +mutex_unlock (&data->update_lock);return -EINVAL ; }
@@ -286,7 +287,7 @@ static ssize_t set_fan_div(struct device/* Restore fan_min */ data->fan_min[nr] =FAN_TO_REG (min,DIV_FROM_REG (data->fan_div[nr]));lm80_write_value (client,LM80_REG_FAN_MIN (nr +1 ), data->fan_min[nr]); -up (&data->update_lock); +mutex_unlock (&data->update_lock);return count; }
@@ -325,10 +326,10 @@ static ssize_t set_temp_##suffix(structstruct lm80_data *data =i2c_get_clientdata (client); \long val =simple_strtoul (buf,NULL ,10 ); \ \ -down (&data->update_lock); \ +mutex_lock (&data->update_lock); \ data->value =TEMP_LIMIT_TO_REG (val); \lm80_write_value (client, reg, data->value); \ -up (&data->update_lock); \ +mutex_unlock (&data->update_lock); \return count; \ }set_temp (hot_max, temp_hot_max,LM80_REG_TEMP_HOT_MAX );
@@ -437,7 +438,7 @@ static int lm80_detect(struct i2c_adapte/* Fill in the remaining client fields and put it into the global list */ strlcpy (new_client->name, name,I2C_NAME_SIZE ); data->valid =0 ; -init_MUTEX (&data->update_lock); +mutex_init (&data->update_lock);/* Tell the I2C layer a new client has arrived */ if ((err =i2c_attach_client (new_client)))
@@ -545,7 +546,7 @@ static struct lm80_data *lm80_update_devstruct lm80_data *data =i2c_get_clientdata (client);int i; -down (&data->update_lock); +mutex_lock (&data->update_lock);if (time_after (jiffies, data->last_updated +2 *HZ ) || !data->valid) {dev_dbg (&client->dev,"Starting lm80 update\n" );
@@ -585,7 +586,7 @@ static struct lm80_data *lm80_update_dev data->valid =1 ; } -up (&data->update_lock); +mutex_unlock (&data->update_lock);return data; }
drivers/hwmon/lm83.c +7 -6
@@ -35,6 +35,7 @@#include <linux/hwmon-sysfs.h> #include <linux/hwmon.h> #include <linux/err.h> +#include <linux/mutex.h> /* * Addresses to scan
@@ -139,7 +140,7 @@ static struct i2c_driver lm83_driver = {struct lm83_data {struct i2c_client client;struct class_device *class_dev; -struct semaphore update_lock; +struct mutex update_lock;char valid;/* zero until following fields are valid */ unsigned long last_updated;/* in jiffies */
@@ -171,11 +172,11 @@ static ssize_t set_temp(struct device *dlong val =simple_strtol (buf,NULL ,10 );int nr = attr->index; -down (&data->update_lock); +mutex_lock (&data->update_lock); data->temp[nr] =TEMP_TO_REG (val);i2c_smbus_write_byte_data (client,LM83_REG_W_HIGH [nr -4 ], data->temp[nr]); -up (&data->update_lock); +mutex_unlock (&data->update_lock);return count; }
@@ -300,7 +301,7 @@ static int lm83_detect(struct i2c_adapte/* We can fill in the remaining client fields */ strlcpy (new_client->name, name,I2C_NAME_SIZE ); data->valid =0 ; -init_MUTEX (&data->update_lock); +mutex_init (&data->update_lock);/* Tell the I2C layer a new client has arrived */ if ((err =i2c_attach_client (new_client)))
@@ -373,7 +374,7 @@ static struct lm83_data *lm83_update_devstruct i2c_client *client =to_i2c_client (dev);struct lm83_data *data =i2c_get_clientdata (client); -down (&data->update_lock); +mutex_lock (&data->update_lock);if (time_after (jiffies, data->last_updated +HZ *2 ) || !data->valid) {int nr;
@@ -393,7 +394,7 @@ static struct lm83_data *lm83_update_dev data->valid =1 ; } -up (&data->update_lock); +mutex_unlock (&data->update_lock);return data; }
drivers/hwmon/lm85.c +34 -33
234 lines not on this page · raw message
drivers/hwmon/lm87.c +20 -19
@@ -60,6 +60,7 @@#include <linux/hwmon.h> #include <linux/hwmon-vid.h> #include <linux/err.h> +#include <linux/mutex.h> /* * Addresses to scan
@@ -176,7 +177,7 @@ static struct i2c_driver lm87_driver = {struct lm87_data {struct i2c_client client;struct class_device *class_dev; -struct semaphore update_lock; +struct mutex update_lock;char valid;/* zero until following fields are valid */ unsigned long last_updated;/* In jiffies */
@@ -253,11 +254,11 @@ static void set_in_min(struct device *destruct lm87_data *data =i2c_get_clientdata (client);long val =simple_strtol (buf,NULL ,10 ); -down (&data->update_lock); +mutex_lock (&data->update_lock); data->in_min[nr] =IN_TO_REG (val, data->in_scale[nr]);lm87_write_value (client, nr<6 ?LM87_REG_IN_MIN (nr) :LM87_REG_AIN_MIN (nr-6 ), data->in_min[nr]); -up (&data->update_lock); +mutex_unlock (&data->update_lock); }static void set_in_max (struct device *dev,const char *buf,int nr)
@@ -266,11 +267,11 @@ static void set_in_max(struct device *destruct lm87_data *data =i2c_get_clientdata (client);long val =simple_strtol (buf,NULL ,10 ); -down (&data->update_lock); +mutex_lock (&data->update_lock); data->in_max[nr] =IN_TO_REG (val, data->in_scale[nr]);lm87_write_value (client, nr<6 ?LM87_REG_IN_MAX (nr) :LM87_REG_AIN_MAX (nr-6 ), data->in_max[nr]); -up (&data->update_lock); +mutex_unlock (&data->update_lock); }#define set_in (offset) \
@@ -327,10 +328,10 @@ static void set_temp_low(struct device *struct lm87_data *data =i2c_get_clientdata (client);long val =simple_strtol (buf,NULL ,10 ); -down (&data->update_lock); +mutex_lock (&data->update_lock); data->temp_low[nr] =TEMP_TO_REG (val);lm87_write_value (client,LM87_REG_TEMP_LOW [nr], data->temp_low[nr]); -up (&data->update_lock); +mutex_unlock (&data->update_lock); }static void set_temp_high (struct device *dev,const char *buf,int nr)
@@ -339,10 +340,10 @@ static void set_temp_high(struct devicestruct lm87_data *data =i2c_get_clientdata (client);long val =simple_strtol (buf,NULL ,10 ); -down (&data->update_lock); +mutex_lock (&data->update_lock); data->temp_high[nr] =TEMP_TO_REG (val);lm87_write_value (client,LM87_REG_TEMP_HIGH [nr], data->temp_high[nr]); -up (&data->update_lock); +mutex_unlock (&data->update_lock); }#define set_temp (offset) \
@@ -411,11 +412,11 @@ static void set_fan_min(struct device *dstruct lm87_data *data =i2c_get_clientdata (client);long val =simple_strtol (buf,NULL ,10 ); -down (&data->update_lock); +mutex_lock (&data->update_lock); data->fan_min[nr] =FAN_TO_REG (val,FAN_DIV_FROM_REG (data->fan_div[nr]));lm87_write_value (client,LM87_REG_FAN_MIN (nr), data->fan_min[nr]); -up (&data->update_lock); +mutex_unlock (&data->update_lock); }/* Note: we save and restore the fan minimum here, because its value is
@@ -431,7 +432,7 @@ static ssize_t set_fan_div(struct deviceunsigned long min;u8 reg; -down (&data->update_lock); +mutex_lock (&data->update_lock); min =FAN_FROM_REG (data->fan_min[nr],FAN_DIV_FROM_REG (data->fan_div[nr]));
@@ -441,7 +442,7 @@ static ssize_t set_fan_div(struct devicecase 4 : data->fan_div[nr] =2 ;break ;case 8 : data->fan_div[nr] =3 ;break ;default : -up (&data->update_lock); +mutex_unlock (&data->update_lock);return -EINVAL ; }
@@ -459,7 +460,7 @@ static ssize_t set_fan_div(struct device data->fan_min[nr] =FAN_TO_REG (min, val);lm87_write_value (client,LM87_REG_FAN_MIN (nr), data->fan_min[nr]); -up (&data->update_lock); +mutex_unlock (&data->update_lock);return count; }
@@ -522,10 +523,10 @@ static ssize_t set_aout(struct device *dstruct lm87_data *data =i2c_get_clientdata (client);long val =simple_strtol (buf,NULL ,10 ); -down (&data->update_lock); +mutex_lock (&data->update_lock); data->aout =AOUT_TO_REG (val);lm87_write_value (client,LM87_REG_AOUT , data->aout); -up (&data->update_lock); +mutex_unlock (&data->update_lock);return count; } static DEVICE_ATTR(aout_output, S_IRUGO | S_IWUSR, show_aout, set_aout);
@@ -589,7 +590,7 @@ static int lm87_detect(struct i2c_adapte/* We can fill in the remaining client fields */ strlcpy (new_client->name,"lm87" ,I2C_NAME_SIZE ); data->valid =0 ; -init_MUTEX (&data->update_lock); +mutex_init (&data->update_lock);/* Tell the I2C layer a new client has arrived */ if ((err =i2c_attach_client (new_client)))
@@ -744,7 +745,7 @@ static struct lm87_data *lm87_update_devstruct i2c_client *client =to_i2c_client (dev);struct lm87_data *data =i2c_get_clientdata (client); -down (&data->update_lock); +mutex_lock (&data->update_lock);if (time_after (jiffies, data->last_updated +HZ ) || !data->valid) {int i, j;
@@ -813,7 +814,7 @@ static struct lm87_data *lm87_update_dev data->valid =1 ; } -up (&data->update_lock); +mutex_unlock (&data->update_lock);return data; }
drivers/hwmon/lm90.c +11 -10
@@ -78,6 +78,7 @@#include <linux/hwmon-sysfs.h> #include <linux/hwmon.h> #include <linux/err.h> +#include <linux/mutex.h> /* * Addresses to scan
@@ -201,7 +202,7 @@ static struct i2c_driver lm90_driver = {struct lm90_data {struct i2c_client client;struct class_device *class_dev; -struct semaphore update_lock; +struct mutex update_lock;char valid;/* zero until following fields are valid */ unsigned long last_updated;/* in jiffies */ int kind;
@@ -247,13 +248,13 @@ static ssize_t set_temp8(struct device *long val =simple_strtol (buf,NULL ,10 );int nr = attr->index; -down (&data->update_lock); +mutex_lock (&data->update_lock);if (data->kind = adt7461) data->temp8[nr] =TEMP1_TO_REG_ADT7461 (val);else data->temp8[nr] =TEMP1_TO_REG (val);i2c_smbus_write_byte_data (client, reg[nr -1 ], data->temp8[nr]); -up (&data->update_lock); +mutex_unlock (&data->update_lock);return count; }
@@ -281,7 +282,7 @@ static ssize_t set_temp11(struct devicelong val =simple_strtol (buf,NULL ,10 );int nr = attr->index; -down (&data->update_lock); +mutex_lock (&data->update_lock);if (data->kind = adt7461) data->temp11[nr] =TEMP2_TO_REG_ADT7461 (val);else
@@ -290,7 +291,7 @@ static ssize_t set_temp11(struct device data->temp11[nr] >> 8);i2c_smbus_write_byte_data (client, reg[(nr -1 ) *2 +1 ], data->temp11[nr] &0xff ); -up (&data->update_lock); +mutex_unlock (&data->update_lock);return count; }
@@ -311,11 +312,11 @@ static ssize_t set_temphyst(struct deviclong val =simple_strtol (buf,NULL ,10 );long hyst; -down (&data->update_lock); +mutex_lock (&data->update_lock); hyst =TEMP1_FROM_REG (data->temp8[3 ]) - val;i2c_smbus_write_byte_data (client,LM90_REG_W_TCRIT_HYST ,HYST_TO_REG (hyst)); -up (&data->update_lock); +mutex_unlock (&data->update_lock);return count; }
@@ -558,7 +559,7 @@ static int lm90_detect(struct i2c_adaptestrlcpy (new_client->name, name,I2C_NAME_SIZE ); data->valid =0 ; data->kind = kind; -init_MUTEX (&data->update_lock); +mutex_init (&data->update_lock);/* Tell the I2C layer a new client has arrived */ if ((err =i2c_attach_client (new_client)))
@@ -646,7 +647,7 @@ static struct lm90_data *lm90_update_devstruct i2c_client *client =to_i2c_client (dev);struct lm90_data *data =i2c_get_clientdata (client); -down (&data->update_lock); +mutex_lock (&data->update_lock);if (time_after (jiffies, data->last_updated +HZ *2 ) || !data->valid) {u8 oldh, newh, l;
@@ -692,7 +693,7 @@ static struct lm90_data *lm90_update_dev data->valid =1 ; } -up (&data->update_lock); +mutex_unlock (&data->update_lock);return data; }
drivers/hwmon/lm92.c +9 -8
@@ -46,6 +46,7 @@#include <linux/i2c.h> #include <linux/hwmon.h> #include <linux/err.h> +#include <linux/mutex.h> /* The LM92 and MAX6635 have 2 two-state pins for address selection, resulting in 4 possible addresses. */
@@ -96,7 +97,7 @@ static struct i2c_driver lm92_driver;struct lm92_data {struct i2c_client client;struct class_device *class_dev; -struct semaphore update_lock; +struct mutex update_lock;char valid;/* zero until following fields are valid */ unsigned long last_updated;/* in jiffies */
@@ -114,7 +115,7 @@ static struct lm92_data *lm92_update_devstruct i2c_client *client =to_i2c_client (dev);struct lm92_data *data =i2c_get_clientdata (client); -down (&data->update_lock); +mutex_lock (&data->update_lock);if (time_after (jiffies, data->last_updated +HZ ) || !data->valid) {
@@ -134,7 +135,7 @@ static struct lm92_data *lm92_update_dev data->valid =1 ; } -up (&data->update_lock); +mutex_unlock (&data->update_lock);return data; }
@@ -158,10 +159,10 @@ static ssize_t set_##value(struct devicestruct lm92_data *data =i2c_get_clientdata (client); \long val =simple_strtol (buf,NULL ,10 ); \ \ -down (&data->update_lock); \ +mutex_lock (&data->update_lock); \ data->value =TEMP_TO_REG (val); \i2c_smbus_write_word_data (client, reg,swab16 (data->value)); \ -up (&data->update_lock); \ +mutex_unlock (&data->update_lock); \return count; \ }set_temp (temp1_crit,LM92_REG_TEMP_CRIT );
@@ -194,11 +195,11 @@ static ssize_t set_temp1_crit_hyst(strucstruct lm92_data *data =i2c_get_clientdata (client);long val =simple_strtol (buf,NULL ,10 ); -down (&data->update_lock); +mutex_lock (&data->update_lock); data->temp1_hyst =TEMP_FROM_REG (data->temp1_crit) - val;i2c_smbus_write_word_data (client,LM92_REG_TEMP_HYST ,swab16 (TEMP_TO_REG (data->temp1_hyst))); -up (&data->update_lock); +mutex_unlock (&data->update_lock);return count; }
@@ -348,7 +349,7 @@ static int lm92_detect(struct i2c_adapte/* Fill in the remaining client fields */ strlcpy (new_client->name, name,I2C_NAME_SIZE ); data->valid =0 ; -init_MUTEX (&data->update_lock); +mutex_init (&data->update_lock);/* Tell the i2c subsystem a new client has arrived */ if ((err =i2c_attach_client (new_client)))
drivers/hwmon/max1619.c +7 -6
@@ -33,6 +33,7 @@#include <linux/i2c.h> #include <linux/hwmon.h> #include <linux/err.h> +#include <linux/mutex.h> static unsigned short normal_i2c[] = {0x18 ,0x19 ,0x1a ,0x29 ,0x2a ,0x2b ,
@@ -104,7 +105,7 @@ static struct i2c_driver max1619_driverstruct max1619_data {struct i2c_client client;struct class_device *class_dev; -struct semaphore update_lock; +struct mutex update_lock;char valid;/* zero until following fields are valid */ unsigned long last_updated;/* in jiffies */
@@ -141,10 +142,10 @@ static ssize_t set_##value(struct devicestruct max1619_data *data =i2c_get_clientdata (client); \long val =simple_strtol (buf,NULL ,10 ); \ \ -down (&data->update_lock); \ +mutex_lock (&data->update_lock); \ data->value =TEMP_TO_REG (val); \i2c_smbus_write_byte_data (client, reg, data->value); \ -up (&data->update_lock); \ +mutex_unlock (&data->update_lock); \return count; \ }
@@ -262,7 +263,7 @@ static int max1619_detect(struct i2c_ada/* We can fill in the remaining client fields */ strlcpy (new_client->name, name,I2C_NAME_SIZE ); data->valid =0 ; -init_MUTEX (&data->update_lock); +mutex_init (&data->update_lock);/* Tell the I2C layer a new client has arrived */ if ((err =i2c_attach_client (new_client)))
@@ -330,7 +331,7 @@ static struct max1619_data *max1619_updastruct i2c_client *client =to_i2c_client (dev);struct max1619_data *data =i2c_get_clientdata (client); -down (&data->update_lock); +mutex_lock (&data->update_lock);if (time_after (jiffies, data->last_updated +HZ *2 ) || !data->valid) {dev_dbg (&client->dev,"Updating max1619 data.\n" );
@@ -353,7 +354,7 @@ static struct max1619_data *max1619_upda data->valid =1 ; } -up (&data->update_lock); +mutex_unlock (&data->update_lock);return data; }
drivers/hwmon/pc87360.c +31 -30
48 lines not on this page · raw message
drivers/hwmon/sis5595.c +24 -23
47 lines not on this page · raw message
drivers/hwmon/smsc47m1.c +21 -20
41 lines not on this page · raw message
drivers/hwmon/vt8231.c +26 -25
51 lines not on this page · raw message
drivers/hwmon/w83627hf.c +29 -28
57 lines not on this page · raw message
drivers/hwmon/w83781d.c +28 -27
55 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
1.2.4
Part of the diff is not shown here. View the raw message.