Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 267278
b: refs/heads/master
c: 1af1f53
h: refs/heads/master
v: v3
  • Loading branch information
Guenter Roeck committed Oct 24, 2011
1 parent 9454769 commit 57d9827
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 14 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: bc365a7f3c0d5b5b2a642e6646098b306b6faa4d
refs/heads/master: 1af1f5313cfea85a185c7bbb5258f7856fc8fea7
17 changes: 4 additions & 13 deletions trunk/drivers/hwmon/pmbus/pmbus_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -445,13 +445,8 @@ static long pmbus_reg2data_linear(struct pmbus_data *data,
exponent = data->exponent;
mantissa = (u16) sensor->data;
} else { /* LINEAR11 */
exponent = (sensor->data >> 11) & 0x001f;
mantissa = sensor->data & 0x07ff;

if (exponent > 0x0f)
exponent |= 0xffe0; /* sign extend exponent */
if (mantissa > 0x03ff)
mantissa |= 0xfffff800; /* sign extend mantissa */
exponent = ((s16)sensor->data) >> 11;
mantissa = ((s16)((sensor->data & 0x7ff) << 5)) >> 5;
}

val = mantissa;
Expand Down Expand Up @@ -1628,7 +1623,7 @@ static void pmbus_find_attributes(struct i2c_client *client,
static int pmbus_identify_common(struct i2c_client *client,
struct pmbus_data *data)
{
int vout_mode = -1, exponent;
int vout_mode = -1;

if (pmbus_check_byte_register(client, 0, PMBUS_VOUT_MODE))
vout_mode = _pmbus_read_byte_data(client, 0, PMBUS_VOUT_MODE);
Expand All @@ -1642,11 +1637,7 @@ static int pmbus_identify_common(struct i2c_client *client,
if (data->info->format[PSC_VOLTAGE_OUT] != linear)
return -ENODEV;

exponent = vout_mode & 0x1f;
/* and sign-extend it */
if (exponent & 0x10)
exponent |= ~0x1f;
data->exponent = exponent;
data->exponent = ((s8)(vout_mode << 3)) >> 3;
break;
case 1: /* VID mode */
if (data->info->format[PSC_VOLTAGE_OUT] != vid)
Expand Down

0 comments on commit 57d9827

Please sign in to comment.