Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 222139
b: refs/heads/master
c: 2a2d27d
h: refs/heads/master
i:
  222137: d102181
  222135: c373778
v: v3
  • Loading branch information
Jean Delvare authored and Jean Delvare committed Nov 15, 2010
1 parent 72991e4 commit 0d02be2
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 11 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: edff2f8d81ce976ad6895f1d649fcb164be80e3d
refs/heads/master: 2a2d27da00250c9f117e35653ed5a6a3212e5d77
30 changes: 20 additions & 10 deletions trunk/drivers/hwmon/w83795.c
Original file line number Diff line number Diff line change
Expand Up @@ -966,17 +966,18 @@ show_temp_src(struct device *dev, struct device_attribute *attr, char *buf)
to_sensor_dev_attr_2(attr);
struct w83795_data *data = w83795_update_pwm_config(dev);
int index = sensor_attr->index;
u8 val = index / 2;
u8 tmp = data->temp_src[val];
u8 tmp = data->temp_src[index / 2];

if (index & 1)
val = 4;
tmp >>= 4; /* Pick high nibble */
else
val = 0;
tmp >>= val;
tmp &= 0x0f;
tmp &= 0x0f; /* Pick low nibble */

return sprintf(buf, "%u\n", tmp);
/* Look-up the actual temperature channel number */
if (tmp >= 4 || tss_map[tmp][index] == TSS_MAP_RESERVED)
return -EINVAL; /* Shouldn't happen */

return sprintf(buf, "%u\n", (unsigned int)tss_map[tmp][index] + 1);
}

static ssize_t
Expand All @@ -988,12 +989,21 @@ store_temp_src(struct device *dev, struct device_attribute *attr,
struct sensor_device_attribute_2 *sensor_attr =
to_sensor_dev_attr_2(attr);
int index = sensor_attr->index;
unsigned long tmp;
int tmp;
unsigned long channel;
u8 val = index / 2;

if (strict_strtoul(buf, 10, &tmp) < 0)
if (strict_strtoul(buf, 10, &channel) < 0 ||
channel < 1 || channel > 14)
return -EINVAL;

/* Check if request can be fulfilled */
for (tmp = 0; tmp < 4; tmp++) {
if (tss_map[tmp][index] == channel - 1)
break;
}
if (tmp == 4) /* No match */
return -EINVAL;
tmp = SENSORS_LIMIT(tmp, 0, 15);

mutex_lock(&data->update_lock);
if (index & 1) {
Expand Down

0 comments on commit 0d02be2

Please sign in to comment.