Skip to content

Commit

Permalink
Merge branch 'hwmon-for-linus' of git://github.com/groeck/linux
Browse files Browse the repository at this point in the history
* 'hwmon-for-linus' of git://github.com/groeck/linux:
  hwmon: (ucd9000/ucd9200) Optimize array walk
  hwmon: (max16065) Add chip access warning to documentation
  hwmon: (max16065) Fix current calculation
  • Loading branch information
torvalds committed Sep 7, 2011
2 parents 28c51ee + f020b00 commit 4fc1d39
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 9 deletions.
7 changes: 7 additions & 0 deletions Documentation/hwmon/max16065
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,13 @@ can be safely used to identify the chip. You will have to instantiate
the devices explicitly. Please see Documentation/i2c/instantiating-devices for
details.

WARNING: Do not access chip registers using the i2cdump command, and do not use
any of the i2ctools commands on a command register (0xa5 to 0xac). The chips
supported by this driver interpret any access to a command register (including
read commands) as request to execute the command in question. This may result in
power loss, board resets, and/or Flash corruption. Worst case, your board may
turn into a brick.


Sysfs entries
-------------
Expand Down
2 changes: 1 addition & 1 deletion drivers/hwmon/max16065.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ static inline int MV_TO_LIMIT(int mv, int range)

static inline int ADC_TO_CURR(int adc, int gain)
{
return adc * 1400000 / gain * 255;
return adc * 1400000 / (gain * 255);
}

/*
Expand Down
6 changes: 2 additions & 4 deletions drivers/hwmon/pmbus/ucd9000.c
Original file line number Diff line number Diff line change
Expand Up @@ -141,13 +141,11 @@ static int ucd9000_probe(struct i2c_client *client,
block_buffer[ret] = '\0';
dev_info(&client->dev, "Device ID %s\n", block_buffer);

mid = NULL;
for (i = 0; i < ARRAY_SIZE(ucd9000_id); i++) {
mid = &ucd9000_id[i];
for (mid = ucd9000_id; mid->name[0]; mid++) {
if (!strncasecmp(mid->name, block_buffer, strlen(mid->name)))
break;
}
if (!mid || !strlen(mid->name)) {
if (!mid->name[0]) {
dev_err(&client->dev, "Unsupported device\n");
return -ENODEV;
}
Expand Down
6 changes: 2 additions & 4 deletions drivers/hwmon/pmbus/ucd9200.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,11 @@ static int ucd9200_probe(struct i2c_client *client,
block_buffer[ret] = '\0';
dev_info(&client->dev, "Device ID %s\n", block_buffer);

mid = NULL;
for (i = 0; i < ARRAY_SIZE(ucd9200_id); i++) {
mid = &ucd9200_id[i];
for (mid = ucd9200_id; mid->name[0]; mid++) {
if (!strncasecmp(mid->name, block_buffer, strlen(mid->name)))
break;
}
if (!mid || !strlen(mid->name)) {
if (!mid->name[0]) {
dev_err(&client->dev, "Unsupported device\n");
return -ENODEV;
}
Expand Down

0 comments on commit 4fc1d39

Please sign in to comment.