summaryrefslogtreecommitdiff
path: root/drivers/hwmon
diff options
context:
space:
mode:
authorGuenter Roeck <linux@roeck-us.net>2018-09-18 09:53:06 -0700
committerGuenter Roeck <linux@roeck-us.net>2018-10-10 20:37:13 -0700
commita4e0a080cad80bb2522eb541868cc48c5e68ba72 (patch)
tree42c70dd32f546cfef762cb3ce3a83e728513def7 /drivers/hwmon
parent2d888c5f22b49bba174e0343f8e4ddfb374fa816 (diff)
hwmon: (nct6775) Use logical or instead of if statements where possible
Use boolean |= <expression>; instead of if (!boolean) boolean = <expression>; to assign values to boolean variables. No functional change. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'drivers/hwmon')
-rw-r--r--drivers/hwmon/nct6775.c34
1 files changed, 11 insertions, 23 deletions
diff --git a/drivers/hwmon/nct6775.c b/drivers/hwmon/nct6775.c
index 984b22d4999a..0f20f7c2a96b 100644
--- a/drivers/hwmon/nct6775.c
+++ b/drivers/hwmon/nct6775.c
@@ -3529,36 +3529,24 @@ nct6775_check_fan_inputs(struct nct6775_data *data)
case nct6793:
case nct6795:
case nct6796:
- if (!pwm5pin)
- pwm5pin = cr2d & BIT(7);
+ pwm5pin |= cr2d & BIT(7);
- if (!fan5pin)
- fan5pin = cr1b & BIT(5);
+ fan5pin |= cr1b & BIT(5);
if (data->kind != nct6796) {
- if (!dsw_en) {
- fan6pin = cr2d & BIT(1);
- pwm6pin = cr2d & BIT(0);
- }
+ fan6pin = !dsw_en && (cr2d & BIT(1));
+ pwm6pin = !dsw_en && (cr2d & BIT(0));
- if (!fan5pin)
- fan5pin = creb & BIT(5);
- if (!pwm5pin)
- pwm5pin = (creb & BIT(4)) &&
- !(cr2a & BIT(0));
- if (!fan6pin)
- fan6pin = creb & BIT(3);
- if (!pwm6pin)
- pwm6pin = creb & BIT(2);
+ fan5pin |= creb & BIT(5);
+ pwm5pin |= (creb & BIT(4)) && !(cr2a & BIT(0));
+ fan6pin |= creb & BIT(3);
+ pwm6pin |= creb & BIT(2);
}
if (data->kind == nct6795 || data->kind == nct6796) {
- if (!fan6pin)
- fan6pin = (cr2a & BIT(4)) &&
- (!dsw_en || (cred & BIT(4)));
- if (!pwm6pin)
- pwm6pin = (cr2a & BIT(3)) &&
- (cred & BIT(2));
+ fan6pin |= (cr2a & BIT(4)) &&
+ (!dsw_en || (cred & BIT(4)));
+ pwm6pin |= (cr2a & BIT(3)) && (cred & BIT(2));
}
if (data->kind == nct6796) {