diff options
author | Jean Delvare <khali@linux-fr.org> | 2010-10-28 20:31:48 +0200 |
---|---|---|
committer | Jean Delvare <khali@endymion.delvare> | 2010-10-28 20:31:48 +0200 |
commit | cd316df582925f3dab1ce5863651b3e260687035 (patch) | |
tree | 9f0f6918f00e41afe92f7f681dc0ace9a964cccb /drivers/hwmon | |
parent | 49c7347a44224b5b87c7e6a3c6c92619d77c06d5 (diff) | |
download | kernel_samsung_aries-cd316df582925f3dab1ce5863651b3e260687035.zip kernel_samsung_aries-cd316df582925f3dab1ce5863651b3e260687035.tar.gz kernel_samsung_aries-cd316df582925f3dab1ce5863651b3e260687035.tar.bz2 |
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')
-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 4e54edc..c8f6204 100644 --- a/drivers/hwmon/w83795.c +++ b/drivers/hwmon/w83795.c @@ -145,8 +145,6 @@ static const u8 W83795_REG_IN_HL_LSB[] = { (((type) == 1) ? W83795_REG_IN_HL_LSB[(index)] \ : (W83795_REG_IN_HL_LSB[(index)] + 1)) -#define IN_LSB_REG_NUM 10 - #define IN_LSB_SHIFT 0 #define IN_LSB_IDX 1 static const u8 IN_LSB_SHIFT_IDX[][2] = { @@ -183,14 +181,12 @@ static const u8 IN_LSB_SHIFT_IDX[][2] = { #define W83795_REG_VID_CTRL 0x6A -#define ALARM_BEEP_REG_NUM 6 #define W83795_REG_ALARM(index) (0x41 + (index)) #define W83795_REG_BEEP(index) (0x50 + (index)) #define W83795_REG_CLR_CHASSIS 0x4D -#define W83795_REG_TEMP_NUM 6 #define W83795_REG_FCMS1 0x201 #define W83795_REG_FCMS2 0x208 #define W83795_REG_TFMR(index) (0x202 + (index)) @@ -545,7 +541,7 @@ static struct w83795_data *w83795_update_device(struct device *dev) } /* update alarm */ - for (i = 0; i < ALARM_BEEP_REG_NUM; i++) + for (i = 0; i < ARRAY_SIZE(data->alarms); i++) data->alarms[i] = w83795_read(client, W83795_REG_ALARM(i)); data->last_updated = jiffies; @@ -1978,7 +1974,7 @@ static int w83795_probe(struct i2c_client *client, tmp |= w83795_read(client, W83795_REG_VRLSB) >> 6; data->in[i][IN_READ] = tmp; } - for (i = 0; i < IN_LSB_REG_NUM; i++) { + for (i = 0; i < ARRAY_SIZE(data->in_lsb); i++) { if ((i == 2 && data->chip_type == w83795adg) || (i >= 4 && !(data->has_in & (1 << (i + 11))))) continue; @@ -2054,7 +2050,7 @@ static int w83795_probe(struct i2c_client *client, data->has_pwm = 2; data->pwm_fcms[0] = w83795_read(client, W83795_REG_FCMS1); data->pwm_fcms[1] = w83795_read(client, W83795_REG_FCMS2); - for (i = 0; i < W83795_REG_TEMP_NUM; i++) + for (i = 0; i < ARRAY_SIZE(data->pwm_tfmr); i++) data->pwm_tfmr[i] = w83795_read(client, W83795_REG_TFMR(i)); data->pwm_fomc = w83795_read(client, W83795_REG_FOMC); for (i = 0; i < data->has_pwm; i++) { @@ -2071,7 +2067,7 @@ static int w83795_probe(struct i2c_client *client, } data->tol_speed = w83795_read(client, W83795_REG_TFTS) & 0x3f; - for (i = 0; i < W83795_REG_TEMP_NUM; i++) { + for (i = 0; i < ARRAY_SIZE(data->pwm_temp); i++) { data->pwm_temp[i][TEMP_PWM_TTTI] = w83795_read(client, W83795_REG_TTTI(i)) & 0x7f; data->pwm_temp[i][TEMP_PWM_CTFS] = @@ -2080,7 +2076,7 @@ static int w83795_probe(struct i2c_client *client, data->pwm_temp[i][TEMP_PWM_HCT] = (tmp >> 4) & 0x0f; data->pwm_temp[i][TEMP_PWM_HOT] = tmp & 0x0f; } - for (i = 0; i < W83795_REG_TEMP_NUM; i++) { + for (i = 0; i < ARRAY_SIZE(data->sf4_reg); i++) { for (tmp = 0; tmp < 7; tmp++) { data->sf4_reg[i][SF4_TEMP][tmp] = w83795_read(client, @@ -2097,7 +2093,7 @@ static int w83795_probe(struct i2c_client *client, } /* alarm and beep */ - for (i = 0; i < ALARM_BEEP_REG_NUM; i++) { + for (i = 0; i < ARRAY_SIZE(data->alarms); i++) { data->alarms[i] = w83795_read(client, W83795_REG_ALARM(i)); data->beeps[i] = w83795_read(client, W83795_REG_BEEP(i)); } |