aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/lm93.c
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/hwmon/lm93.c
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/hwmon/lm93.c')
-rw-r--r--drivers/hwmon/lm93.c10
1 files changed, 5 insertions, 5 deletions
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);