X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=drivers%2Fhwmon%2Fvia686a.c;h=95ae056e5a94a8a8729ddc223ec771b6cb09fb73;hb=b19367c6f438b3a7700aceca21a03396702069ce;hp=cb01848729b5e2760805c106bd7182fef28120a4;hpb=123656d4cc8c946f578ebd18c2050f5251720428;p=powerpc.git diff --git a/drivers/hwmon/via686a.c b/drivers/hwmon/via686a.c index cb01848729..95ae056e5a 100644 --- a/drivers/hwmon/via686a.c +++ b/drivers/hwmon/via686a.c @@ -39,6 +39,7 @@ #include #include #include +#include #include @@ -296,7 +297,7 @@ static inline long TEMP_FROM_REG10(u16 val) struct via686a_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 */ @@ -355,11 +356,11 @@ static ssize_t set_in_min(struct device *dev, const char *buf, struct via686a_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[nr] = IN_TO_REG(val, nr); via686a_write_value(client, VIA686A_REG_IN_MIN(nr), data->in_min[nr]); - up(&data->update_lock); + mutex_unlock(&data->update_lock); return count; } static ssize_t set_in_max(struct device *dev, const char *buf, @@ -368,11 +369,11 @@ static ssize_t set_in_max(struct device *dev, const char *buf, struct via686a_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[nr] = IN_TO_REG(val, nr); via686a_write_value(client, VIA686A_REG_IN_MAX(nr), data->in_max[nr]); - up(&data->update_lock); + mutex_unlock(&data->update_lock); return count; } #define show_in_offset(offset) \ @@ -432,11 +433,11 @@ static ssize_t set_temp_over(struct device *dev, const char *buf, struct via686a_data *data = i2c_get_clientdata(client); int val = simple_strtol(buf, NULL, 10); - down(&data->update_lock); + mutex_lock(&data->update_lock); data->temp_over[nr] = TEMP_TO_REG(val); via686a_write_value(client, VIA686A_REG_TEMP_OVER[nr], data->temp_over[nr]); - up(&data->update_lock); + mutex_unlock(&data->update_lock); return count; } static ssize_t set_temp_hyst(struct device *dev, const char *buf, @@ -445,11 +446,11 @@ static ssize_t set_temp_hyst(struct device *dev, const char *buf, struct via686a_data *data = i2c_get_clientdata(client); int val = simple_strtol(buf, NULL, 10); - down(&data->update_lock); + mutex_lock(&data->update_lock); data->temp_hyst[nr] = TEMP_TO_REG(val); via686a_write_value(client, VIA686A_REG_TEMP_HYST[nr], data->temp_hyst[nr]); - up(&data->update_lock); + mutex_unlock(&data->update_lock); return count; } #define show_temp_offset(offset) \ @@ -508,10 +509,10 @@ static ssize_t set_fan_min(struct device *dev, const char *buf, struct via686a_data *data = i2c_get_clientdata(client); int val = simple_strtol(buf, NULL, 10); - down(&data->update_lock); + mutex_lock(&data->update_lock); data->fan_min[nr] = FAN_TO_REG(val, DIV_FROM_REG(data->fan_div[nr])); via686a_write_value(client, VIA686A_REG_FAN_MIN(nr+1), data->fan_min[nr]); - up(&data->update_lock); + mutex_unlock(&data->update_lock); return count; } static ssize_t set_fan_div(struct device *dev, const char *buf, @@ -521,12 +522,12 @@ static ssize_t set_fan_div(struct device *dev, const char *buf, int val = simple_strtol(buf, NULL, 10); int old; - down(&data->update_lock); + mutex_lock(&data->update_lock); old = via686a_read_value(client, VIA686A_REG_FANDIV); data->fan_div[nr] = DIV_TO_REG(val); old = (old & 0x0f) | (data->fan_div[1] << 6) | (data->fan_div[0] << 4); via686a_write_value(client, VIA686A_REG_FANDIV, old); - up(&data->update_lock); + mutex_unlock(&data->update_lock); return count; } @@ -573,6 +574,7 @@ static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL); smbus_driver and isa_driver, and clients could be of either kind */ static struct i2c_driver via686a_driver = { .driver = { + .owner = THIS_MODULE, .name = "via686a", }, .attach_adapter = via686a_detect, @@ -639,7 +641,7 @@ static int via686a_detect(struct i2c_adapter *adapter) strlcpy(new_client->name, client_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))) goto exit_free; @@ -733,7 +735,7 @@ static struct via686a_data *via686a_update_device(struct device *dev) struct via686a_data *data = i2c_get_clientdata(client); int i; - down(&data->update_lock); + mutex_lock(&data->update_lock); if (time_after(jiffies, data->last_updated + HZ + HZ / 2) || !data->valid) { @@ -788,7 +790,7 @@ static struct via686a_data *via686a_update_device(struct device *dev) data->valid = 1; } - up(&data->update_lock); + mutex_unlock(&data->update_lock); return data; }