aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorChristian Hohnstaedt <chohnstaedt@innominate.com>2007-08-16 05:40:10 -0400
committerMark M. Hoffman <mhoffman@lightlink.com>2007-10-09 22:56:29 -0400
commit5bfedac045082a97e20d47d876071279ef984d28 (patch)
treec6432db00589d4858ca1b4a04624dc74be5ba181 /drivers
parentdcf3b5fb7fb6e1b56bfaf705e665b04870213768 (diff)
hwmon: Allow writing of negative trigger temperatures
- replace differing temperature variable types by long - use strtol() instead of strtoul() for conversion Signed-off-by: Christian Hohnstaedt <chohnstaedt@innominate.com> Acked-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Mark M. Hoffman <mhoffman@lightlink.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/hwmon/ad7418.c2
-rw-r--r--drivers/hwmon/adm1021.c2
-rw-r--r--drivers/hwmon/asb100.c4
-rw-r--r--drivers/hwmon/ds1621.c2
-rw-r--r--drivers/hwmon/lm75.c2
-rw-r--r--drivers/hwmon/lm75.h2
-rw-r--r--drivers/hwmon/lm77.c2
-rw-r--r--drivers/hwmon/lm93.c10
-rw-r--r--drivers/hwmon/w83627ehf.c6
-rw-r--r--drivers/hwmon/w83627hf.c6
-rw-r--r--drivers/hwmon/w83781d.c2
11 files changed, 20 insertions, 20 deletions
diff --git a/drivers/hwmon/ad7418.c b/drivers/hwmon/ad7418.c
index cc8b624a1e51..879ea72ee3bd 100644
--- a/drivers/hwmon/ad7418.c
+++ b/drivers/hwmon/ad7418.c
@@ -172,7 +172,7 @@ static ssize_t set_temp(struct device *dev, struct device_attribute *devattr,
172 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); 172 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
173 struct i2c_client *client = to_i2c_client(dev); 173 struct i2c_client *client = to_i2c_client(dev);
174 struct ad7418_data *data = i2c_get_clientdata(client); 174 struct ad7418_data *data = i2c_get_clientdata(client);
175 int temp = simple_strtol(buf, NULL, 10); 175 long temp = simple_strtol(buf, NULL, 10);
176 176
177 mutex_lock(&data->lock); 177 mutex_lock(&data->lock);
178 data->temp[attr->index] = LM75_TEMP_TO_REG(temp); 178 data->temp[attr->index] = LM75_TEMP_TO_REG(temp);
diff --git a/drivers/hwmon/adm1021.c b/drivers/hwmon/adm1021.c
index 5418a675bb60..6649e0688361 100644
--- a/drivers/hwmon/adm1021.c
+++ b/drivers/hwmon/adm1021.c
@@ -162,7 +162,7 @@ static ssize_t set_##value(struct device *dev, \
162{ \ 162{ \
163 struct i2c_client *client = to_i2c_client(dev); \ 163 struct i2c_client *client = to_i2c_client(dev); \
164 struct adm1021_data *data = i2c_get_clientdata(client); \ 164 struct adm1021_data *data = i2c_get_clientdata(client); \
165 int temp = simple_strtoul(buf, NULL, 10); \ 165 long temp = simple_strtol(buf, NULL, 10); \
166 \ 166 \
167 mutex_lock(&data->update_lock); \ 167 mutex_lock(&data->update_lock); \
168 data->value = TEMP_TO_REG(temp); \ 168 data->value = TEMP_TO_REG(temp); \
diff --git a/drivers/hwmon/asb100.c b/drivers/hwmon/asb100.c
index 57b1c7b7ac3f..55d92e1e27d1 100644
--- a/drivers/hwmon/asb100.c
+++ b/drivers/hwmon/asb100.c
@@ -143,7 +143,7 @@ static int FAN_FROM_REG(u8 val, int div)
143 143
144/* TEMP: 0.001C/bit (-128C to +127C) 144/* TEMP: 0.001C/bit (-128C to +127C)
145 REG: 1C/bit, two's complement */ 145 REG: 1C/bit, two's complement */
146static u8 TEMP_TO_REG(int temp) 146static u8 TEMP_TO_REG(long temp)
147{ 147{
148 int ntemp = SENSORS_LIMIT(temp, ASB100_TEMP_MIN, ASB100_TEMP_MAX); 148 int ntemp = SENSORS_LIMIT(temp, ASB100_TEMP_MIN, ASB100_TEMP_MAX);
149 ntemp += (ntemp<0 ? -500 : 500); 149 ntemp += (ntemp<0 ? -500 : 500);
@@ -448,7 +448,7 @@ static ssize_t set_##reg(struct device *dev, const char *buf, \
448{ \ 448{ \
449 struct i2c_client *client = to_i2c_client(dev); \ 449 struct i2c_client *client = to_i2c_client(dev); \
450 struct asb100_data *data = i2c_get_clientdata(client); \ 450 struct asb100_data *data = i2c_get_clientdata(client); \
451 unsigned long val = simple_strtoul(buf, NULL, 10); \ 451 long val = simple_strtol(buf, NULL, 10); \
452 \ 452 \
453 mutex_lock(&data->update_lock); \ 453 mutex_lock(&data->update_lock); \
454 switch (nr) { \ 454 switch (nr) { \
diff --git a/drivers/hwmon/ds1621.c b/drivers/hwmon/ds1621.c
index 1212d6b7f316..5a861f936120 100644
--- a/drivers/hwmon/ds1621.c
+++ b/drivers/hwmon/ds1621.c
@@ -151,7 +151,7 @@ static ssize_t set_temp(struct device *dev, struct device_attribute *da,
151 struct sensor_device_attribute *attr = to_sensor_dev_attr(da); 151 struct sensor_device_attribute *attr = to_sensor_dev_attr(da);
152 struct i2c_client *client = to_i2c_client(dev); 152 struct i2c_client *client = to_i2c_client(dev);
153 struct ds1621_data *data = ds1621_update_client(dev); 153 struct ds1621_data *data = ds1621_update_client(dev);
154 u16 val = LM75_TEMP_TO_REG(simple_strtoul(buf, NULL, 10)); 154 u16 val = LM75_TEMP_TO_REG(simple_strtol(buf, NULL, 10));
155 155
156 mutex_lock(&data->update_lock); 156 mutex_lock(&data->update_lock);
157 data->temp[attr->index] = val; 157 data->temp[attr->index] = val;
diff --git a/drivers/hwmon/lm75.c b/drivers/hwmon/lm75.c
index a40166ffad12..4fa32205e44c 100644
--- a/drivers/hwmon/lm75.c
+++ b/drivers/hwmon/lm75.c
@@ -95,7 +95,7 @@ static ssize_t set_temp(struct device *dev, struct device_attribute *da,
95 struct i2c_client *client = to_i2c_client(dev); 95 struct i2c_client *client = to_i2c_client(dev);
96 struct lm75_data *data = i2c_get_clientdata(client); 96 struct lm75_data *data = i2c_get_clientdata(client);
97 int nr = attr->index; 97 int nr = attr->index;
98 unsigned long temp = simple_strtoul(buf, NULL, 10); 98 long temp = simple_strtol(buf, NULL, 10);
99 99
100 mutex_lock(&data->update_lock); 100 mutex_lock(&data->update_lock);
101 data->temp[nr] = LM75_TEMP_TO_REG(temp); 101 data->temp[nr] = LM75_TEMP_TO_REG(temp);
diff --git a/drivers/hwmon/lm75.h b/drivers/hwmon/lm75.h
index af7dc650ee15..7c93454bb4e3 100644
--- a/drivers/hwmon/lm75.h
+++ b/drivers/hwmon/lm75.h
@@ -33,7 +33,7 @@
33 33
34/* TEMP: 0.001C/bit (-55C to +125C) 34/* TEMP: 0.001C/bit (-55C to +125C)
35 REG: (0.5C/bit, two's complement) << 7 */ 35 REG: (0.5C/bit, two's complement) << 7 */
36static inline u16 LM75_TEMP_TO_REG(int temp) 36static inline u16 LM75_TEMP_TO_REG(long temp)
37{ 37{
38 int ntemp = SENSORS_LIMIT(temp, LM75_TEMP_MIN, LM75_TEMP_MAX); 38 int ntemp = SENSORS_LIMIT(temp, LM75_TEMP_MIN, LM75_TEMP_MAX);
39 ntemp += (ntemp<0 ? -250 : 250); 39 ntemp += (ntemp<0 ? -250 : 250);
diff --git a/drivers/hwmon/lm77.c b/drivers/hwmon/lm77.c
index dd969f1e8415..46e3abad7206 100644
--- a/drivers/hwmon/lm77.c
+++ b/drivers/hwmon/lm77.c
@@ -138,7 +138,7 @@ static ssize_t set_##value(struct device *dev, struct device_attribute *attr, co
138{ \ 138{ \
139 struct i2c_client *client = to_i2c_client(dev); \ 139 struct i2c_client *client = to_i2c_client(dev); \
140 struct lm77_data *data = i2c_get_clientdata(client); \ 140 struct lm77_data *data = i2c_get_clientdata(client); \
141 long val = simple_strtoul(buf, NULL, 10); \ 141 long val = simple_strtol(buf, NULL, 10); \
142 \ 142 \
143 mutex_lock(&data->update_lock); \ 143 mutex_lock(&data->update_lock); \
144 data->value = val; \ 144 data->value = val; \
diff --git a/drivers/hwmon/lm93.c b/drivers/hwmon/lm93.c
index d84f8bf6f284..86c6c6ea0745 100644
--- a/drivers/hwmon/lm93.c
+++ b/drivers/hwmon/lm93.c
@@ -413,7 +413,7 @@ static int LM93_TEMP_FROM_REG(u8 reg)
413 413
414/* TEMP: 1/1000 degrees C (-128C to +127C) 414/* TEMP: 1/1000 degrees C (-128C to +127C)
415 REG: 1C/bit, two's complement */ 415 REG: 1C/bit, two's complement */
416static u8 LM93_TEMP_TO_REG(int temp) 416static u8 LM93_TEMP_TO_REG(long temp)
417{ 417{
418 int ntemp = SENSORS_LIMIT(temp, LM93_TEMP_MIN, LM93_TEMP_MAX); 418 int ntemp = SENSORS_LIMIT(temp, LM93_TEMP_MIN, LM93_TEMP_MAX);
419 ntemp += (ntemp<0 ? -500 : 500); 419 ntemp += (ntemp<0 ? -500 : 500);
@@ -1268,7 +1268,7 @@ static ssize_t store_temp_min(struct device *dev, struct device_attribute *attr,
1268 int nr = (to_sensor_dev_attr(attr))->index; 1268 int nr = (to_sensor_dev_attr(attr))->index;
1269 struct i2c_client *client = to_i2c_client(dev); 1269 struct i2c_client *client = to_i2c_client(dev);
1270 struct lm93_data *data = i2c_get_clientdata(client); 1270 struct lm93_data *data = i2c_get_clientdata(client);
1271 u32 val = simple_strtoul(buf, NULL, 10); 1271 long val = simple_strtol(buf, NULL, 10);
1272 1272
1273 mutex_lock(&data->update_lock); 1273 mutex_lock(&data->update_lock);
1274 data->temp_lim[nr].min = LM93_TEMP_TO_REG(val); 1274 data->temp_lim[nr].min = LM93_TEMP_TO_REG(val);
@@ -1298,7 +1298,7 @@ static ssize_t store_temp_max(struct device *dev, struct device_attribute *attr,
1298 int nr = (to_sensor_dev_attr(attr))->index; 1298 int nr = (to_sensor_dev_attr(attr))->index;
1299 struct i2c_client *client = to_i2c_client(dev); 1299 struct i2c_client *client = to_i2c_client(dev);
1300 struct lm93_data *data = i2c_get_clientdata(client); 1300 struct lm93_data *data = i2c_get_clientdata(client);
1301 u32 val = simple_strtoul(buf, NULL, 10); 1301 long val = simple_strtol(buf, NULL, 10);
1302 1302
1303 mutex_lock(&data->update_lock); 1303 mutex_lock(&data->update_lock);
1304 data->temp_lim[nr].max = LM93_TEMP_TO_REG(val); 1304 data->temp_lim[nr].max = LM93_TEMP_TO_REG(val);
@@ -1329,7 +1329,7 @@ static ssize_t store_temp_auto_base(struct device *dev,
1329 int nr = (to_sensor_dev_attr(attr))->index; 1329 int nr = (to_sensor_dev_attr(attr))->index;
1330 struct i2c_client *client = to_i2c_client(dev); 1330 struct i2c_client *client = to_i2c_client(dev);
1331 struct lm93_data *data = i2c_get_clientdata(client); 1331 struct lm93_data *data = i2c_get_clientdata(client);
1332 u32 val = simple_strtoul(buf, NULL, 10); 1332 long val = simple_strtol(buf, NULL, 10);
1333 1333
1334 mutex_lock(&data->update_lock); 1334 mutex_lock(&data->update_lock);
1335 data->block10.base[nr] = LM93_TEMP_TO_REG(val); 1335 data->block10.base[nr] = LM93_TEMP_TO_REG(val);
@@ -1360,7 +1360,7 @@ static ssize_t store_temp_auto_boost(struct device *dev,
1360 int nr = (to_sensor_dev_attr(attr))->index; 1360 int nr = (to_sensor_dev_attr(attr))->index;
1361 struct i2c_client *client = to_i2c_client(dev); 1361 struct i2c_client *client = to_i2c_client(dev);
1362 struct lm93_data *data = i2c_get_clientdata(client); 1362 struct lm93_data *data = i2c_get_clientdata(client);
1363 u32 val = simple_strtoul(buf, NULL, 10); 1363 long val = simple_strtol(buf, NULL, 10);
1364 1364
1365 mutex_lock(&data->update_lock); 1365 mutex_lock(&data->update_lock);
1366 data->boost[nr] = LM93_TEMP_TO_REG(val); 1366 data->boost[nr] = LM93_TEMP_TO_REG(val);
diff --git a/drivers/hwmon/w83627ehf.c b/drivers/hwmon/w83627ehf.c
index d9a9ec7dd84a..e3dfc52b5995 100644
--- a/drivers/hwmon/w83627ehf.c
+++ b/drivers/hwmon/w83627ehf.c
@@ -223,7 +223,7 @@ temp1_from_reg(s8 reg)
223} 223}
224 224
225static inline s8 225static inline s8
226temp1_to_reg(int temp, int min, int max) 226temp1_to_reg(long temp, int min, int max)
227{ 227{
228 if (temp <= min) 228 if (temp <= min)
229 return min / 1000; 229 return min / 1000;
@@ -805,7 +805,7 @@ store_temp1_##reg(struct device *dev, struct device_attribute *attr, \
805 const char *buf, size_t count) \ 805 const char *buf, size_t count) \
806{ \ 806{ \
807 struct w83627ehf_data *data = dev_get_drvdata(dev); \ 807 struct w83627ehf_data *data = dev_get_drvdata(dev); \
808 u32 val = simple_strtoul(buf, NULL, 10); \ 808 long val = simple_strtol(buf, NULL, 10); \
809 \ 809 \
810 mutex_lock(&data->update_lock); \ 810 mutex_lock(&data->update_lock); \
811 data->temp1_##reg = temp1_to_reg(val, -128000, 127000); \ 811 data->temp1_##reg = temp1_to_reg(val, -128000, 127000); \
@@ -840,7 +840,7 @@ store_##reg(struct device *dev, struct device_attribute *attr, \
840 struct w83627ehf_data *data = dev_get_drvdata(dev); \ 840 struct w83627ehf_data *data = dev_get_drvdata(dev); \
841 struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); \ 841 struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); \
842 int nr = sensor_attr->index; \ 842 int nr = sensor_attr->index; \
843 u32 val = simple_strtoul(buf, NULL, 10); \ 843 long val = simple_strtol(buf, NULL, 10); \
844 \ 844 \
845 mutex_lock(&data->update_lock); \ 845 mutex_lock(&data->update_lock); \
846 data->reg[nr] = LM75_TEMP_TO_REG(val); \ 846 data->reg[nr] = LM75_TEMP_TO_REG(val); \
diff --git a/drivers/hwmon/w83627hf.c b/drivers/hwmon/w83627hf.c
index 7a4a15f4bf8b..0866739a227c 100644
--- a/drivers/hwmon/w83627hf.c
+++ b/drivers/hwmon/w83627hf.c
@@ -263,7 +263,7 @@ static inline u8 FAN_TO_REG(long rpm, int div)
263 263
264/* TEMP: 0.001C/bit (-128C to +127C) 264/* TEMP: 0.001C/bit (-128C to +127C)
265 REG: 1C/bit, two's complement */ 265 REG: 1C/bit, two's complement */
266static u8 TEMP_TO_REG(int temp) 266static u8 TEMP_TO_REG(long temp)
267{ 267{
268 int ntemp = SENSORS_LIMIT(temp, TEMP_MIN, TEMP_MAX); 268 int ntemp = SENSORS_LIMIT(temp, TEMP_MIN, TEMP_MAX);
269 ntemp += (ntemp<0 ? -500 : 500); 269 ntemp += (ntemp<0 ? -500 : 500);
@@ -642,9 +642,9 @@ static ssize_t \
642store_temp_##reg (struct device *dev, const char *buf, size_t count, int nr) \ 642store_temp_##reg (struct device *dev, const char *buf, size_t count, int nr) \
643{ \ 643{ \
644 struct w83627hf_data *data = dev_get_drvdata(dev); \ 644 struct w83627hf_data *data = dev_get_drvdata(dev); \
645 u32 val; \ 645 long val; \
646 \ 646 \
647 val = simple_strtoul(buf, NULL, 10); \ 647 val = simple_strtol(buf, NULL, 10); \
648 \ 648 \
649 mutex_lock(&data->update_lock); \ 649 mutex_lock(&data->update_lock); \
650 \ 650 \
diff --git a/drivers/hwmon/w83781d.c b/drivers/hwmon/w83781d.c
index dcc941a5aaff..8ed88f3d5767 100644
--- a/drivers/hwmon/w83781d.c
+++ b/drivers/hwmon/w83781d.c
@@ -410,7 +410,7 @@ static ssize_t store_temp_##reg (struct device *dev, \
410 struct sensor_device_attribute *attr = to_sensor_dev_attr(da); \ 410 struct sensor_device_attribute *attr = to_sensor_dev_attr(da); \
411 struct w83781d_data *data = dev_get_drvdata(dev); \ 411 struct w83781d_data *data = dev_get_drvdata(dev); \
412 int nr = attr->index; \ 412 int nr = attr->index; \
413 s32 val; \ 413 long val; \
414 \ 414 \
415 val = simple_strtol(buf, NULL, 10); \ 415 val = simple_strtol(buf, NULL, 10); \
416 \ 416 \