Commit 1b206240 authored by Guenter Roeck's avatar Guenter Roeck

hwmon: (nct6775) Initialize boolean variables with declaration

Initialize boolean flags in nct6775_check_fan_inputs() while
declaring them instead of several times throughout the code.
Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
parent 00fd4cfe
......@@ -3360,8 +3360,10 @@ static inline void nct6775_init_device(struct nct6775_data *data)
static void
nct6775_check_fan_inputs(struct nct6775_data *data)
{
bool fan3pin, fan4pin, fan4min, fan5pin, fan6pin;
bool pwm3pin, pwm4pin, pwm5pin, pwm6pin;
bool fan3pin = false, fan4pin = false, fan4min = false;
bool fan5pin = false, fan6pin = false;
bool pwm3pin = false, pwm4pin = false, pwm5pin = false;
bool pwm6pin = false;
int sioreg = data->sioreg;
int regval;
......@@ -3378,12 +3380,6 @@ nct6775_check_fan_inputs(struct nct6775_data *data)
/* On NCT6775, fan4 shares pins with the fdc interface */
fan4pin = !(superio_inb(sioreg, 0x2A) & 0x80);
fan4min = false;
fan5pin = false;
fan6pin = false;
pwm4pin = false;
pwm5pin = false;
pwm6pin = false;
} else if (data->kind == nct6776) {
bool gpok = superio_inb(sioreg, 0x27) & 0x80;
const char *board_vendor, *board_name;
......@@ -3423,23 +3419,11 @@ nct6775_check_fan_inputs(struct nct6775_data *data)
fan5pin = superio_inb(sioreg, 0x1C) & 0x02;
fan4min = fan4pin;
fan6pin = false;
pwm3pin = fan3pin;
pwm4pin = false;
pwm5pin = false;
pwm6pin = false;
} else if (data->kind == nct6106) {
regval = superio_inb(sioreg, 0x24);
fan3pin = !(regval & 0x80);
pwm3pin = regval & 0x08;
fan4pin = false;
fan4min = false;
fan5pin = false;
fan6pin = false;
pwm4pin = false;
pwm5pin = false;
pwm6pin = false;
} else { /* NCT6779D, NCT6791D, NCT6792D, NCT6793D, or NCT6795D */
int regval_1b, regval_2a, regval_2f, regval_eb;
bool dsw_en;
......@@ -3474,8 +3458,6 @@ nct6775_check_fan_inputs(struct nct6775_data *data)
if (!fan5pin)
fan5pin = regval_1b & BIT(5);
fan6pin = false;
pwm6pin = false;
if (!dsw_en) {
fan6pin = regval & BIT(1);
pwm6pin = regval & BIT(0);
......@@ -3506,8 +3488,6 @@ nct6775_check_fan_inputs(struct nct6775_data *data)
}
break;
default: /* NCT6779D */
fan6pin = false;
pwm6pin = false;
break;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment