Skip to content

Commit

Permalink
Merge branch 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/…
Browse files Browse the repository at this point in the history
…kernel/git/groeck/staging

* 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/staging:
  hwmon: (adm1275) Fix coefficients per datasheet revision B
  hwmon: (pmbus) Use long variables for register to data conversions
  • Loading branch information
torvalds committed Jul 15, 2011
2 parents 375d0c0 + 7e97bbb commit 3110df8
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
10 changes: 5 additions & 5 deletions drivers/hwmon/adm1275.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,23 +53,23 @@ static int adm1275_probe(struct i2c_client *client,
info->direct[PSC_VOLTAGE_IN] = true;
info->direct[PSC_VOLTAGE_OUT] = true;
info->direct[PSC_CURRENT_OUT] = true;
info->m[PSC_CURRENT_OUT] = 800;
info->m[PSC_CURRENT_OUT] = 807;
info->b[PSC_CURRENT_OUT] = 20475;
info->R[PSC_CURRENT_OUT] = -1;
info->func[0] = PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT;

if (config & ADM1275_VRANGE) {
info->m[PSC_VOLTAGE_IN] = 19045;
info->m[PSC_VOLTAGE_IN] = 19199;
info->b[PSC_VOLTAGE_IN] = 0;
info->R[PSC_VOLTAGE_IN] = -2;
info->m[PSC_VOLTAGE_OUT] = 19045;
info->m[PSC_VOLTAGE_OUT] = 19199;
info->b[PSC_VOLTAGE_OUT] = 0;
info->R[PSC_VOLTAGE_OUT] = -2;
} else {
info->m[PSC_VOLTAGE_IN] = 6666;
info->m[PSC_VOLTAGE_IN] = 6720;
info->b[PSC_VOLTAGE_IN] = 0;
info->R[PSC_VOLTAGE_IN] = -1;
info->m[PSC_VOLTAGE_OUT] = 6666;
info->m[PSC_VOLTAGE_OUT] = 6720;
info->b[PSC_VOLTAGE_OUT] = 0;
info->R[PSC_VOLTAGE_OUT] = -1;
}
Expand Down
20 changes: 10 additions & 10 deletions drivers/hwmon/pmbus_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -362,8 +362,8 @@ static struct pmbus_data *pmbus_update_device(struct device *dev)
* Convert linear sensor values to milli- or micro-units
* depending on sensor type.
*/
static int pmbus_reg2data_linear(struct pmbus_data *data,
struct pmbus_sensor *sensor)
static long pmbus_reg2data_linear(struct pmbus_data *data,
struct pmbus_sensor *sensor)
{
s16 exponent;
s32 mantissa;
Expand Down Expand Up @@ -397,15 +397,15 @@ static int pmbus_reg2data_linear(struct pmbus_data *data,
else
val >>= -exponent;

return (int)val;
return val;
}

/*
* Convert direct sensor values to milli- or micro-units
* depending on sensor type.
*/
static int pmbus_reg2data_direct(struct pmbus_data *data,
struct pmbus_sensor *sensor)
static long pmbus_reg2data_direct(struct pmbus_data *data,
struct pmbus_sensor *sensor)
{
long val = (s16) sensor->data;
long m, b, R;
Expand Down Expand Up @@ -440,12 +440,12 @@ static int pmbus_reg2data_direct(struct pmbus_data *data,
R++;
}

return (int)((val - b) / m);
return (val - b) / m;
}

static int pmbus_reg2data(struct pmbus_data *data, struct pmbus_sensor *sensor)
static long pmbus_reg2data(struct pmbus_data *data, struct pmbus_sensor *sensor)
{
int val;
long val;

if (data->info->direct[sensor->class])
val = pmbus_reg2data_direct(data, sensor);
Expand Down Expand Up @@ -619,7 +619,7 @@ static int pmbus_get_boolean(struct pmbus_data *data, int index, int *val)
if (!s1 && !s2)
*val = !!regval;
else {
int v1, v2;
long v1, v2;
struct pmbus_sensor *sensor1, *sensor2;

sensor1 = &data->sensors[s1];
Expand Down Expand Up @@ -661,7 +661,7 @@ static ssize_t pmbus_show_sensor(struct device *dev,
if (sensor->data < 0)
return sensor->data;

return snprintf(buf, PAGE_SIZE, "%d\n", pmbus_reg2data(data, sensor));
return snprintf(buf, PAGE_SIZE, "%ld\n", pmbus_reg2data(data, sensor));
}

static ssize_t pmbus_set_sensor(struct device *dev,
Expand Down

0 comments on commit 3110df8

Please sign in to comment.