aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/adm1026.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2006-01-18 17:19:26 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2006-03-23 17:21:52 -0500
commit9a61bf6300533d3b64d7ff29adfec00e596de67d (patch)
treecadce1ae78b51a1dc4c4414699cb590e8c8625e1 /drivers/hwmon/adm1026.c
parent3fb9a65529615944138d527b70174840c95c637a (diff)
[PATCH] 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. Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/hwmon/adm1026.c')
-rw-r--r--drivers/hwmon/adm1026.c87
1 files changed, 44 insertions, 43 deletions
diff --git a/drivers/hwmon/adm1026.c b/drivers/hwmon/adm1026.c
index fefe6e74fd02..8646ec1e9667 100644
--- a/drivers/hwmon/adm1026.c
+++ b/drivers/hwmon/adm1026.c
@@ -32,6 +32,7 @@
32#include <linux/hwmon-sysfs.h> 32#include <linux/hwmon-sysfs.h>
33#include <linux/hwmon-vid.h> 33#include <linux/hwmon-vid.h>
34#include <linux/err.h> 34#include <linux/err.h>
35#include <linux/mutex.h>
35 36
36/* Addresses to scan */ 37/* Addresses to scan */
37static unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, I2C_CLIENT_END }; 38static unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, I2C_CLIENT_END };
@@ -260,10 +261,10 @@ struct pwm_data {
260struct adm1026_data { 261struct adm1026_data {
261 struct i2c_client client; 262 struct i2c_client client;
262 struct class_device *class_dev; 263 struct class_device *class_dev;
263 struct semaphore lock; 264 struct mutex lock;
264 enum chips type; 265 enum chips type;
265 266
266 struct semaphore update_lock; 267 struct mutex update_lock;
267 int valid; /* !=0 if following fields are valid */ 268 int valid; /* !=0 if following fields are valid */
268 unsigned long last_reading; /* In jiffies */ 269 unsigned long last_reading; /* In jiffies */
269 unsigned long last_config; /* In jiffies */ 270 unsigned long last_config; /* In jiffies */
@@ -575,7 +576,7 @@ static struct adm1026_data *adm1026_update_device(struct device *dev)
575 int i; 576 int i;
576 long value, alarms, gpio; 577 long value, alarms, gpio;
577 578
578 down(&data->update_lock); 579 mutex_lock(&data->update_lock);
579 if (!data->valid 580 if (!data->valid
580 || time_after(jiffies, data->last_reading + ADM1026_DATA_INTERVAL)) { 581 || time_after(jiffies, data->last_reading + ADM1026_DATA_INTERVAL)) {
581 /* Things that change quickly */ 582 /* Things that change quickly */
@@ -710,7 +711,7 @@ static struct adm1026_data *adm1026_update_device(struct device *dev)
710 dev_dbg(&client->dev, "Setting VID from GPIO11-15.\n"); 711 dev_dbg(&client->dev, "Setting VID from GPIO11-15.\n");
711 data->vid = (data->gpio >> 11) & 0x1f; 712 data->vid = (data->gpio >> 11) & 0x1f;
712 data->valid = 1; 713 data->valid = 1;
713 up(&data->update_lock); 714 mutex_unlock(&data->update_lock);
714 return data; 715 return data;
715} 716}
716 717
@@ -739,10 +740,10 @@ static ssize_t set_in_min(struct device *dev, struct device_attribute *attr,
739 struct adm1026_data *data = i2c_get_clientdata(client); 740 struct adm1026_data *data = i2c_get_clientdata(client);
740 int val = simple_strtol(buf, NULL, 10); 741 int val = simple_strtol(buf, NULL, 10);
741 742
742 down(&data->update_lock); 743 mutex_lock(&data->update_lock);
743 data->in_min[nr] = INS_TO_REG(nr, val); 744 data->in_min[nr] = INS_TO_REG(nr, val);
744 adm1026_write_value(client, ADM1026_REG_IN_MIN[nr], data->in_min[nr]); 745 adm1026_write_value(client, ADM1026_REG_IN_MIN[nr], data->in_min[nr]);
745 up(&data->update_lock); 746 mutex_unlock(&data->update_lock);
746 return count; 747 return count;
747} 748}
748static ssize_t show_in_max(struct device *dev, struct device_attribute *attr, 749static ssize_t show_in_max(struct device *dev, struct device_attribute *attr,
@@ -762,10 +763,10 @@ static ssize_t set_in_max(struct device *dev, struct device_attribute *attr,
762 struct adm1026_data *data = i2c_get_clientdata(client); 763 struct adm1026_data *data = i2c_get_clientdata(client);
763 int val = simple_strtol(buf, NULL, 10); 764 int val = simple_strtol(buf, NULL, 10);
764 765
765 down(&data->update_lock); 766 mutex_lock(&data->update_lock);
766 data->in_max[nr] = INS_TO_REG(nr, val); 767 data->in_max[nr] = INS_TO_REG(nr, val);
767 adm1026_write_value(client, ADM1026_REG_IN_MAX[nr], data->in_max[nr]); 768 adm1026_write_value(client, ADM1026_REG_IN_MAX[nr], data->in_max[nr]);
768 up(&data->update_lock); 769 mutex_unlock(&data->update_lock);
769 return count; 770 return count;
770} 771}
771 772
@@ -813,10 +814,10 @@ static ssize_t set_in16_min(struct device *dev, struct device_attribute *attr, c
813 struct adm1026_data *data = i2c_get_clientdata(client); 814 struct adm1026_data *data = i2c_get_clientdata(client);
814 int val = simple_strtol(buf, NULL, 10); 815 int val = simple_strtol(buf, NULL, 10);
815 816
816 down(&data->update_lock); 817 mutex_lock(&data->update_lock);
817 data->in_min[16] = INS_TO_REG(16, val + NEG12_OFFSET); 818 data->in_min[16] = INS_TO_REG(16, val + NEG12_OFFSET);
818 adm1026_write_value(client, ADM1026_REG_IN_MIN[16], data->in_min[16]); 819 adm1026_write_value(client, ADM1026_REG_IN_MIN[16], data->in_min[16]);
819 up(&data->update_lock); 820 mutex_unlock(&data->update_lock);
820 return count; 821 return count;
821} 822}
822static ssize_t show_in16_max(struct device *dev, struct device_attribute *attr, char *buf) 823static ssize_t show_in16_max(struct device *dev, struct device_attribute *attr, char *buf)
@@ -831,10 +832,10 @@ static ssize_t set_in16_max(struct device *dev, struct device_attribute *attr, c
831 struct adm1026_data *data = i2c_get_clientdata(client); 832 struct adm1026_data *data = i2c_get_clientdata(client);
832 int val = simple_strtol(buf, NULL, 10); 833 int val = simple_strtol(buf, NULL, 10);
833 834
834 down(&data->update_lock); 835 mutex_lock(&data->update_lock);
835 data->in_max[16] = INS_TO_REG(16, val+NEG12_OFFSET); 836 data->in_max[16] = INS_TO_REG(16, val+NEG12_OFFSET);
836 adm1026_write_value(client, ADM1026_REG_IN_MAX[16], data->in_max[16]); 837 adm1026_write_value(client, ADM1026_REG_IN_MAX[16], data->in_max[16]);
837 up(&data->update_lock); 838 mutex_unlock(&data->update_lock);
838 return count; 839 return count;
839} 840}
840 841
@@ -874,11 +875,11 @@ static ssize_t set_fan_min(struct device *dev, struct device_attribute *attr,
874 struct adm1026_data *data = i2c_get_clientdata(client); 875 struct adm1026_data *data = i2c_get_clientdata(client);
875 int val = simple_strtol(buf, NULL, 10); 876 int val = simple_strtol(buf, NULL, 10);
876 877
877 down(&data->update_lock); 878 mutex_lock(&data->update_lock);
878 data->fan_min[nr] = FAN_TO_REG(val, data->fan_div[nr]); 879 data->fan_min[nr] = FAN_TO_REG(val, data->fan_div[nr]);
879 adm1026_write_value(client, ADM1026_REG_FAN_MIN(nr), 880 adm1026_write_value(client, ADM1026_REG_FAN_MIN(nr),
880 data->fan_min[nr]); 881 data->fan_min[nr]);
881 up(&data->update_lock); 882 mutex_unlock(&data->update_lock);
882 return count; 883 return count;
883} 884}
884 885
@@ -939,7 +940,7 @@ static ssize_t set_fan_div(struct device *dev, struct device_attribute *attr,
939 if (new_div == 0) { 940 if (new_div == 0) {
940 return -EINVAL; 941 return -EINVAL;
941 } 942 }
942 down(&data->update_lock); 943 mutex_lock(&data->update_lock);
943 orig_div = data->fan_div[nr]; 944 orig_div = data->fan_div[nr];
944 data->fan_div[nr] = DIV_FROM_REG(new_div); 945 data->fan_div[nr] = DIV_FROM_REG(new_div);
945 946
@@ -958,7 +959,7 @@ static ssize_t set_fan_div(struct device *dev, struct device_attribute *attr,
958 if (data->fan_div[nr] != orig_div) { 959 if (data->fan_div[nr] != orig_div) {
959 fixup_fan_min(dev,nr,orig_div); 960 fixup_fan_min(dev,nr,orig_div);
960 } 961 }
961 up(&data->update_lock); 962 mutex_unlock(&data->update_lock);
962 return count; 963 return count;
963} 964}
964 965
@@ -1001,11 +1002,11 @@ static ssize_t set_temp_min(struct device *dev, struct device_attribute *attr,
1001 struct adm1026_data *data = i2c_get_clientdata(client); 1002 struct adm1026_data *data = i2c_get_clientdata(client);
1002 int val = simple_strtol(buf, NULL, 10); 1003 int val = simple_strtol(buf, NULL, 10);
1003 1004
1004 down(&data->update_lock); 1005 mutex_lock(&data->update_lock);
1005 data->temp_min[nr] = TEMP_TO_REG(val); 1006 data->temp_min[nr] = TEMP_TO_REG(val);
1006 adm1026_write_value(client, ADM1026_REG_TEMP_MIN[nr], 1007 adm1026_write_value(client, ADM1026_REG_TEMP_MIN[nr],
1007 data->temp_min[nr]); 1008 data->temp_min[nr]);
1008 up(&data->update_lock); 1009 mutex_unlock(&data->update_lock);
1009 return count; 1010 return count;
1010} 1011}
1011static ssize_t show_temp_max(struct device *dev, struct device_attribute *attr, 1012static ssize_t show_temp_max(struct device *dev, struct device_attribute *attr,
@@ -1025,11 +1026,11 @@ static ssize_t set_temp_max(struct device *dev, struct device_attribute *attr,
1025 struct adm1026_data *data = i2c_get_clientdata(client); 1026 struct adm1026_data *data = i2c_get_clientdata(client);
1026 int val = simple_strtol(buf, NULL, 10); 1027 int val = simple_strtol(buf, NULL, 10);
1027 1028
1028 down(&data->update_lock); 1029 mutex_lock(&data->update_lock);
1029 data->temp_max[nr] = TEMP_TO_REG(val); 1030 data->temp_max[nr] = TEMP_TO_REG(val);
1030 adm1026_write_value(client, ADM1026_REG_TEMP_MAX[nr], 1031 adm1026_write_value(client, ADM1026_REG_TEMP_MAX[nr],
1031 data->temp_max[nr]); 1032 data->temp_max[nr]);
1032 up(&data->update_lock); 1033 mutex_unlock(&data->update_lock);
1033 return count; 1034 return count;
1034} 1035}
1035 1036
@@ -1064,11 +1065,11 @@ static ssize_t set_temp_offset(struct device *dev,
1064 struct adm1026_data *data = i2c_get_clientdata(client); 1065 struct adm1026_data *data = i2c_get_clientdata(client);
1065 int val = simple_strtol(buf, NULL, 10); 1066 int val = simple_strtol(buf, NULL, 10);
1066 1067
1067 down(&data->update_lock); 1068 mutex_lock(&data->update_lock);
1068 data->temp_offset[nr] = TEMP_TO_REG(val); 1069 data->temp_offset[nr] = TEMP_TO_REG(val);
1069 adm1026_write_value(client, ADM1026_REG_TEMP_OFFSET[nr], 1070 adm1026_write_value(client, ADM1026_REG_TEMP_OFFSET[nr],
1070 data->temp_offset[nr]); 1071 data->temp_offset[nr]);
1071 up(&data->update_lock); 1072 mutex_unlock(&data->update_lock);
1072 return count; 1073 return count;
1073} 1074}
1074 1075
@@ -1115,11 +1116,11 @@ static ssize_t set_temp_auto_point1_temp(struct device *dev,
1115 struct adm1026_data *data = i2c_get_clientdata(client); 1116 struct adm1026_data *data = i2c_get_clientdata(client);
1116 int val = simple_strtol(buf, NULL, 10); 1117 int val = simple_strtol(buf, NULL, 10);
1117 1118
1118 down(&data->update_lock); 1119 mutex_lock(&data->update_lock);
1119 data->temp_tmin[nr] = TEMP_TO_REG(val); 1120 data->temp_tmin[nr] = TEMP_TO_REG(val);
1120 adm1026_write_value(client, ADM1026_REG_TEMP_TMIN[nr], 1121 adm1026_write_value(client, ADM1026_REG_TEMP_TMIN[nr],
1121 data->temp_tmin[nr]); 1122 data->temp_tmin[nr]);
1122 up(&data->update_lock); 1123 mutex_unlock(&data->update_lock);
1123 return count; 1124 return count;
1124} 1125}
1125 1126
@@ -1150,11 +1151,11 @@ static ssize_t set_temp_crit_enable(struct device *dev,
1150 int val = simple_strtol(buf, NULL, 10); 1151 int val = simple_strtol(buf, NULL, 10);
1151 1152
1152 if ((val == 1) || (val==0)) { 1153 if ((val == 1) || (val==0)) {
1153 down(&data->update_lock); 1154 mutex_lock(&data->update_lock);
1154 data->config1 = (data->config1 & ~CFG1_THERM_HOT) | (val << 4); 1155 data->config1 = (data->config1 & ~CFG1_THERM_HOT) | (val << 4);
1155 adm1026_write_value(client, ADM1026_REG_CONFIG1, 1156 adm1026_write_value(client, ADM1026_REG_CONFIG1,
1156 data->config1); 1157 data->config1);
1157 up(&data->update_lock); 1158 mutex_unlock(&data->update_lock);
1158 } 1159 }
1159 return count; 1160 return count;
1160} 1161}
@@ -1184,11 +1185,11 @@ static ssize_t set_temp_crit(struct device *dev, struct device_attribute *attr,
1184 struct adm1026_data *data = i2c_get_clientdata(client); 1185 struct adm1026_data *data = i2c_get_clientdata(client);
1185 int val = simple_strtol(buf, NULL, 10); 1186 int val = simple_strtol(buf, NULL, 10);
1186 1187
1187 down(&data->update_lock); 1188 mutex_lock(&data->update_lock);
1188 data->temp_crit[nr] = TEMP_TO_REG(val); 1189 data->temp_crit[nr] = TEMP_TO_REG(val);
1189 adm1026_write_value(client, ADM1026_REG_TEMP_THERM[nr], 1190 adm1026_write_value(client, ADM1026_REG_TEMP_THERM[nr],
1190 data->temp_crit[nr]); 1191 data->temp_crit[nr]);
1191 up(&data->update_lock); 1192 mutex_unlock(&data->update_lock);
1192 return count; 1193 return count;
1193} 1194}
1194 1195
@@ -1212,10 +1213,10 @@ static ssize_t set_analog_out_reg(struct device *dev, struct device_attribute *a
1212 struct adm1026_data *data = i2c_get_clientdata(client); 1213 struct adm1026_data *data = i2c_get_clientdata(client);
1213 int val = simple_strtol(buf, NULL, 10); 1214 int val = simple_strtol(buf, NULL, 10);
1214 1215
1215 down(&data->update_lock); 1216 mutex_lock(&data->update_lock);
1216 data->analog_out = DAC_TO_REG(val); 1217 data->analog_out = DAC_TO_REG(val);
1217 adm1026_write_value(client, ADM1026_REG_DAC, data->analog_out); 1218 adm1026_write_value(client, ADM1026_REG_DAC, data->analog_out);
1218 up(&data->update_lock); 1219 mutex_unlock(&data->update_lock);
1219 return count; 1220 return count;
1220} 1221}
1221 1222
@@ -1267,7 +1268,7 @@ static ssize_t set_alarm_mask(struct device *dev, struct device_attribute *attr,
1267 int val = simple_strtol(buf, NULL, 10); 1268 int val = simple_strtol(buf, NULL, 10);
1268 unsigned long mask; 1269 unsigned long mask;
1269 1270
1270 down(&data->update_lock); 1271 mutex_lock(&data->update_lock);
1271 data->alarm_mask = val & 0x7fffffff; 1272 data->alarm_mask = val & 0x7fffffff;
1272 mask = data->alarm_mask 1273 mask = data->alarm_mask
1273 | (data->gpio_mask & 0x10000 ? 0x80000000 : 0); 1274 | (data->gpio_mask & 0x10000 ? 0x80000000 : 0);
@@ -1282,7 +1283,7 @@ static ssize_t set_alarm_mask(struct device *dev, struct device_attribute *attr,
1282 mask >>= 8; 1283 mask >>= 8;
1283 adm1026_write_value(client, ADM1026_REG_MASK4, 1284 adm1026_write_value(client, ADM1026_REG_MASK4,
1284 mask & 0xff); 1285 mask & 0xff);
1285 up(&data->update_lock); 1286 mutex_unlock(&data->update_lock);
1286 return count; 1287 return count;
1287} 1288}
1288 1289
@@ -1303,7 +1304,7 @@ static ssize_t set_gpio(struct device *dev, struct device_attribute *attr, const
1303 int val = simple_strtol(buf, NULL, 10); 1304 int val = simple_strtol(buf, NULL, 10);
1304 long gpio; 1305 long gpio;
1305 1306
1306 down(&data->update_lock); 1307 mutex_lock(&data->update_lock);
1307 data->gpio = val & 0x1ffff; 1308 data->gpio = val & 0x1ffff;
1308 gpio = data->gpio; 1309 gpio = data->gpio;
1309 adm1026_write_value(client, ADM1026_REG_GPIO_STATUS_0_7,gpio & 0xff); 1310 adm1026_write_value(client, ADM1026_REG_GPIO_STATUS_0_7,gpio & 0xff);
@@ -1311,7 +1312,7 @@ static ssize_t set_gpio(struct device *dev, struct device_attribute *attr, const
1311 adm1026_write_value(client, ADM1026_REG_GPIO_STATUS_8_15,gpio & 0xff); 1312 adm1026_write_value(client, ADM1026_REG_GPIO_STATUS_8_15,gpio & 0xff);
1312 gpio = ((gpio >> 1) & 0x80) | (data->alarms >> 24 & 0x7f); 1313 gpio = ((gpio >> 1) & 0x80) | (data->alarms >> 24 & 0x7f);
1313 adm1026_write_value(client, ADM1026_REG_STATUS4,gpio & 0xff); 1314 adm1026_write_value(client, ADM1026_REG_STATUS4,gpio & 0xff);
1314 up(&data->update_lock); 1315 mutex_unlock(&data->update_lock);
1315 return count; 1316 return count;
1316} 1317}
1317 1318
@@ -1331,7 +1332,7 @@ static ssize_t set_gpio_mask(struct device *dev, struct device_attribute *attr,
1331 int val = simple_strtol(buf, NULL, 10); 1332 int val = simple_strtol(buf, NULL, 10);
1332 long mask; 1333 long mask;
1333 1334
1334 down(&data->update_lock); 1335 mutex_lock(&data->update_lock);
1335 data->gpio_mask = val & 0x1ffff; 1336 data->gpio_mask = val & 0x1ffff;
1336 mask = data->gpio_mask; 1337 mask = data->gpio_mask;
1337 adm1026_write_value(client, ADM1026_REG_GPIO_MASK_0_7,mask & 0xff); 1338 adm1026_write_value(client, ADM1026_REG_GPIO_MASK_0_7,mask & 0xff);
@@ -1339,7 +1340,7 @@ static ssize_t set_gpio_mask(struct device *dev, struct device_attribute *attr,
1339 adm1026_write_value(client, ADM1026_REG_GPIO_MASK_8_15,mask & 0xff); 1340 adm1026_write_value(client, ADM1026_REG_GPIO_MASK_8_15,mask & 0xff);
1340 mask = ((mask >> 1) & 0x80) | (data->alarm_mask >> 24 & 0x7f); 1341 mask = ((mask >> 1) & 0x80) | (data->alarm_mask >> 24 & 0x7f);
1341 adm1026_write_value(client, ADM1026_REG_MASK1,mask & 0xff); 1342 adm1026_write_value(client, ADM1026_REG_MASK1,mask & 0xff);
1342 up(&data->update_lock); 1343 mutex_unlock(&data->update_lock);
1343 return count; 1344 return count;
1344} 1345}
1345 1346
@@ -1359,10 +1360,10 @@ static ssize_t set_pwm_reg(struct device *dev, struct device_attribute *attr, co
1359 if (data->pwm1.enable == 1) { 1360 if (data->pwm1.enable == 1) {
1360 int val = simple_strtol(buf, NULL, 10); 1361 int val = simple_strtol(buf, NULL, 10);
1361 1362
1362 down(&data->update_lock); 1363 mutex_lock(&data->update_lock);
1363 data->pwm1.pwm = PWM_TO_REG(val); 1364 data->pwm1.pwm = PWM_TO_REG(val);
1364 adm1026_write_value(client, ADM1026_REG_PWM, data->pwm1.pwm); 1365 adm1026_write_value(client, ADM1026_REG_PWM, data->pwm1.pwm);
1365 up(&data->update_lock); 1366 mutex_unlock(&data->update_lock);
1366 } 1367 }
1367 return count; 1368 return count;
1368} 1369}
@@ -1378,14 +1379,14 @@ static ssize_t set_auto_pwm_min(struct device *dev, struct device_attribute *att
1378 struct adm1026_data *data = i2c_get_clientdata(client); 1379 struct adm1026_data *data = i2c_get_clientdata(client);
1379 int val = simple_strtol(buf, NULL, 10); 1380 int val = simple_strtol(buf, NULL, 10);
1380 1381
1381 down(&data->update_lock); 1382 mutex_lock(&data->update_lock);
1382 data->pwm1.auto_pwm_min = SENSORS_LIMIT(val,0,255); 1383 data->pwm1.auto_pwm_min = SENSORS_LIMIT(val,0,255);
1383 if (data->pwm1.enable == 2) { /* apply immediately */ 1384 if (data->pwm1.enable == 2) { /* apply immediately */
1384 data->pwm1.pwm = PWM_TO_REG((data->pwm1.pwm & 0x0f) | 1385 data->pwm1.pwm = PWM_TO_REG((data->pwm1.pwm & 0x0f) |
1385 PWM_MIN_TO_REG(data->pwm1.auto_pwm_min)); 1386 PWM_MIN_TO_REG(data->pwm1.auto_pwm_min));
1386 adm1026_write_value(client, ADM1026_REG_PWM, data->pwm1.pwm); 1387 adm1026_write_value(client, ADM1026_REG_PWM, data->pwm1.pwm);
1387 } 1388 }
1388 up(&data->update_lock); 1389 mutex_unlock(&data->update_lock);
1389 return count; 1390 return count;
1390} 1391}
1391static ssize_t show_auto_pwm_max(struct device *dev, struct device_attribute *attr, char *buf) 1392static ssize_t show_auto_pwm_max(struct device *dev, struct device_attribute *attr, char *buf)
@@ -1406,7 +1407,7 @@ static ssize_t set_pwm_enable(struct device *dev, struct device_attribute *attr,
1406 int old_enable; 1407 int old_enable;
1407 1408
1408 if ((val >= 0) && (val < 3)) { 1409 if ((val >= 0) && (val < 3)) {
1409 down(&data->update_lock); 1410 mutex_lock(&data->update_lock);
1410 old_enable = data->pwm1.enable; 1411 old_enable = data->pwm1.enable;
1411 data->pwm1.enable = val; 1412 data->pwm1.enable = val;
1412 data->config1 = (data->config1 & ~CFG1_PWM_AFC) 1413 data->config1 = (data->config1 & ~CFG1_PWM_AFC)
@@ -1424,7 +1425,7 @@ static ssize_t set_pwm_enable(struct device *dev, struct device_attribute *attr,
1424 adm1026_write_value(client, ADM1026_REG_PWM, 1425 adm1026_write_value(client, ADM1026_REG_PWM,
1425 data->pwm1.pwm); 1426 data->pwm1.pwm);
1426 } 1427 }
1427 up(&data->update_lock); 1428 mutex_unlock(&data->update_lock);
1428 } 1429 }
1429 return count; 1430 return count;
1430} 1431}
@@ -1541,7 +1542,7 @@ static int adm1026_detect(struct i2c_adapter *adapter, int address,
1541 /* Fill in the remaining client fields */ 1542 /* Fill in the remaining client fields */
1542 data->type = kind; 1543 data->type = kind;
1543 data->valid = 0; 1544 data->valid = 0;
1544 init_MUTEX(&data->update_lock); 1545 mutex_init(&data->update_lock);
1545 1546
1546 /* Tell the I2C layer a new client has arrived */ 1547 /* Tell the I2C layer a new client has arrived */
1547 if ((err = i2c_attach_client(new_client))) 1548 if ((err = i2c_attach_client(new_client)))