diff options
author | Guenter Roeck <linux@roeck-us.net> | 2019-06-07 10:23:23 -0700 |
---|---|---|
committer | Guenter Roeck <linux@roeck-us.net> | 2019-06-23 18:33:01 -0700 |
commit | 62dbe50591769f6135b3c8a93c8168b3d177a823 (patch) | |
tree | 044fa1a8494460f954b598a45a2653faf5680621 /drivers/hwmon/max6650.c | |
parent | e193acb3d681ba28355ab8bafc49768ac609b94e (diff) | |
download | linux-stable-62dbe50591769f6135b3c8a93c8168b3d177a823.tar.gz linux-stable-62dbe50591769f6135b3c8a93c8168b3d177a823.tar.bz2 linux-stable-62dbe50591769f6135b3c8a93c8168b3d177a823.zip |
hwmon: (max6650) Read non-volatile registers only once
Only tachometer and alarm status registers are modified by the chip.
All other registers only need to be read only once, and reading them
repeatedly does not add any value.
Cc: Jean-Francois Dagenais <jeff.dagenais@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'drivers/hwmon/max6650.c')
-rw-r--r-- | drivers/hwmon/max6650.c | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/drivers/hwmon/max6650.c b/drivers/hwmon/max6650.c index bcd50307d963..6f1a1a6eae46 100644 --- a/drivers/hwmon/max6650.c +++ b/drivers/hwmon/max6650.c @@ -162,17 +162,10 @@ static struct max6650_data *max6650_update_device(struct device *dev) mutex_lock(&data->update_lock); if (time_after(jiffies, data->last_updated + HZ) || !data->valid) { - data->speed = i2c_smbus_read_byte_data(client, - MAX6650_REG_SPEED); - data->config = i2c_smbus_read_byte_data(client, - MAX6650_REG_CONFIG); for (i = 0; i < data->nr_fans; i++) { data->tach[i] = i2c_smbus_read_byte_data(client, tach_reg[i]); } - data->count = i2c_smbus_read_byte_data(client, - MAX6650_REG_COUNT); - data->dac = i2c_smbus_read_byte_data(client, MAX6650_REG_DAC); /* * Alarms are cleared on read in case the condition that @@ -421,8 +414,22 @@ static int max6650_init_client(struct max6650_data *data, dev_err(dev, "Config write error, aborting.\n"); return err; } - data->config = reg; + + reg = i2c_smbus_read_byte_data(client, MAX6650_REG_SPEED); + if (reg < 0) { + dev_err(dev, "Failed to read speed register, aborting.\n"); + return reg; + } + data->speed = reg; + + reg = i2c_smbus_read_byte_data(client, MAX6650_REG_DAC); + if (reg < 0) { + dev_err(dev, "Failed to read DAC register, aborting.\n"); + return reg; + } + data->dac = reg; + reg = i2c_smbus_read_byte_data(client, MAX6650_REG_COUNT); if (reg < 0) { dev_err(dev, "Failed to read count register, aborting.\n"); |