From da8e48ab483e1f54c1099bed91bfd2c302bc7ddf Mon Sep 17 00:00:00 2001 From: Guenter Roeck Date: Fri, 29 Jul 2011 22:19:39 -0700 Subject: 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 Reviewed-by: Robert Coulson --- drivers/hwmon/pmbus/ucd9000.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/hwmon/pmbus/ucd9000.c') diff --git a/drivers/hwmon/pmbus/ucd9000.c b/drivers/hwmon/pmbus/ucd9000.c index 1536db6543f0..4ff6cf289f85 100644 --- a/drivers/hwmon/pmbus/ucd9000.c +++ b/drivers/hwmon/pmbus/ucd9000.c @@ -74,7 +74,7 @@ static int ucd9000_read_byte_data(struct i2c_client *client, int page, int reg) switch (reg) { case PMBUS_FAN_CONFIG_12: - if (page) + if (page > 0) return -ENXIO; ret = ucd9000_get_fan_config(client, 0); @@ -88,7 +88,7 @@ static int ucd9000_read_byte_data(struct i2c_client *client, int page, int reg) ret = fan_config; break; case PMBUS_FAN_CONFIG_34: - if (page) + if (page > 0) return -ENXIO; ret = ucd9000_get_fan_config(client, 2); -- cgit v1.2.3