summaryrefslogtreecommitdiff
path: root/drivers/hwmon/pmbus/max34440.c
diff options
context:
space:
mode:
authorGuenter Roeck <guenter.roeck@ericsson.com>2011-07-30 05:19:39 (GMT)
committerGuenter Roeck <guenter.roeck@ericsson.com>2011-10-24 18:09:40 (GMT)
commitda8e48ab483e1f54c1099bed91bfd2c302bc7ddf (patch)
tree10a2c76781ef0b1c51515d4feb71c7fa5ae6e29f /drivers/hwmon/pmbus/max34440.c
parent179144a0d4128e7588b3d613a14807402f5e7c37 (diff)
downloadlinux-fsl-qoriq-da8e48ab483e1f54c1099bed91bfd2c302bc7ddf.tar.xz
hwmon: (pmbus) Always call _pmbus_read_byte in core driver
Always call _pmbus_read_byte() instead of pmbus_read_byte() in PMBus core driver. With this change, device specific read functions can be implemented for all registers. Since the device specific read_byte function is now always called, we need to be more careful with page validations. Only fail if the passed page number is larger than 0, since -1 means "current page". Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com> Reviewed-by: Robert Coulson <robert.coulson@ericsson.com>
Diffstat (limited to 'drivers/hwmon/pmbus/max34440.c')
-rw-r--r--drivers/hwmon/pmbus/max34440.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/hwmon/pmbus/max34440.c b/drivers/hwmon/pmbus/max34440.c
index c824365..beaf5a8 100644
--- a/drivers/hwmon/pmbus/max34440.c
+++ b/drivers/hwmon/pmbus/max34440.c
@@ -93,12 +93,14 @@ static int max34440_write_word_data(struct i2c_client *client, int page,
static int max34440_read_byte_data(struct i2c_client *client, int page, int reg)
{
- int ret;
+ int ret = 0;
int mfg_status;
- ret = pmbus_set_page(client, page);
- if (ret < 0)
- return ret;
+ if (page >= 0) {
+ ret = pmbus_set_page(client, page);
+ if (ret < 0)
+ return ret;
+ }
switch (reg) {
case PMBUS_STATUS_IOUT: