diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2020-08-06 14:15:47 +0300 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2020-08-06 14:15:47 +0300 |
commit | 94fb1afb14c4f0ceb8c5508ddddac6819f662e95 (patch) | |
tree | 4988e5769dc7482caa7f441475ae31f50bbd37ef /drivers/hwmon/adc128d818.c | |
parent | c4735d990268399da9133b0ad445e488ece009ad (diff) | |
parent | 47ec5303d73ea344e84f46660fff693c57641386 (diff) | |
download | linux-94fb1afb14c4f0ceb8c5508ddddac6819f662e95.tar.xz |
Mgerge remote-tracking branch 'torvalds/master' into perf/core
To sync headers, for instance, in this case tools/perf was ahead of
upstream till Linus merged tip/perf/core to get the
PERF_RECORD_TEXT_POKE changes:
Warning: Kernel ABI header at 'tools/include/uapi/linux/perf_event.h' differs from latest version at 'include/uapi/linux/perf_event.h'
diff -u tools/include/uapi/linux/perf_event.h include/uapi/linux/perf_event.h
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'drivers/hwmon/adc128d818.c')
-rw-r--r-- | drivers/hwmon/adc128d818.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/drivers/hwmon/adc128d818.c b/drivers/hwmon/adc128d818.c index f9edec195c35..571d5454c6b2 100644 --- a/drivers/hwmon/adc128d818.c +++ b/drivers/hwmon/adc128d818.c @@ -393,6 +393,7 @@ static int adc128_init_client(struct adc128_data *data) { struct i2c_client *client = data->client; int err; + u8 regval = 0x0; /* * Reset chip to defaults. @@ -403,10 +404,17 @@ static int adc128_init_client(struct adc128_data *data) return err; /* Set operation mode, if non-default */ - if (data->mode != 0) { - err = i2c_smbus_write_byte_data(client, - ADC128_REG_CONFIG_ADV, - data->mode << 1); + if (data->mode != 0) + regval |= data->mode << 1; + + /* If external vref is selected, configure the chip to use it */ + if (data->regulator) + regval |= 0x01; + + /* Write advanced configuration register */ + if (regval != 0x0) { + err = i2c_smbus_write_byte_data(client, ADC128_REG_CONFIG_ADV, + regval); if (err) return err; } @@ -416,14 +424,6 @@ static int adc128_init_client(struct adc128_data *data) if (err) return err; - /* If external vref is selected, configure the chip to use it */ - if (data->regulator) { - err = i2c_smbus_write_byte_data(client, - ADC128_REG_CONFIG_ADV, 0x01); - if (err) - return err; - } - return 0; } |