aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuenter Roeck <linux@roeck-us.net>2017-05-17 21:40:10 -0400
committerGuenter Roeck <linux@roeck-us.net>2017-06-11 20:08:19 -0400
commitd1bb218687079c365ea8a8a096abeefc8768dd0c (patch)
treea339a4d5cdae8703a1becf10225a4eadf90e34e9
parent32c1431eea4881a6b17bd7c639315010aeefa452 (diff)
hwmon: (nct6775) Use bitops
Using bitops instead of shift operations makes the code easier to read. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
-rw-r--r--drivers/hwmon/nct6775.c123
1 files changed, 62 insertions, 61 deletions
diff --git a/drivers/hwmon/nct6775.c b/drivers/hwmon/nct6775.c
index 2458b406f6aa..d506d8e3bb2c 100644
--- a/drivers/hwmon/nct6775.c
+++ b/drivers/hwmon/nct6775.c
@@ -58,6 +58,7 @@
58#include <linux/err.h> 58#include <linux/err.h>
59#include <linux/mutex.h> 59#include <linux/mutex.h>
60#include <linux/acpi.h> 60#include <linux/acpi.h>
61#include <linux/bitops.h>
61#include <linux/dmi.h> 62#include <linux/dmi.h>
62#include <linux/io.h> 63#include <linux/io.h>
63#include "lm75.h" 64#include "lm75.h"
@@ -810,7 +811,7 @@ static u16 fan_to_reg(u32 fan, unsigned int divreg)
810static inline unsigned int 811static inline unsigned int
811div_from_reg(u8 reg) 812div_from_reg(u8 reg)
812{ 813{
813 return 1 << reg; 814 return BIT(reg);
814} 815}
815 816
816/* 817/*
@@ -1276,7 +1277,7 @@ static void nct6775_update_fan_div(struct nct6775_data *data)
1276 data->fan_div[1] = (i & 0x70) >> 4; 1277 data->fan_div[1] = (i & 0x70) >> 4;
1277 i = nct6775_read_value(data, NCT6775_REG_FANDIV2); 1278 i = nct6775_read_value(data, NCT6775_REG_FANDIV2);
1278 data->fan_div[2] = i & 0x7; 1279 data->fan_div[2] = i & 0x7;
1279 if (data->has_fan & (1 << 3)) 1280 if (data->has_fan & BIT(3))
1280 data->fan_div[3] = (i & 0x70) >> 4; 1281 data->fan_div[3] = (i & 0x70) >> 4;
1281} 1282}
1282 1283
@@ -1298,7 +1299,7 @@ static void nct6775_init_fan_div(struct nct6775_data *data)
1298 * We'll compute a better divider later on. 1299 * We'll compute a better divider later on.
1299 */ 1300 */
1300 for (i = 0; i < ARRAY_SIZE(data->fan_div); i++) { 1301 for (i = 0; i < ARRAY_SIZE(data->fan_div); i++) {
1301 if (!(data->has_fan & (1 << i))) 1302 if (!(data->has_fan & BIT(i)))
1302 continue; 1303 continue;
1303 if (data->fan_div[i] == 0) { 1304 if (data->fan_div[i] == 0) {
1304 data->fan_div[i] = 7; 1305 data->fan_div[i] = 7;
@@ -1321,7 +1322,7 @@ static void nct6775_init_fan_common(struct device *dev,
1321 * prevents the unnecessary warning when fanX_min is reported as 0. 1322 * prevents the unnecessary warning when fanX_min is reported as 0.
1322 */ 1323 */
1323 for (i = 0; i < ARRAY_SIZE(data->fan_min); i++) { 1324 for (i = 0; i < ARRAY_SIZE(data->fan_min); i++) {
1324 if (data->has_fan_min & (1 << i)) { 1325 if (data->has_fan_min & BIT(i)) {
1325 reg = nct6775_read_value(data, data->REG_FAN_MIN[i]); 1326 reg = nct6775_read_value(data, data->REG_FAN_MIN[i]);
1326 if (!reg) 1327 if (!reg)
1327 nct6775_write_value(data, data->REG_FAN_MIN[i], 1328 nct6775_write_value(data, data->REG_FAN_MIN[i],
@@ -1356,7 +1357,7 @@ static void nct6775_select_fan_div(struct device *dev,
1356 div_from_reg(fan_div)); 1357 div_from_reg(fan_div));
1357 1358
1358 /* Preserve min limit if possible */ 1359 /* Preserve min limit if possible */
1359 if (data->has_fan_min & (1 << nr)) { 1360 if (data->has_fan_min & BIT(nr)) {
1360 fan_min = data->fan_min[nr]; 1361 fan_min = data->fan_min[nr];
1361 if (fan_div > data->fan_div[nr]) { 1362 if (fan_div > data->fan_div[nr]) {
1362 if (fan_min != 255 && fan_min > 1) 1363 if (fan_min != 255 && fan_min > 1)
@@ -1387,7 +1388,7 @@ static void nct6775_update_pwm(struct device *dev)
1387 bool duty_is_dc; 1388 bool duty_is_dc;
1388 1389
1389 for (i = 0; i < data->pwm_num; i++) { 1390 for (i = 0; i < data->pwm_num; i++) {
1390 if (!(data->has_pwm & (1 << i))) 1391 if (!(data->has_pwm & BIT(i)))
1391 continue; 1392 continue;
1392 1393
1393 duty_is_dc = data->REG_PWM_MODE[i] && 1394 duty_is_dc = data->REG_PWM_MODE[i] &&
@@ -1457,7 +1458,7 @@ static void nct6775_update_pwm_limits(struct device *dev)
1457 u16 reg_t; 1458 u16 reg_t;
1458 1459
1459 for (i = 0; i < data->pwm_num; i++) { 1460 for (i = 0; i < data->pwm_num; i++) {
1460 if (!(data->has_pwm & (1 << i))) 1461 if (!(data->has_pwm & BIT(i)))
1461 continue; 1462 continue;
1462 1463
1463 for (j = 0; j < ARRAY_SIZE(data->fan_time); j++) { 1464 for (j = 0; j < ARRAY_SIZE(data->fan_time); j++) {
@@ -1534,7 +1535,7 @@ static struct nct6775_data *nct6775_update_device(struct device *dev)
1534 1535
1535 /* Measured voltages and limits */ 1536 /* Measured voltages and limits */
1536 for (i = 0; i < data->in_num; i++) { 1537 for (i = 0; i < data->in_num; i++) {
1537 if (!(data->have_in & (1 << i))) 1538 if (!(data->have_in & BIT(i)))
1538 continue; 1539 continue;
1539 1540
1540 data->in[i][0] = nct6775_read_value(data, 1541 data->in[i][0] = nct6775_read_value(data,
@@ -1549,14 +1550,14 @@ static struct nct6775_data *nct6775_update_device(struct device *dev)
1549 for (i = 0; i < ARRAY_SIZE(data->rpm); i++) { 1550 for (i = 0; i < ARRAY_SIZE(data->rpm); i++) {
1550 u16 reg; 1551 u16 reg;
1551 1552
1552 if (!(data->has_fan & (1 << i))) 1553 if (!(data->has_fan & BIT(i)))
1553 continue; 1554 continue;
1554 1555
1555 reg = nct6775_read_value(data, data->REG_FAN[i]); 1556 reg = nct6775_read_value(data, data->REG_FAN[i]);
1556 data->rpm[i] = data->fan_from_reg(reg, 1557 data->rpm[i] = data->fan_from_reg(reg,
1557 data->fan_div[i]); 1558 data->fan_div[i]);
1558 1559
1559 if (data->has_fan_min & (1 << i)) 1560 if (data->has_fan_min & BIT(i))
1560 data->fan_min[i] = nct6775_read_value(data, 1561 data->fan_min[i] = nct6775_read_value(data,
1561 data->REG_FAN_MIN[i]); 1562 data->REG_FAN_MIN[i]);
1562 data->fan_pulses[i] = 1563 data->fan_pulses[i] =
@@ -1571,7 +1572,7 @@ static struct nct6775_data *nct6775_update_device(struct device *dev)
1571 1572
1572 /* Measured temperatures and limits */ 1573 /* Measured temperatures and limits */
1573 for (i = 0; i < NUM_TEMP; i++) { 1574 for (i = 0; i < NUM_TEMP; i++) {
1574 if (!(data->have_temp & (1 << i))) 1575 if (!(data->have_temp & BIT(i)))
1575 continue; 1576 continue;
1576 for (j = 0; j < ARRAY_SIZE(data->reg_temp); j++) { 1577 for (j = 0; j < ARRAY_SIZE(data->reg_temp); j++) {
1577 if (data->reg_temp[j][i]) 1578 if (data->reg_temp[j][i])
@@ -1580,7 +1581,7 @@ static struct nct6775_data *nct6775_update_device(struct device *dev)
1580 data->reg_temp[j][i]); 1581 data->reg_temp[j][i]);
1581 } 1582 }
1582 if (i >= NUM_TEMP_FIXED || 1583 if (i >= NUM_TEMP_FIXED ||
1583 !(data->have_temp_fixed & (1 << i))) 1584 !(data->have_temp_fixed & BIT(i)))
1584 continue; 1585 continue;
1585 data->temp_offset[i] 1586 data->temp_offset[i]
1586 = nct6775_read_value(data, data->REG_TEMP_OFFSET[i]); 1587 = nct6775_read_value(data, data->REG_TEMP_OFFSET[i]);
@@ -1801,7 +1802,7 @@ static umode_t nct6775_in_is_visible(struct kobject *kobj,
1801 struct nct6775_data *data = dev_get_drvdata(dev); 1802 struct nct6775_data *data = dev_get_drvdata(dev);
1802 int in = index / 5; /* voltage index */ 1803 int in = index / 5; /* voltage index */
1803 1804
1804 if (!(data->have_in & (1 << in))) 1805 if (!(data->have_in & BIT(in)))
1805 return 0; 1806 return 0;
1806 1807
1807 return attr->mode; 1808 return attr->mode;
@@ -1911,7 +1912,7 @@ store_fan_min(struct device *dev, struct device_attribute *attr,
1911 * even with the highest divider (128) 1912 * even with the highest divider (128)
1912 */ 1913 */
1913 data->fan_min[nr] = 254; 1914 data->fan_min[nr] = 254;
1914 new_div = 7; /* 128 == (1 << 7) */ 1915 new_div = 7; /* 128 == BIT(7) */
1915 dev_warn(dev, 1916 dev_warn(dev,
1916 "fan%u low limit %lu below minimum %u, set to minimum\n", 1917 "fan%u low limit %lu below minimum %u, set to minimum\n",
1917 nr + 1, val, data->fan_from_reg_min(254, 7)); 1918 nr + 1, val, data->fan_from_reg_min(254, 7));
@@ -1921,7 +1922,7 @@ store_fan_min(struct device *dev, struct device_attribute *attr,
1921 * even with the lowest divider (1) 1922 * even with the lowest divider (1)
1922 */ 1923 */
1923 data->fan_min[nr] = 1; 1924 data->fan_min[nr] = 1;
1924 new_div = 0; /* 1 == (1 << 0) */ 1925 new_div = 0; /* 1 == BIT(0) */
1925 dev_warn(dev, 1926 dev_warn(dev,
1926 "fan%u low limit %lu above maximum %u, set to maximum\n", 1927 "fan%u low limit %lu above maximum %u, set to maximum\n",
1927 nr + 1, val, data->fan_from_reg_min(1, 0)); 1928 nr + 1, val, data->fan_from_reg_min(1, 0));
@@ -2008,14 +2009,14 @@ static umode_t nct6775_fan_is_visible(struct kobject *kobj,
2008 int fan = index / 6; /* fan index */ 2009 int fan = index / 6; /* fan index */
2009 int nr = index % 6; /* attribute index */ 2010 int nr = index % 6; /* attribute index */
2010 2011
2011 if (!(data->has_fan & (1 << fan))) 2012 if (!(data->has_fan & BIT(fan)))
2012 return 0; 2013 return 0;
2013 2014
2014 if (nr == 1 && data->ALARM_BITS[FAN_ALARM_BASE + fan] == -1) 2015 if (nr == 1 && data->ALARM_BITS[FAN_ALARM_BASE + fan] == -1)
2015 return 0; 2016 return 0;
2016 if (nr == 2 && data->BEEP_BITS[FAN_ALARM_BASE + fan] == -1) 2017 if (nr == 2 && data->BEEP_BITS[FAN_ALARM_BASE + fan] == -1)
2017 return 0; 2018 return 0;
2018 if (nr == 4 && !(data->has_fan_min & (1 << fan))) 2019 if (nr == 4 && !(data->has_fan_min & BIT(fan)))
2019 return 0; 2020 return 0;
2020 if (nr == 5 && data->kind != nct6775) 2021 if (nr == 5 && data->kind != nct6775)
2021 return 0; 2022 return 0;
@@ -2193,7 +2194,7 @@ static umode_t nct6775_temp_is_visible(struct kobject *kobj,
2193 int temp = index / 10; /* temp index */ 2194 int temp = index / 10; /* temp index */
2194 int nr = index % 10; /* attribute index */ 2195 int nr = index % 10; /* attribute index */
2195 2196
2196 if (!(data->have_temp & (1 << temp))) 2197 if (!(data->have_temp & BIT(temp)))
2197 return 0; 2198 return 0;
2198 2199
2199 if (nr == 2 && find_temp_source(data, temp, data->num_temp_alarms) < 0) 2200 if (nr == 2 && find_temp_source(data, temp, data->num_temp_alarms) < 0)
@@ -2215,7 +2216,7 @@ static umode_t nct6775_temp_is_visible(struct kobject *kobj,
2215 return 0; 2216 return 0;
2216 2217
2217 /* offset and type only apply to fixed sensors */ 2218 /* offset and type only apply to fixed sensors */
2218 if (nr > 7 && !(data->have_temp_fixed & (1 << temp))) 2219 if (nr > 7 && !(data->have_temp_fixed & BIT(temp)))
2219 return 0; 2220 return 0;
2220 2221
2221 return attr->mode; 2222 return attr->mode;
@@ -2484,7 +2485,7 @@ show_pwm_temp_sel_common(struct nct6775_data *data, char *buf, int src)
2484 int i, sel = 0; 2485 int i, sel = 0;
2485 2486
2486 for (i = 0; i < NUM_TEMP; i++) { 2487 for (i = 0; i < NUM_TEMP; i++) {
2487 if (!(data->have_temp & (1 << i))) 2488 if (!(data->have_temp & BIT(i)))
2488 continue; 2489 continue;
2489 if (src == data->temp_src[i]) { 2490 if (src == data->temp_src[i]) {
2490 sel = i + 1; 2491 sel = i + 1;
@@ -2520,7 +2521,7 @@ store_pwm_temp_sel(struct device *dev, struct device_attribute *attr,
2520 return err; 2521 return err;
2521 if (val == 0 || val > NUM_TEMP) 2522 if (val == 0 || val > NUM_TEMP)
2522 return -EINVAL; 2523 return -EINVAL;
2523 if (!(data->have_temp & (1 << (val - 1))) || !data->temp_src[val - 1]) 2524 if (!(data->have_temp & BIT(val - 1)) || !data->temp_src[val - 1])
2524 return -EINVAL; 2525 return -EINVAL;
2525 2526
2526 mutex_lock(&data->update_lock); 2527 mutex_lock(&data->update_lock);
@@ -2562,7 +2563,7 @@ store_pwm_weight_temp_sel(struct device *dev, struct device_attribute *attr,
2562 return err; 2563 return err;
2563 if (val > NUM_TEMP) 2564 if (val > NUM_TEMP)
2564 return -EINVAL; 2565 return -EINVAL;
2565 if (val && (!(data->have_temp & (1 << (val - 1))) || 2566 if (val && (!(data->have_temp & BIT(val - 1)) ||
2566 !data->temp_src[val - 1])) 2567 !data->temp_src[val - 1]))
2567 return -EINVAL; 2568 return -EINVAL;
2568 2569
@@ -2995,7 +2996,7 @@ static umode_t nct6775_pwm_is_visible(struct kobject *kobj,
2995 int pwm = index / 36; /* pwm index */ 2996 int pwm = index / 36; /* pwm index */
2996 int nr = index % 36; /* attribute index */ 2997 int nr = index % 36; /* attribute index */
2997 2998
2998 if (!(data->has_pwm & (1 << pwm))) 2999 if (!(data->has_pwm & BIT(pwm)))
2999 return 0; 3000 return 0;
3000 3001
3001 if ((nr >= 14 && nr <= 18) || nr == 21) /* weight */ 3002 if ((nr >= 14 && nr <= 18) || nr == 21) /* weight */
@@ -3246,7 +3247,7 @@ static inline void nct6775_init_device(struct nct6775_data *data)
3246 3247
3247 /* Enable temperature sensors if needed */ 3248 /* Enable temperature sensors if needed */
3248 for (i = 0; i < NUM_TEMP; i++) { 3249 for (i = 0; i < NUM_TEMP; i++) {
3249 if (!(data->have_temp & (1 << i))) 3250 if (!(data->have_temp & BIT(i)))
3250 continue; 3251 continue;
3251 if (!data->reg_temp_config[i]) 3252 if (!data->reg_temp_config[i])
3252 continue; 3253 continue;
@@ -3264,7 +3265,7 @@ static inline void nct6775_init_device(struct nct6775_data *data)
3264 diode = nct6775_read_value(data, data->REG_DIODE); 3265 diode = nct6775_read_value(data, data->REG_DIODE);
3265 3266
3266 for (i = 0; i < data->temp_fixed_num; i++) { 3267 for (i = 0; i < data->temp_fixed_num; i++) {
3267 if (!(data->have_temp_fixed & (1 << i))) 3268 if (!(data->have_temp_fixed & BIT(i)))
3268 continue; 3269 continue;
3269 if ((tmp & (data->DIODE_MASK << i))) /* diode */ 3270 if ((tmp & (data->DIODE_MASK << i))) /* diode */
3270 data->temp_type[i] 3271 data->temp_type[i]
@@ -3290,8 +3291,8 @@ nct6775_check_fan_inputs(struct nct6775_data *data)
3290 if (data->kind == nct6775) { 3291 if (data->kind == nct6775) {
3291 regval = superio_inb(sioreg, 0x2c); 3292 regval = superio_inb(sioreg, 0x2c);
3292 3293
3293 fan3pin = regval & (1 << 6); 3294 fan3pin = regval & BIT(6);
3294 pwm3pin = regval & (1 << 7); 3295 pwm3pin = regval & BIT(7);
3295 3296
3296 /* On NCT6775, fan4 shares pins with the fdc interface */ 3297 /* On NCT6775, fan4 shares pins with the fdc interface */
3297 fan4pin = !(superio_inb(sioreg, 0x2A) & 0x80); 3298 fan4pin = !(superio_inb(sioreg, 0x2A) & 0x80);
@@ -3360,21 +3361,21 @@ nct6775_check_fan_inputs(struct nct6775_data *data)
3360 } else { /* NCT6779D, NCT6791D, NCT6792D, or NCT6793D */ 3361 } else { /* NCT6779D, NCT6791D, NCT6792D, or NCT6793D */
3361 regval = superio_inb(sioreg, 0x1c); 3362 regval = superio_inb(sioreg, 0x1c);
3362 3363
3363 fan3pin = !(regval & (1 << 5)); 3364 fan3pin = !(regval & BIT(5));
3364 fan4pin = !(regval & (1 << 6)); 3365 fan4pin = !(regval & BIT(6));
3365 fan5pin = !(regval & (1 << 7)); 3366 fan5pin = !(regval & BIT(7));
3366 3367
3367 pwm3pin = !(regval & (1 << 0)); 3368 pwm3pin = !(regval & BIT(0));
3368 pwm4pin = !(regval & (1 << 1)); 3369 pwm4pin = !(regval & BIT(1));
3369 pwm5pin = !(regval & (1 << 2)); 3370 pwm5pin = !(regval & BIT(2));
3370 3371
3371 fan4min = fan4pin; 3372 fan4min = fan4pin;
3372 3373
3373 if (data->kind == nct6791 || data->kind == nct6792 || 3374 if (data->kind == nct6791 || data->kind == nct6792 ||
3374 data->kind == nct6793) { 3375 data->kind == nct6793) {
3375 regval = superio_inb(sioreg, 0x2d); 3376 regval = superio_inb(sioreg, 0x2d);
3376 fan6pin = (regval & (1 << 1)); 3377 fan6pin = (regval & BIT(1));
3377 pwm6pin = (regval & (1 << 0)); 3378 pwm6pin = (regval & BIT(0));
3378 } else { /* NCT6779D */ 3379 } else { /* NCT6779D */
3379 fan6pin = false; 3380 fan6pin = false;
3380 pwm6pin = false; 3381 pwm6pin = false;
@@ -3403,7 +3404,7 @@ static void add_temp_sensors(struct nct6775_data *data, const u16 *regp,
3403 continue; 3404 continue;
3404 src = nct6775_read_value(data, regp[i]); 3405 src = nct6775_read_value(data, regp[i]);
3405 src &= 0x1f; 3406 src &= 0x1f;
3406 if (!src || (*mask & (1 << src))) 3407 if (!src || (*mask & BIT(src)))
3407 continue; 3408 continue;
3408 if (src >= data->temp_label_num || 3409 if (src >= data->temp_label_num ||
3409 !strlen(data->temp_label[src])) 3410 !strlen(data->temp_label[src]))
@@ -3411,8 +3412,8 @@ static void add_temp_sensors(struct nct6775_data *data, const u16 *regp,
3411 3412
3412 index = __ffs(*available); 3413 index = __ffs(*available);
3413 nct6775_write_value(data, data->REG_TEMP_SOURCE[index], src); 3414 nct6775_write_value(data, data->REG_TEMP_SOURCE[index], src);
3414 *available &= ~(1 << index); 3415 *available &= ~BIT(index);
3415 *mask |= 1 << src; 3416 *mask |= BIT(src);
3416 } 3417 }
3417} 3418}
3418 3419
@@ -3843,7 +3844,7 @@ static int nct6775_probe(struct platform_device *pdev)
3843 default: 3844 default:
3844 return -ENODEV; 3845 return -ENODEV;
3845 } 3846 }
3846 data->have_in = (1 << data->in_num) - 1; 3847 data->have_in = BIT(data->in_num) - 1;
3847 data->have_temp = 0; 3848 data->have_temp = 0;
3848 3849
3849 /* 3850 /*
@@ -3861,10 +3862,10 @@ static int nct6775_probe(struct platform_device *pdev)
3861 continue; 3862 continue;
3862 3863
3863 src = nct6775_read_value(data, data->REG_TEMP_SOURCE[i]) & 0x1f; 3864 src = nct6775_read_value(data, data->REG_TEMP_SOURCE[i]) & 0x1f;
3864 if (!src || (mask & (1 << src))) 3865 if (!src || (mask & BIT(src)))
3865 available |= 1 << i; 3866 available |= BIT(i);
3866 3867
3867 mask |= 1 << src; 3868 mask |= BIT(src);
3868 } 3869 }
3869 3870
3870 /* 3871 /*
@@ -3881,7 +3882,7 @@ static int nct6775_probe(struct platform_device *pdev)
3881 continue; 3882 continue;
3882 3883
3883 src = nct6775_read_value(data, data->REG_TEMP_SOURCE[i]) & 0x1f; 3884 src = nct6775_read_value(data, data->REG_TEMP_SOURCE[i]) & 0x1f;
3884 if (!src || (mask & (1 << src))) 3885 if (!src || (mask & BIT(src)))
3885 continue; 3886 continue;
3886 3887
3887 if (src >= data->temp_label_num || 3888 if (src >= data->temp_label_num ||
@@ -3892,12 +3893,12 @@ static int nct6775_probe(struct platform_device *pdev)
3892 continue; 3893 continue;
3893 } 3894 }
3894 3895
3895 mask |= 1 << src; 3896 mask |= BIT(src);
3896 3897
3897 /* Use fixed index for SYSTIN(1), CPUTIN(2), AUXTIN(3) */ 3898 /* Use fixed index for SYSTIN(1), CPUTIN(2), AUXTIN(3) */
3898 if (src <= data->temp_fixed_num) { 3899 if (src <= data->temp_fixed_num) {
3899 data->have_temp |= 1 << (src - 1); 3900 data->have_temp |= BIT(src - 1);
3900 data->have_temp_fixed |= 1 << (src - 1); 3901 data->have_temp_fixed |= BIT(src - 1);
3901 data->reg_temp[0][src - 1] = reg_temp[i]; 3902 data->reg_temp[0][src - 1] = reg_temp[i];
3902 data->reg_temp[1][src - 1] = reg_temp_over[i]; 3903 data->reg_temp[1][src - 1] = reg_temp_over[i];
3903 data->reg_temp[2][src - 1] = reg_temp_hyst[i]; 3904 data->reg_temp[2][src - 1] = reg_temp_hyst[i];
@@ -3917,7 +3918,7 @@ static int nct6775_probe(struct platform_device *pdev)
3917 continue; 3918 continue;
3918 3919
3919 /* Use dynamic index for other sources */ 3920 /* Use dynamic index for other sources */
3920 data->have_temp |= 1 << s; 3921 data->have_temp |= BIT(s);
3921 data->reg_temp[0][s] = reg_temp[i]; 3922 data->reg_temp[0][s] = reg_temp[i];
3922 data->reg_temp[1][s] = reg_temp_over[i]; 3923 data->reg_temp[1][s] = reg_temp_over[i];
3923 data->reg_temp[2][s] = reg_temp_hyst[i]; 3924 data->reg_temp[2][s] = reg_temp_hyst[i];
@@ -3960,17 +3961,17 @@ static int nct6775_probe(struct platform_device *pdev)
3960 * are no duplicates. 3961 * are no duplicates.
3961 */ 3962 */
3962 if (src != TEMP_SOURCE_VIRTUAL) { 3963 if (src != TEMP_SOURCE_VIRTUAL) {
3963 if (mask & (1 << src)) 3964 if (mask & BIT(src))
3964 continue; 3965 continue;
3965 mask |= 1 << src; 3966 mask |= BIT(src);
3966 } 3967 }
3967 3968
3968 /* Use fixed index for SYSTIN(1), CPUTIN(2), AUXTIN(3) */ 3969 /* Use fixed index for SYSTIN(1), CPUTIN(2), AUXTIN(3) */
3969 if (src <= data->temp_fixed_num) { 3970 if (src <= data->temp_fixed_num) {
3970 if (data->have_temp & (1 << (src - 1))) 3971 if (data->have_temp & BIT(src - 1))
3971 continue; 3972 continue;
3972 data->have_temp |= 1 << (src - 1); 3973 data->have_temp |= BIT(src - 1);
3973 data->have_temp_fixed |= 1 << (src - 1); 3974 data->have_temp_fixed |= BIT(src - 1);
3974 data->reg_temp[0][src - 1] = reg_temp_mon[i]; 3975 data->reg_temp[0][src - 1] = reg_temp_mon[i];
3975 data->temp_src[src - 1] = src; 3976 data->temp_src[src - 1] = src;
3976 continue; 3977 continue;
@@ -3980,7 +3981,7 @@ static int nct6775_probe(struct platform_device *pdev)
3980 continue; 3981 continue;
3981 3982
3982 /* Use dynamic index for other sources */ 3983 /* Use dynamic index for other sources */
3983 data->have_temp |= 1 << s; 3984 data->have_temp |= BIT(s);
3984 data->reg_temp[0][s] = reg_temp_mon[i]; 3985 data->reg_temp[0][s] = reg_temp_mon[i];
3985 data->temp_src[s] = src; 3986 data->temp_src[s] = src;
3986 s++; 3987 s++;
@@ -3996,13 +3997,13 @@ static int nct6775_probe(struct platform_device *pdev)
3996 for (i = 0; i < data->temp_label_num - 1; i++) { 3997 for (i = 0; i < data->temp_label_num - 1; i++) {
3997 if (!reg_temp_alternate[i]) 3998 if (!reg_temp_alternate[i])
3998 continue; 3999 continue;
3999 if (mask & (1 << (i + 1))) 4000 if (mask & BIT(i + 1))
4000 continue; 4001 continue;
4001 if (i < data->temp_fixed_num) { 4002 if (i < data->temp_fixed_num) {
4002 if (data->have_temp & (1 << i)) 4003 if (data->have_temp & BIT(i))
4003 continue; 4004 continue;
4004 data->have_temp |= 1 << i; 4005 data->have_temp |= BIT(i);
4005 data->have_temp_fixed |= 1 << i; 4006 data->have_temp_fixed |= BIT(i);
4006 data->reg_temp[0][i] = reg_temp_alternate[i]; 4007 data->reg_temp[0][i] = reg_temp_alternate[i];
4007 if (i < num_reg_temp) { 4008 if (i < num_reg_temp) {
4008 data->reg_temp[1][i] = reg_temp_over[i]; 4009 data->reg_temp[1][i] = reg_temp_over[i];
@@ -4015,7 +4016,7 @@ static int nct6775_probe(struct platform_device *pdev)
4015 if (s >= NUM_TEMP) /* Abort if no more space */ 4016 if (s >= NUM_TEMP) /* Abort if no more space */
4016 break; 4017 break;
4017 4018
4018 data->have_temp |= 1 << s; 4019 data->have_temp |= BIT(s);
4019 data->reg_temp[0][s] = reg_temp_alternate[i]; 4020 data->reg_temp[0][s] = reg_temp_alternate[i];
4020 data->temp_src[s] = i + 1; 4021 data->temp_src[s] = i + 1;
4021 s++; 4022 s++;
@@ -4180,7 +4181,7 @@ static int __maybe_unused nct6775_resume(struct device *dev)
4180 4181
4181 /* Restore limits */ 4182 /* Restore limits */
4182 for (i = 0; i < data->in_num; i++) { 4183 for (i = 0; i < data->in_num; i++) {
4183 if (!(data->have_in & (1 << i))) 4184 if (!(data->have_in & BIT(i)))
4184 continue; 4185 continue;
4185 4186
4186 nct6775_write_value(data, data->REG_IN_MINMAX[0][i], 4187 nct6775_write_value(data, data->REG_IN_MINMAX[0][i],
@@ -4190,7 +4191,7 @@ static int __maybe_unused nct6775_resume(struct device *dev)
4190 } 4191 }
4191 4192
4192 for (i = 0; i < ARRAY_SIZE(data->fan_min); i++) { 4193 for (i = 0; i < ARRAY_SIZE(data->fan_min); i++) {
4193 if (!(data->has_fan_min & (1 << i))) 4194 if (!(data->has_fan_min & BIT(i)))
4194 continue; 4195 continue;
4195 4196
4196 nct6775_write_value(data, data->REG_FAN_MIN[i], 4197 nct6775_write_value(data, data->REG_FAN_MIN[i],
@@ -4198,7 +4199,7 @@ static int __maybe_unused nct6775_resume(struct device *dev)
4198 } 4199 }
4199 4200
4200 for (i = 0; i < NUM_TEMP; i++) { 4201 for (i = 0; i < NUM_TEMP; i++) {
4201 if (!(data->have_temp & (1 << i))) 4202 if (!(data->have_temp & BIT(i)))
4202 continue; 4203 continue;
4203 4204
4204 for (j = 1; j < ARRAY_SIZE(data->reg_temp); j++) 4205 for (j = 1; j < ARRAY_SIZE(data->reg_temp); j++)