summaryrefslogtreecommitdiffstats
path: root/drivers/hwmon
diff options
context:
space:
mode:
authorGuenter Roeck <linux@roeck-us.net>2018-09-18 09:49:29 -0700
committerGuenter Roeck <linux@roeck-us.net>2018-10-10 20:37:13 -0700
commit2d888c5f22b49bba174e0343f8e4ddfb374fa816 (patch)
tree2f4695ab45adc026848ae2e3440546db2cb323c6 /drivers/hwmon
parent97ce6df46874331b46e279ae18bd07365e6cd586 (diff)
downloadlinux-2d888c5f22b49bba174e0343f8e4ddfb374fa816.tar.bz2
hwmon: (nct6775) Declare and initialize LDN specific config variables earlier
Declare and initialize LDN / chip specific configuration variables earlier. This simplifies re-using the configuration variables for multiple chips and makes the code easier to read. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'drivers/hwmon')
-rw-r--r--drivers/hwmon/nct6775.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/drivers/hwmon/nct6775.c b/drivers/hwmon/nct6775.c
index aa8a44608ca3..984b22d4999a 100644
--- a/drivers/hwmon/nct6775.c
+++ b/drivers/hwmon/nct6775.c
@@ -3505,6 +3505,12 @@ nct6775_check_fan_inputs(struct nct6775_data *data)
int cr2d = superio_inb(sioreg, 0x2d);
int cr2f = superio_inb(sioreg, 0x2f);
bool dsw_en = cr2f & BIT(3);
+ int creb;
+ int cred;
+
+ superio_select(sioreg, NCT6775_LD_12);
+ creb = superio_inb(sioreg, 0xeb);
+ cred = superio_inb(sioreg, 0xed);
fan3pin = !(cr1c & BIT(5));
fan4pin = !(cr1c & BIT(6));
@@ -3529,10 +3535,7 @@ nct6775_check_fan_inputs(struct nct6775_data *data)
if (!fan5pin)
fan5pin = cr1b & BIT(5);
- superio_select(sioreg, NCT6775_LD_12);
if (data->kind != nct6796) {
- int creb = superio_inb(sioreg, 0xeb);
-
if (!dsw_en) {
fan6pin = cr2d & BIT(1);
pwm6pin = cr2d & BIT(0);
@@ -3550,8 +3553,6 @@ nct6775_check_fan_inputs(struct nct6775_data *data)
}
if (data->kind == nct6795 || data->kind == nct6796) {
- int cred = superio_inb(sioreg, 0xed);
-
if (!fan6pin)
fan6pin = (cr2a & BIT(4)) &&
(!dsw_en || (cred & BIT(4)));