Commit 0c71bf1c authored by Robert P. J. Day's avatar Robert P. J. Day Committed by Mauro Carvalho Chehab

V4L/DVB (5739): Replace C code with calls to ARRAY_SIZE macro.

Signed-off-by: default avatarRobert P. J. Day <rpjday@mindspring.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@infradead.org>
parent e0099e9e
...@@ -478,7 +478,7 @@ struct dvb_frontend* tda10023_attach(const struct tda1002x_config* config, ...@@ -478,7 +478,7 @@ struct dvb_frontend* tda10023_attach(const struct tda1002x_config* config,
state->i2c = i2c; state->i2c = i2c;
memcpy(&state->frontend.ops, &tda10023_ops, sizeof(struct dvb_frontend_ops)); memcpy(&state->frontend.ops, &tda10023_ops, sizeof(struct dvb_frontend_ops));
state->pwm = pwm; state->pwm = pwm;
for (i=0; i < sizeof(tda10023_inittab)/sizeof(*tda10023_inittab);i+=3) { for (i=0; i < ARRAY_SIZE(tda10023_inittab);i+=3) {
if (tda10023_inittab[i] == 0x00) { if (tda10023_inittab[i] == 0x00) {
state->reg0 = tda10023_inittab[i+2]; state->reg0 = tda10023_inittab[i+2];
break; break;
......
...@@ -105,7 +105,7 @@ static struct control_menu_info framerate_controls[] = ...@@ -105,7 +105,7 @@ static struct control_menu_info framerate_controls[] =
{ CPIA2_VP_FRAMERATE_25, "25 fps" }, { CPIA2_VP_FRAMERATE_25, "25 fps" },
{ CPIA2_VP_FRAMERATE_30, "30 fps" }, { CPIA2_VP_FRAMERATE_30, "30 fps" },
}; };
#define NUM_FRAMERATE_CONTROLS (sizeof(framerate_controls)/sizeof(framerate_controls[0])) #define NUM_FRAMERATE_CONTROLS (ARRAY_SIZE(framerate_controls))
static struct control_menu_info flicker_controls[] = static struct control_menu_info flicker_controls[] =
{ {
...@@ -113,7 +113,7 @@ static struct control_menu_info flicker_controls[] = ...@@ -113,7 +113,7 @@ static struct control_menu_info flicker_controls[] =
{ FLICKER_50, "50 Hz" }, { FLICKER_50, "50 Hz" },
{ FLICKER_60, "60 Hz" }, { FLICKER_60, "60 Hz" },
}; };
#define NUM_FLICKER_CONTROLS (sizeof(flicker_controls)/sizeof(flicker_controls[0])) #define NUM_FLICKER_CONTROLS (ARRAY_SIZE(flicker_controls))
static struct control_menu_info lights_controls[] = static struct control_menu_info lights_controls[] =
{ {
...@@ -122,7 +122,7 @@ static struct control_menu_info lights_controls[] = ...@@ -122,7 +122,7 @@ static struct control_menu_info lights_controls[] =
{ 128, "Bottom" }, { 128, "Bottom" },
{ 192, "Both" }, { 192, "Both" },
}; };
#define NUM_LIGHTS_CONTROLS (sizeof(lights_controls)/sizeof(lights_controls[0])) #define NUM_LIGHTS_CONTROLS (ARRAY_SIZE(lights_controls))
#define GPIO_LIGHTS_MASK 192 #define GPIO_LIGHTS_MASK 192
static struct v4l2_queryctrl controls[] = { static struct v4l2_queryctrl controls[] = {
...@@ -235,7 +235,7 @@ static struct v4l2_queryctrl controls[] = { ...@@ -235,7 +235,7 @@ static struct v4l2_queryctrl controls[] = {
.default_value = 0, .default_value = 0,
}, },
}; };
#define NUM_CONTROLS (sizeof(controls)/sizeof(controls[0])) #define NUM_CONTROLS (ARRAY_SIZE(controls))
/****************************************************************************** /******************************************************************************
......
...@@ -617,7 +617,7 @@ static struct ov7670_win_size { ...@@ -617,7 +617,7 @@ static struct ov7670_win_size {
}, },
}; };
#define N_WIN_SIZES (sizeof(ov7670_win_sizes)/sizeof(ov7670_win_sizes[0])) #define N_WIN_SIZES (ARRAY_SIZE(ov7670_win_sizes))
/* /*
...@@ -1183,7 +1183,7 @@ static struct ov7670_control { ...@@ -1183,7 +1183,7 @@ static struct ov7670_control {
.query = ov7670_q_hflip, .query = ov7670_q_hflip,
}, },
}; };
#define N_CONTROLS (sizeof(ov7670_controls)/sizeof(ov7670_controls[0])) #define N_CONTROLS (ARRAY_SIZE(ov7670_controls))
static struct ov7670_control *ov7670_find_control(__u32 id) static struct ov7670_control *ov7670_find_control(__u32 id)
{ {
......
...@@ -490,7 +490,7 @@ void tveeprom_hauppauge_analog(struct i2c_client *c, struct tveeprom *tvee, ...@@ -490,7 +490,7 @@ void tveeprom_hauppauge_analog(struct i2c_client *c, struct tveeprom *tvee,
to indicate 4052 mux was removed in favor of using MSP to indicate 4052 mux was removed in favor of using MSP
inputs directly. */ inputs directly. */
audioic = eeprom_data[i+2] & 0x7f; audioic = eeprom_data[i+2] & 0x7f;
if (audioic < sizeof(audioIC)/sizeof(*audioIC)) if (audioic < ARRAY_SIZE(audioIC))
tvee->audio_processor = audioIC[audioic].id; tvee->audio_processor = audioIC[audioic].id;
else else
tvee->audio_processor = AUDIO_CHIP_UNKNOWN; tvee->audio_processor = AUDIO_CHIP_UNKNOWN;
...@@ -523,7 +523,7 @@ void tveeprom_hauppauge_analog(struct i2c_client *c, struct tveeprom *tvee, ...@@ -523,7 +523,7 @@ void tveeprom_hauppauge_analog(struct i2c_client *c, struct tveeprom *tvee,
to indicate 4052 mux was removed in favor of using MSP to indicate 4052 mux was removed in favor of using MSP
inputs directly. */ inputs directly. */
audioic = eeprom_data[i+1] & 0x7f; audioic = eeprom_data[i+1] & 0x7f;
if (audioic < sizeof(audioIC)/sizeof(*audioIC)) if (audioic < ARRAY_SIZE(audioIC))
tvee->audio_processor = audioIC[audioic].id; tvee->audio_processor = audioIC[audioic].id;
else else
tvee->audio_processor = AUDIO_CHIP_UNKNOWN; tvee->audio_processor = AUDIO_CHIP_UNKNOWN;
...@@ -678,7 +678,7 @@ void tveeprom_hauppauge_analog(struct i2c_client *c, struct tveeprom *tvee, ...@@ -678,7 +678,7 @@ void tveeprom_hauppauge_analog(struct i2c_client *c, struct tveeprom *tvee,
tveeprom_info("audio processor is unknown (no idx)\n"); tveeprom_info("audio processor is unknown (no idx)\n");
tvee->audio_processor=AUDIO_CHIP_UNKNOWN; tvee->audio_processor=AUDIO_CHIP_UNKNOWN;
} else { } else {
if (audioic < sizeof(audioIC)/sizeof(*audioIC)) if (audioic < ARRAY_SIZE(audioIC))
tveeprom_info("audio processor is %s (idx %d)\n", tveeprom_info("audio processor is %s (idx %d)\n",
audioIC[audioic].name,audioic); audioIC[audioic].name,audioic);
else else
......
...@@ -1006,7 +1006,7 @@ static int tvp5150_command(struct i2c_client *c, ...@@ -1006,7 +1006,7 @@ static int tvp5150_command(struct i2c_client *c,
{ {
struct v4l2_control *ctrl = arg; struct v4l2_control *ctrl = arg;
u8 i, n; u8 i, n;
n = sizeof(tvp5150_qctrl) / sizeof(tvp5150_qctrl[0]); n = ARRAY_SIZE(tvp5150_qctrl);
for (i = 0; i < n; i++) for (i = 0; i < n; i++)
if (ctrl->id == tvp5150_qctrl[i].id) { if (ctrl->id == tvp5150_qctrl[i].id) {
if (ctrl->value < if (ctrl->value <
......
...@@ -439,7 +439,7 @@ static int qcm_sensor_init(struct uvd *uvd) ...@@ -439,7 +439,7 @@ static int qcm_sensor_init(struct uvd *uvd)
int ret; int ret;
int i; int i;
for (i=0; i < sizeof(regval_table)/sizeof(regval_table[0]) ; i++) { for (i=0; i < ARRAY_SIZE(regval_table) ; i++) {
CHECK_RET(ret, qcm_stv_setb(uvd->dev, CHECK_RET(ret, qcm_stv_setb(uvd->dev,
regval_table[i].reg, regval_table[i].reg,
regval_table[i].val)); regval_table[i].val));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment