diff options
author | Jean Delvare <khali@linux-fr.org> | 2010-10-28 14:31:48 -0400 |
---|---|---|
committer | Jean Delvare <khali@endymion.delvare> | 2010-10-28 14:31:48 -0400 |
commit | cd316df582925f3dab1ce5863651b3e260687035 (patch) | |
tree | 9f0f6918f00e41afe92f7f681dc0ace9a964cccb /drivers/hwmon/w83795.c | |
parent | 49c7347a44224b5b87c7e6a3c6c92619d77c06d5 (diff) |
hwmon: (w83795) Drop _NUM constants
Consistently use ARRAY_SIZE() to control for loops.
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Diffstat (limited to 'drivers/hwmon/w83795.c')
-rw-r--r-- | drivers/hwmon/w83795.c | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/drivers/hwmon/w83795.c b/drivers/hwmon/w83795.c index 4e54edc415d7..c8f62044ac19 100644 --- a/drivers/hwmon/w83795.c +++ b/drivers/hwmon/w83795.c | |||
@@ -145,8 +145,6 @@ static const u8 W83795_REG_IN_HL_LSB[] = { | |||
145 | (((type) == 1) ? W83795_REG_IN_HL_LSB[(index)] \ | 145 | (((type) == 1) ? W83795_REG_IN_HL_LSB[(index)] \ |
146 | : (W83795_REG_IN_HL_LSB[(index)] + 1)) | 146 | : (W83795_REG_IN_HL_LSB[(index)] + 1)) |
147 | 147 | ||
148 | #define IN_LSB_REG_NUM 10 | ||
149 | |||
150 | #define IN_LSB_SHIFT 0 | 148 | #define IN_LSB_SHIFT 0 |
151 | #define IN_LSB_IDX 1 | 149 | #define IN_LSB_IDX 1 |
152 | static const u8 IN_LSB_SHIFT_IDX[][2] = { | 150 | static const u8 IN_LSB_SHIFT_IDX[][2] = { |
@@ -183,14 +181,12 @@ static const u8 IN_LSB_SHIFT_IDX[][2] = { | |||
183 | 181 | ||
184 | #define W83795_REG_VID_CTRL 0x6A | 182 | #define W83795_REG_VID_CTRL 0x6A |
185 | 183 | ||
186 | #define ALARM_BEEP_REG_NUM 6 | ||
187 | #define W83795_REG_ALARM(index) (0x41 + (index)) | 184 | #define W83795_REG_ALARM(index) (0x41 + (index)) |
188 | #define W83795_REG_BEEP(index) (0x50 + (index)) | 185 | #define W83795_REG_BEEP(index) (0x50 + (index)) |
189 | 186 | ||
190 | #define W83795_REG_CLR_CHASSIS 0x4D | 187 | #define W83795_REG_CLR_CHASSIS 0x4D |
191 | 188 | ||
192 | 189 | ||
193 | #define W83795_REG_TEMP_NUM 6 | ||
194 | #define W83795_REG_FCMS1 0x201 | 190 | #define W83795_REG_FCMS1 0x201 |
195 | #define W83795_REG_FCMS2 0x208 | 191 | #define W83795_REG_FCMS2 0x208 |
196 | #define W83795_REG_TFMR(index) (0x202 + (index)) | 192 | #define W83795_REG_TFMR(index) (0x202 + (index)) |
@@ -545,7 +541,7 @@ static struct w83795_data *w83795_update_device(struct device *dev) | |||
545 | } | 541 | } |
546 | 542 | ||
547 | /* update alarm */ | 543 | /* update alarm */ |
548 | for (i = 0; i < ALARM_BEEP_REG_NUM; i++) | 544 | for (i = 0; i < ARRAY_SIZE(data->alarms); i++) |
549 | data->alarms[i] = w83795_read(client, W83795_REG_ALARM(i)); | 545 | data->alarms[i] = w83795_read(client, W83795_REG_ALARM(i)); |
550 | 546 | ||
551 | data->last_updated = jiffies; | 547 | data->last_updated = jiffies; |
@@ -1978,7 +1974,7 @@ static int w83795_probe(struct i2c_client *client, | |||
1978 | tmp |= w83795_read(client, W83795_REG_VRLSB) >> 6; | 1974 | tmp |= w83795_read(client, W83795_REG_VRLSB) >> 6; |
1979 | data->in[i][IN_READ] = tmp; | 1975 | data->in[i][IN_READ] = tmp; |
1980 | } | 1976 | } |
1981 | for (i = 0; i < IN_LSB_REG_NUM; i++) { | 1977 | for (i = 0; i < ARRAY_SIZE(data->in_lsb); i++) { |
1982 | if ((i == 2 && data->chip_type == w83795adg) || | 1978 | if ((i == 2 && data->chip_type == w83795adg) || |
1983 | (i >= 4 && !(data->has_in & (1 << (i + 11))))) | 1979 | (i >= 4 && !(data->has_in & (1 << (i + 11))))) |
1984 | continue; | 1980 | continue; |
@@ -2054,7 +2050,7 @@ static int w83795_probe(struct i2c_client *client, | |||
2054 | data->has_pwm = 2; | 2050 | data->has_pwm = 2; |
2055 | data->pwm_fcms[0] = w83795_read(client, W83795_REG_FCMS1); | 2051 | data->pwm_fcms[0] = w83795_read(client, W83795_REG_FCMS1); |
2056 | data->pwm_fcms[1] = w83795_read(client, W83795_REG_FCMS2); | 2052 | data->pwm_fcms[1] = w83795_read(client, W83795_REG_FCMS2); |
2057 | for (i = 0; i < W83795_REG_TEMP_NUM; i++) | 2053 | for (i = 0; i < ARRAY_SIZE(data->pwm_tfmr); i++) |
2058 | data->pwm_tfmr[i] = w83795_read(client, W83795_REG_TFMR(i)); | 2054 | data->pwm_tfmr[i] = w83795_read(client, W83795_REG_TFMR(i)); |
2059 | data->pwm_fomc = w83795_read(client, W83795_REG_FOMC); | 2055 | data->pwm_fomc = w83795_read(client, W83795_REG_FOMC); |
2060 | for (i = 0; i < data->has_pwm; i++) { | 2056 | for (i = 0; i < data->has_pwm; i++) { |
@@ -2071,7 +2067,7 @@ static int w83795_probe(struct i2c_client *client, | |||
2071 | } | 2067 | } |
2072 | data->tol_speed = w83795_read(client, W83795_REG_TFTS) & 0x3f; | 2068 | data->tol_speed = w83795_read(client, W83795_REG_TFTS) & 0x3f; |
2073 | 2069 | ||
2074 | for (i = 0; i < W83795_REG_TEMP_NUM; i++) { | 2070 | for (i = 0; i < ARRAY_SIZE(data->pwm_temp); i++) { |
2075 | data->pwm_temp[i][TEMP_PWM_TTTI] = | 2071 | data->pwm_temp[i][TEMP_PWM_TTTI] = |
2076 | w83795_read(client, W83795_REG_TTTI(i)) & 0x7f; | 2072 | w83795_read(client, W83795_REG_TTTI(i)) & 0x7f; |
2077 | data->pwm_temp[i][TEMP_PWM_CTFS] = | 2073 | data->pwm_temp[i][TEMP_PWM_CTFS] = |
@@ -2080,7 +2076,7 @@ static int w83795_probe(struct i2c_client *client, | |||
2080 | data->pwm_temp[i][TEMP_PWM_HCT] = (tmp >> 4) & 0x0f; | 2076 | data->pwm_temp[i][TEMP_PWM_HCT] = (tmp >> 4) & 0x0f; |
2081 | data->pwm_temp[i][TEMP_PWM_HOT] = tmp & 0x0f; | 2077 | data->pwm_temp[i][TEMP_PWM_HOT] = tmp & 0x0f; |
2082 | } | 2078 | } |
2083 | for (i = 0; i < W83795_REG_TEMP_NUM; i++) { | 2079 | for (i = 0; i < ARRAY_SIZE(data->sf4_reg); i++) { |
2084 | for (tmp = 0; tmp < 7; tmp++) { | 2080 | for (tmp = 0; tmp < 7; tmp++) { |
2085 | data->sf4_reg[i][SF4_TEMP][tmp] = | 2081 | data->sf4_reg[i][SF4_TEMP][tmp] = |
2086 | w83795_read(client, | 2082 | w83795_read(client, |
@@ -2097,7 +2093,7 @@ static int w83795_probe(struct i2c_client *client, | |||
2097 | } | 2093 | } |
2098 | 2094 | ||
2099 | /* alarm and beep */ | 2095 | /* alarm and beep */ |
2100 | for (i = 0; i < ALARM_BEEP_REG_NUM; i++) { | 2096 | for (i = 0; i < ARRAY_SIZE(data->alarms); i++) { |
2101 | data->alarms[i] = w83795_read(client, W83795_REG_ALARM(i)); | 2097 | data->alarms[i] = w83795_read(client, W83795_REG_ALARM(i)); |
2102 | data->beeps[i] = w83795_read(client, W83795_REG_BEEP(i)); | 2098 | data->beeps[i] = w83795_read(client, W83795_REG_BEEP(i)); |
2103 | } | 2099 | } |