Skip to content

Commit a9c2f41

Browse files
committed
hwmon: (amc6821) Use BIT() and GENMASK()
Use BIT() and GENMASK() for bit and mask definitions to help distinguish bit and mask definitions from other defines and to make the code easier to read. No functional change intended. Reviewed-by: Quentin Schulz <[email protected]> Signed-off-by: Guenter Roeck <[email protected]>
1 parent d632e82 commit a9c2f41

File tree

1 file changed

+41
-40
lines changed

1 file changed

+41
-40
lines changed

drivers/hwmon/amc6821.c

Lines changed: 41 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
* Copyright (C) 2007 Hans J. Koch <[email protected]>
99
*/
1010

11+
#include <linux/bits.h>
1112
#include <linux/err.h>
1213
#include <linux/hwmon.h>
1314
#include <linux/hwmon-sysfs.h>
@@ -68,46 +69,46 @@ enum chips { amc6821 };
6869
#define AMC6821_REG_TACH_SETTINGL 0x1e
6970
#define AMC6821_REG_TACH_SETTINGH 0x1f
7071

71-
#define AMC6821_CONF1_START 0x01
72-
#define AMC6821_CONF1_FAN_INT_EN 0x02
73-
#define AMC6821_CONF1_FANIE 0x04
74-
#define AMC6821_CONF1_PWMINV 0x08
75-
#define AMC6821_CONF1_FAN_FAULT_EN 0x10
76-
#define AMC6821_CONF1_FDRC0 0x20
77-
#define AMC6821_CONF1_FDRC1 0x40
78-
#define AMC6821_CONF1_THERMOVIE 0x80
79-
80-
#define AMC6821_CONF2_PWM_EN 0x01
81-
#define AMC6821_CONF2_TACH_MODE 0x02
82-
#define AMC6821_CONF2_TACH_EN 0x04
83-
#define AMC6821_CONF2_RTFIE 0x08
84-
#define AMC6821_CONF2_LTOIE 0x10
85-
#define AMC6821_CONF2_RTOIE 0x20
86-
#define AMC6821_CONF2_PSVIE 0x40
87-
#define AMC6821_CONF2_RST 0x80
88-
89-
#define AMC6821_CONF3_THERM_FAN_EN 0x80
90-
#define AMC6821_CONF3_REV_MASK 0x0F
91-
92-
#define AMC6821_CONF4_OVREN 0x10
93-
#define AMC6821_CONF4_TACH_FAST 0x20
94-
#define AMC6821_CONF4_PSPR 0x40
95-
#define AMC6821_CONF4_MODE 0x80
96-
97-
#define AMC6821_STAT1_RPM_ALARM 0x01
98-
#define AMC6821_STAT1_FANS 0x02
99-
#define AMC6821_STAT1_RTH 0x04
100-
#define AMC6821_STAT1_RTL 0x08
101-
#define AMC6821_STAT1_R_THERM 0x10
102-
#define AMC6821_STAT1_RTF 0x20
103-
#define AMC6821_STAT1_LTH 0x40
104-
#define AMC6821_STAT1_LTL 0x80
105-
106-
#define AMC6821_STAT2_RTC 0x08
107-
#define AMC6821_STAT2_LTC 0x10
108-
#define AMC6821_STAT2_LPSV 0x20
109-
#define AMC6821_STAT2_L_THERM 0x40
110-
#define AMC6821_STAT2_THERM_IN 0x80
72+
#define AMC6821_CONF1_START BIT(0)
73+
#define AMC6821_CONF1_FAN_INT_EN BIT(1)
74+
#define AMC6821_CONF1_FANIE BIT(2)
75+
#define AMC6821_CONF1_PWMINV BIT(3)
76+
#define AMC6821_CONF1_FAN_FAULT_EN BIT(4)
77+
#define AMC6821_CONF1_FDRC0 BIT(5)
78+
#define AMC6821_CONF1_FDRC1 BIT(6)
79+
#define AMC6821_CONF1_THERMOVIE BIT(7)
80+
81+
#define AMC6821_CONF2_PWM_EN BIT(0)
82+
#define AMC6821_CONF2_TACH_MODE BIT(1)
83+
#define AMC6821_CONF2_TACH_EN BIT(2)
84+
#define AMC6821_CONF2_RTFIE BIT(3)
85+
#define AMC6821_CONF2_LTOIE BIT(4)
86+
#define AMC6821_CONF2_RTOIE BIT(5)
87+
#define AMC6821_CONF2_PSVIE BIT(6)
88+
#define AMC6821_CONF2_RST BIT(7)
89+
90+
#define AMC6821_CONF3_THERM_FAN_EN BIT(7)
91+
#define AMC6821_CONF3_REV_MASK GENMASK(3, 0)
92+
93+
#define AMC6821_CONF4_OVREN BIT(4)
94+
#define AMC6821_CONF4_TACH_FAST BIT(5)
95+
#define AMC6821_CONF4_PSPR BIT(6)
96+
#define AMC6821_CONF4_MODE BIT(7)
97+
98+
#define AMC6821_STAT1_RPM_ALARM BIT(0)
99+
#define AMC6821_STAT1_FANS BIT(1)
100+
#define AMC6821_STAT1_RTH BIT(2)
101+
#define AMC6821_STAT1_RTL BIT(3)
102+
#define AMC6821_STAT1_R_THERM BIT(4)
103+
#define AMC6821_STAT1_RTF BIT(5)
104+
#define AMC6821_STAT1_LTH BIT(6)
105+
#define AMC6821_STAT1_LTL BIT(7)
106+
107+
#define AMC6821_STAT2_RTC BIT(3)
108+
#define AMC6821_STAT2_LTC BIT(4)
109+
#define AMC6821_STAT2_LPSV BIT(5)
110+
#define AMC6821_STAT2_L_THERM BIT(6)
111+
#define AMC6821_STAT2_THERM_IN BIT(7)
111112

112113
enum {IDX_TEMP1_INPUT = 0, IDX_TEMP1_MIN, IDX_TEMP1_MAX,
113114
IDX_TEMP1_CRIT, IDX_TEMP2_INPUT, IDX_TEMP2_MIN,

0 commit comments

Comments
 (0)