summaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/pmbus/pmbus_core.c
diff options
context:
space:
mode:
authorPaul Mundt <lethal@linux-sh.org>2011-08-29 16:08:51 +0900
committerPaul Mundt <lethal@linux-sh.org>2011-08-29 16:08:51 +0900
commitb9a3acf46afdafc601947136f63e9dd228cd86e8 (patch)
tree2b206b6d3c51f673c94fbcdf03df2a699e7110d2 /drivers/hwmon/pmbus/pmbus_core.c
parent9f0fa7991af382bfa8c9575d2457a0b6ad03ac4c (diff)
parent21d41f2b312231536cf981c960c83cc4493c0293 (diff)
downloadlinux-stable-b9a3acf46afdafc601947136f63e9dd228cd86e8.tar.gz
linux-stable-b9a3acf46afdafc601947136f63e9dd228cd86e8.tar.bz2
linux-stable-b9a3acf46afdafc601947136f63e9dd228cd86e8.zip
Merge branch 'sh/stable-updates' into sh-latest
Diffstat (limited to 'drivers/hwmon/pmbus/pmbus_core.c')
-rw-r--r--drivers/hwmon/pmbus/pmbus_core.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/drivers/hwmon/pmbus/pmbus_core.c b/drivers/hwmon/pmbus/pmbus_core.c
index 5c1b6cf31701..a561c3a0e916 100644
--- a/drivers/hwmon/pmbus/pmbus_core.c
+++ b/drivers/hwmon/pmbus/pmbus_core.c
@@ -182,6 +182,24 @@ int pmbus_write_byte(struct i2c_client *client, int page, u8 value)
}
EXPORT_SYMBOL_GPL(pmbus_write_byte);
+/*
+ * _pmbus_write_byte() is similar to pmbus_write_byte(), but checks if
+ * a device specific mapping funcion exists and calls it if necessary.
+ */
+static int _pmbus_write_byte(struct i2c_client *client, int page, u8 value)
+{
+ struct pmbus_data *data = i2c_get_clientdata(client);
+ const struct pmbus_driver_info *info = data->info;
+ int status;
+
+ if (info->write_byte) {
+ status = info->write_byte(client, page, value);
+ if (status != -ENODATA)
+ return status;
+ }
+ return pmbus_write_byte(client, page, value);
+}
+
int pmbus_write_word_data(struct i2c_client *client, u8 page, u8 reg, u16 word)
{
int rv;
@@ -281,7 +299,7 @@ static int _pmbus_read_byte_data(struct i2c_client *client, int page, int reg)
static void pmbus_clear_fault_page(struct i2c_client *client, int page)
{
- pmbus_write_byte(client, page, PMBUS_CLEAR_FAULTS);
+ _pmbus_write_byte(client, page, PMBUS_CLEAR_FAULTS);
}
void pmbus_clear_faults(struct i2c_client *client)