Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 68722
b: refs/heads/master
c: 63f281a
h: refs/heads/master
v: v3
  • Loading branch information
Jean Delvare authored and Mark M. Hoffman committed Oct 10, 2007
1 parent 2b27d14 commit 01b940a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 5a4d3ef317c845893fe3f9d3517cb0a99375da53
refs/heads/master: 63f281a6e32ebc93c62dac0d399d8e054eb7b2ec
9 changes: 7 additions & 2 deletions trunk/drivers/hwmon/lm85.c
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,12 @@ static int lm85_scaling[] = { /* .001 Volts */
#define INS_FROM_REG(n,val) SCALE((val), 192, lm85_scaling[n])

/* FAN speed is measured using 90kHz clock */
#define FAN_TO_REG(val) (SENSORS_LIMIT( (val)<=0?0: 5400000/(val),0,65534))
static inline u16 FAN_TO_REG(unsigned long val)
{
if (!val)
return 0xffff;
return SENSORS_LIMIT(5400000 / val, 1, 0xfffe);
}
#define FAN_FROM_REG(val) ((val)==0?-1:(val)==0xffff?0:5400000/(val))

/* Temperature is reported in .001 degC increments */
Expand Down Expand Up @@ -391,7 +396,7 @@ static ssize_t set_fan_min(struct device *dev, struct device_attribute *attr,
int nr = to_sensor_dev_attr(attr)->index;
struct i2c_client *client = to_i2c_client(dev);
struct lm85_data *data = i2c_get_clientdata(client);
long val = simple_strtol(buf, NULL, 10);
unsigned long val = simple_strtoul(buf, NULL, 10);

mutex_lock(&data->update_lock);
data->fan_min[nr] = FAN_TO_REG(val);
Expand Down

0 comments on commit 01b940a

Please sign in to comment.