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>
diff --git a/drivers/hwmon/pmbus/ucd9000.c b/drivers/hwmon/pmbus/ucd9000.c
index 1536db6..4ff6cf2 100644
--- a/drivers/hwmon/pmbus/ucd9000.c
+++ b/drivers/hwmon/pmbus/ucd9000.c
@@ -74,7 +74,7 @@
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 @@
ret = fan_config;
break;
case PMBUS_FAN_CONFIG_34:
- if (page)
+ if (page > 0)
return -ENXIO;
ret = ucd9000_get_fan_config(client, 2);