Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 299180
b: refs/heads/master
c: d7ee111
h: refs/heads/master
v: v3
  • Loading branch information
Guenter Roeck authored and Guenter Roeck committed Apr 9, 2012
1 parent cd518a0 commit 5b34396
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 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: 1d0045ee4a220872b65147b5b290e4a4852386d9
refs/heads/master: d7ee11157f1fce02632e2f3a56b99b2afd9e5f93
17 changes: 8 additions & 9 deletions trunk/drivers/hwmon/pmbus/pmbus_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -710,13 +710,13 @@ static u16 pmbus_data2reg(struct pmbus_data *data,
* If a negative value is stored in any of the referenced registers, this value
* reflects an error code which will be returned.
*/
static int pmbus_get_boolean(struct pmbus_data *data, int index, int *val)
static int pmbus_get_boolean(struct pmbus_data *data, int index)
{
u8 s1 = (index >> 24) & 0xff;
u8 s2 = (index >> 16) & 0xff;
u8 reg = (index >> 8) & 0xff;
u8 mask = index & 0xff;
int status;
int ret, status;
u8 regval;

status = data->status[reg];
Expand All @@ -725,7 +725,7 @@ static int pmbus_get_boolean(struct pmbus_data *data, int index, int *val)

regval = status & mask;
if (!s1 && !s2)
*val = !!regval;
ret = !!regval;
else {
long v1, v2;
struct pmbus_sensor *sensor1, *sensor2;
Expand All @@ -739,9 +739,9 @@ static int pmbus_get_boolean(struct pmbus_data *data, int index, int *val)

v1 = pmbus_reg2data(data, sensor1);
v2 = pmbus_reg2data(data, sensor2);
*val = !!(regval && v1 >= v2);
ret = !!(regval && v1 >= v2);
}
return 0;
return ret;
}

static ssize_t pmbus_show_boolean(struct device *dev,
Expand All @@ -750,11 +750,10 @@ static ssize_t pmbus_show_boolean(struct device *dev,
struct sensor_device_attribute *attr = to_sensor_dev_attr(da);
struct pmbus_data *data = pmbus_update_device(dev);
int val;
int err;

err = pmbus_get_boolean(data, attr->index, &val);
if (err)
return err;
val = pmbus_get_boolean(data, attr->index);
if (val < 0)
return val;
return snprintf(buf, PAGE_SIZE, "%d\n", val);
}

Expand Down

0 comments on commit 5b34396

Please sign in to comment.