aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobert P. J. Day <rpjday@mindspring.com>2007-06-05 04:20:56 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2007-07-18 13:23:52 -0400
commit0c71bf1c3065e80cc3ab91293829169bdeda2c42 (patch)
treed38b375f6d8cb7cb5acc8eb80bb93539b6fb2909
parente0099e9edabd855bf83d3f57b1843f0b06bfb19d (diff)
V4L/DVB (5739): Replace C code with calls to ARRAY_SIZE macro.
Signed-off-by: Robert P. J. Day <rpjday@mindspring.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
-rw-r--r--drivers/media/dvb/frontends/tda10023.c2
-rw-r--r--drivers/media/video/cpia2/cpia2_v4l.c8
-rw-r--r--drivers/media/video/ov7670.c4
-rw-r--r--drivers/media/video/tveeprom.c6
-rw-r--r--drivers/media/video/tvp5150.c2
-rw-r--r--drivers/media/video/usbvideo/quickcam_messenger.c2
6 files changed, 12 insertions, 12 deletions
diff --git a/drivers/media/dvb/frontends/tda10023.c b/drivers/media/dvb/frontends/tda10023.c
index da796e784be3..4bb06f97938b 100644
--- a/drivers/media/dvb/frontends/tda10023.c
+++ b/drivers/media/dvb/frontends/tda10023.c
@@ -478,7 +478,7 @@ struct dvb_frontend* tda10023_attach(const struct tda1002x_config* config,
478 state->i2c = i2c; 478 state->i2c = i2c;
479 memcpy(&state->frontend.ops, &tda10023_ops, sizeof(struct dvb_frontend_ops)); 479 memcpy(&state->frontend.ops, &tda10023_ops, sizeof(struct dvb_frontend_ops));
480 state->pwm = pwm; 480 state->pwm = pwm;
481 for (i=0; i < sizeof(tda10023_inittab)/sizeof(*tda10023_inittab);i+=3) { 481 for (i=0; i < ARRAY_SIZE(tda10023_inittab);i+=3) {
482 if (tda10023_inittab[i] == 0x00) { 482 if (tda10023_inittab[i] == 0x00) {
483 state->reg0 = tda10023_inittab[i+2]; 483 state->reg0 = tda10023_inittab[i+2];
484 break; 484 break;
diff --git a/drivers/media/video/cpia2/cpia2_v4l.c b/drivers/media/video/cpia2/cpia2_v4l.c
index 1bda7ad9de11..92778cd1d735 100644
--- a/drivers/media/video/cpia2/cpia2_v4l.c
+++ b/drivers/media/video/cpia2/cpia2_v4l.c
@@ -105,7 +105,7 @@ static struct control_menu_info framerate_controls[] =
105 { CPIA2_VP_FRAMERATE_25, "25 fps" }, 105 { CPIA2_VP_FRAMERATE_25, "25 fps" },
106 { CPIA2_VP_FRAMERATE_30, "30 fps" }, 106 { CPIA2_VP_FRAMERATE_30, "30 fps" },
107}; 107};
108#define NUM_FRAMERATE_CONTROLS (sizeof(framerate_controls)/sizeof(framerate_controls[0])) 108#define NUM_FRAMERATE_CONTROLS (ARRAY_SIZE(framerate_controls))
109 109
110static struct control_menu_info flicker_controls[] = 110static struct control_menu_info flicker_controls[] =
111{ 111{
@@ -113,7 +113,7 @@ static struct control_menu_info flicker_controls[] =
113 { FLICKER_50, "50 Hz" }, 113 { FLICKER_50, "50 Hz" },
114 { FLICKER_60, "60 Hz" }, 114 { FLICKER_60, "60 Hz" },
115}; 115};
116#define NUM_FLICKER_CONTROLS (sizeof(flicker_controls)/sizeof(flicker_controls[0])) 116#define NUM_FLICKER_CONTROLS (ARRAY_SIZE(flicker_controls))
117 117
118static struct control_menu_info lights_controls[] = 118static struct control_menu_info lights_controls[] =
119{ 119{
@@ -122,7 +122,7 @@ static struct control_menu_info lights_controls[] =
122 { 128, "Bottom" }, 122 { 128, "Bottom" },
123 { 192, "Both" }, 123 { 192, "Both" },
124}; 124};
125#define NUM_LIGHTS_CONTROLS (sizeof(lights_controls)/sizeof(lights_controls[0])) 125#define NUM_LIGHTS_CONTROLS (ARRAY_SIZE(lights_controls))
126#define GPIO_LIGHTS_MASK 192 126#define GPIO_LIGHTS_MASK 192
127 127
128static struct v4l2_queryctrl controls[] = { 128static struct v4l2_queryctrl controls[] = {
@@ -235,7 +235,7 @@ static struct v4l2_queryctrl controls[] = {
235 .default_value = 0, 235 .default_value = 0,
236 }, 236 },
237}; 237};
238#define NUM_CONTROLS (sizeof(controls)/sizeof(controls[0])) 238#define NUM_CONTROLS (ARRAY_SIZE(controls))
239 239
240 240
241/****************************************************************************** 241/******************************************************************************
diff --git a/drivers/media/video/ov7670.c b/drivers/media/video/ov7670.c
index 3ceb8a6249dd..f8f21ddd9843 100644
--- a/drivers/media/video/ov7670.c
+++ b/drivers/media/video/ov7670.c
@@ -617,7 +617,7 @@ static struct ov7670_win_size {
617 }, 617 },
618}; 618};
619 619
620#define N_WIN_SIZES (sizeof(ov7670_win_sizes)/sizeof(ov7670_win_sizes[0])) 620#define N_WIN_SIZES (ARRAY_SIZE(ov7670_win_sizes))
621 621
622 622
623/* 623/*
@@ -1183,7 +1183,7 @@ static struct ov7670_control {
1183 .query = ov7670_q_hflip, 1183 .query = ov7670_q_hflip,
1184 }, 1184 },
1185}; 1185};
1186#define N_CONTROLS (sizeof(ov7670_controls)/sizeof(ov7670_controls[0])) 1186#define N_CONTROLS (ARRAY_SIZE(ov7670_controls))
1187 1187
1188static struct ov7670_control *ov7670_find_control(__u32 id) 1188static struct ov7670_control *ov7670_find_control(__u32 id)
1189{ 1189{
diff --git a/drivers/media/video/tveeprom.c b/drivers/media/video/tveeprom.c
index a1136da74ba8..5203683dcc3d 100644
--- a/drivers/media/video/tveeprom.c
+++ b/drivers/media/video/tveeprom.c
@@ -490,7 +490,7 @@ void tveeprom_hauppauge_analog(struct i2c_client *c, struct tveeprom *tvee,
490 to indicate 4052 mux was removed in favor of using MSP 490 to indicate 4052 mux was removed in favor of using MSP
491 inputs directly. */ 491 inputs directly. */
492 audioic = eeprom_data[i+2] & 0x7f; 492 audioic = eeprom_data[i+2] & 0x7f;
493 if (audioic < sizeof(audioIC)/sizeof(*audioIC)) 493 if (audioic < ARRAY_SIZE(audioIC))
494 tvee->audio_processor = audioIC[audioic].id; 494 tvee->audio_processor = audioIC[audioic].id;
495 else 495 else
496 tvee->audio_processor = AUDIO_CHIP_UNKNOWN; 496 tvee->audio_processor = AUDIO_CHIP_UNKNOWN;
@@ -523,7 +523,7 @@ void tveeprom_hauppauge_analog(struct i2c_client *c, struct tveeprom *tvee,
523 to indicate 4052 mux was removed in favor of using MSP 523 to indicate 4052 mux was removed in favor of using MSP
524 inputs directly. */ 524 inputs directly. */
525 audioic = eeprom_data[i+1] & 0x7f; 525 audioic = eeprom_data[i+1] & 0x7f;
526 if (audioic < sizeof(audioIC)/sizeof(*audioIC)) 526 if (audioic < ARRAY_SIZE(audioIC))
527 tvee->audio_processor = audioIC[audioic].id; 527 tvee->audio_processor = audioIC[audioic].id;
528 else 528 else
529 tvee->audio_processor = AUDIO_CHIP_UNKNOWN; 529 tvee->audio_processor = AUDIO_CHIP_UNKNOWN;
@@ -678,7 +678,7 @@ void tveeprom_hauppauge_analog(struct i2c_client *c, struct tveeprom *tvee,
678 tveeprom_info("audio processor is unknown (no idx)\n"); 678 tveeprom_info("audio processor is unknown (no idx)\n");
679 tvee->audio_processor=AUDIO_CHIP_UNKNOWN; 679 tvee->audio_processor=AUDIO_CHIP_UNKNOWN;
680 } else { 680 } else {
681 if (audioic < sizeof(audioIC)/sizeof(*audioIC)) 681 if (audioic < ARRAY_SIZE(audioIC))
682 tveeprom_info("audio processor is %s (idx %d)\n", 682 tveeprom_info("audio processor is %s (idx %d)\n",
683 audioIC[audioic].name,audioic); 683 audioIC[audioic].name,audioic);
684 else 684 else
diff --git a/drivers/media/video/tvp5150.c b/drivers/media/video/tvp5150.c
index d5ec05f56adf..e2f1c972754b 100644
--- a/drivers/media/video/tvp5150.c
+++ b/drivers/media/video/tvp5150.c
@@ -1006,7 +1006,7 @@ static int tvp5150_command(struct i2c_client *c,
1006 { 1006 {
1007 struct v4l2_control *ctrl = arg; 1007 struct v4l2_control *ctrl = arg;
1008 u8 i, n; 1008 u8 i, n;
1009 n = sizeof(tvp5150_qctrl) / sizeof(tvp5150_qctrl[0]); 1009 n = ARRAY_SIZE(tvp5150_qctrl);
1010 for (i = 0; i < n; i++) 1010 for (i = 0; i < n; i++)
1011 if (ctrl->id == tvp5150_qctrl[i].id) { 1011 if (ctrl->id == tvp5150_qctrl[i].id) {
1012 if (ctrl->value < 1012 if (ctrl->value <
diff --git a/drivers/media/video/usbvideo/quickcam_messenger.c b/drivers/media/video/usbvideo/quickcam_messenger.c
index f49a4421468c..dd1a6d6bbc9e 100644
--- a/drivers/media/video/usbvideo/quickcam_messenger.c
+++ b/drivers/media/video/usbvideo/quickcam_messenger.c
@@ -439,7 +439,7 @@ static int qcm_sensor_init(struct uvd *uvd)
439 int ret; 439 int ret;
440 int i; 440 int i;
441 441
442 for (i=0; i < sizeof(regval_table)/sizeof(regval_table[0]) ; i++) { 442 for (i=0; i < ARRAY_SIZE(regval_table) ; i++) {
443 CHECK_RET(ret, qcm_stv_setb(uvd->dev, 443 CHECK_RET(ret, qcm_stv_setb(uvd->dev,
444 regval_table[i].reg, 444 regval_table[i].reg,
445 regval_table[i].val)); 445 regval_table[i].val));