Commit d6f76b97 authored by Mauro Carvalho Chehab's avatar Mauro Carvalho Chehab

V4L/DVB (12478): ARRAY_SIZE changes

These changes were a direct result of using a semantic patch
More information can be found at http://www.emn.fr/x-info/coccinelle/

[mchehab@redhat.com: fix a merge conflict]
Signed-off-by: default avatarStoyan Gaydarov <sgayda2@uiuc.edu>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 3227c860
...@@ -820,7 +820,7 @@ static int sd_config(struct gspca_dev *gspca_dev, ...@@ -820,7 +820,7 @@ static int sd_config(struct gspca_dev *gspca_dev,
cam = &gspca_dev->cam; cam = &gspca_dev->cam;
cam->cam_mode = vga_mode; cam->cam_mode = vga_mode;
cam->nmodes = sizeof vga_mode / sizeof vga_mode[0]; cam->nmodes = ARRAY_SIZE(vga_mode);
sd->brightness = BRIGHTNESS_DEF; sd->brightness = BRIGHTNESS_DEF;
sd->contrast = CONTRAST_DEF; sd->contrast = CONTRAST_DEF;
......
...@@ -635,10 +635,10 @@ static int sd_config(struct gspca_dev *gspca_dev, ...@@ -635,10 +635,10 @@ static int sd_config(struct gspca_dev *gspca_dev,
sd->sensor = id->driver_info; sd->sensor = id->driver_info;
if (sd->sensor == SENSOR_PAS106) { if (sd->sensor == SENSOR_PAS106) {
cam->cam_mode = sif_mode; cam->cam_mode = sif_mode;
cam->nmodes = sizeof sif_mode / sizeof sif_mode[0]; cam->nmodes = ARRAY_SIZE(sif_mode);
} else { } else {
cam->cam_mode = vga_mode; cam->cam_mode = vga_mode;
cam->nmodes = sizeof vga_mode / sizeof vga_mode[0]; cam->nmodes = ARRAY_SIZE(vga_mode);
gspca_dev->ctrl_dis = (1 << COLOR_IDX); gspca_dev->ctrl_dis = (1 << COLOR_IDX);
} }
sd->brightness = BRIGHTNESS_DEF; sd->brightness = BRIGHTNESS_DEF;
......
...@@ -1923,7 +1923,7 @@ static int sd_config(struct gspca_dev *gspca_dev, ...@@ -1923,7 +1923,7 @@ static int sd_config(struct gspca_dev *gspca_dev,
cam = &gspca_dev->cam; cam = &gspca_dev->cam;
cam->cam_mode = vga_mode; cam->cam_mode = vga_mode;
cam->nmodes = sizeof vga_mode / sizeof vga_mode[0]; cam->nmodes = ARRAY_SIZE(vga_mode);
sd->subtype = id->driver_info; sd->subtype = id->driver_info;
sd->brightness = sd_ctrls[MY_BRIGHTNESS].qctrl.default_value; sd->brightness = sd_ctrls[MY_BRIGHTNESS].qctrl.default_value;
sd->contrast = sd_ctrls[MY_CONTRAST].qctrl.default_value; sd->contrast = sd_ctrls[MY_CONTRAST].qctrl.default_value;
......
...@@ -286,7 +286,7 @@ static int sd_config(struct gspca_dev *gspca_dev, ...@@ -286,7 +286,7 @@ static int sd_config(struct gspca_dev *gspca_dev,
cam = &gspca_dev->cam; cam = &gspca_dev->cam;
cam->cam_mode = vga_mode; cam->cam_mode = vga_mode;
cam->nmodes = sizeof vga_mode / sizeof vga_mode[0]; cam->nmodes = ARRAY_SIZE(vga_mode);
sd->brightness = sd_ctrls[SD_BRIGHTNESS].qctrl.default_value; sd->brightness = sd_ctrls[SD_BRIGHTNESS].qctrl.default_value;
sd->contrast = sd_ctrls[SD_CONTRAST].qctrl.default_value; sd->contrast = sd_ctrls[SD_CONTRAST].qctrl.default_value;
sd->colors = sd_ctrls[SD_COLOR].qctrl.default_value; sd->colors = sd_ctrls[SD_COLOR].qctrl.default_value;
......
...@@ -841,7 +841,7 @@ static int sd_config(struct gspca_dev *gspca_dev, ...@@ -841,7 +841,7 @@ static int sd_config(struct gspca_dev *gspca_dev,
/* case BRIDGE_SPCA504: */ /* case BRIDGE_SPCA504: */
/* case BRIDGE_SPCA536: */ /* case BRIDGE_SPCA536: */
cam->cam_mode = vga_mode; cam->cam_mode = vga_mode;
cam->nmodes = sizeof vga_mode / sizeof vga_mode[0]; cam->nmodes =ARRAY_SIZE(vga_mode);
break; break;
case BRIDGE_SPCA533: case BRIDGE_SPCA533:
cam->cam_mode = custom_mode; cam->cam_mode = custom_mode;
...@@ -852,7 +852,7 @@ static int sd_config(struct gspca_dev *gspca_dev, ...@@ -852,7 +852,7 @@ static int sd_config(struct gspca_dev *gspca_dev,
break; break;
case BRIDGE_SPCA504C: case BRIDGE_SPCA504C:
cam->cam_mode = vga_mode2; cam->cam_mode = vga_mode2;
cam->nmodes = sizeof vga_mode2 / sizeof vga_mode2[0]; cam->nmodes = ARRAY_SIZE(vga_mode2);
break; break;
} }
sd->brightness = sd_ctrls[SD_BRIGHTNESS].qctrl.default_value; sd->brightness = sd_ctrls[SD_BRIGHTNESS].qctrl.default_value;
......
...@@ -7574,7 +7574,7 @@ static int sd_get_jcomp(struct gspca_dev *gspca_dev, ...@@ -7574,7 +7574,7 @@ static int sd_get_jcomp(struct gspca_dev *gspca_dev,
static const struct sd_desc sd_desc = { static const struct sd_desc sd_desc = {
.name = MODULE_NAME, .name = MODULE_NAME,
.ctrls = sd_ctrls, .ctrls = sd_ctrls,
.nctrls = sizeof sd_ctrls / sizeof sd_ctrls[0], .nctrls = ARRAY_SIZE(sd_ctrls),
.config = sd_config, .config = sd_config,
.init = sd_init, .init = sd_init,
.start = sd_start, .start = sd_start,
......
...@@ -646,14 +646,14 @@ void tveeprom_hauppauge_analog(struct i2c_client *c, struct tveeprom *tvee, ...@@ -646,14 +646,14 @@ void tveeprom_hauppauge_analog(struct i2c_client *c, struct tveeprom *tvee,
tvee->has_radio = 1; tvee->has_radio = 1;
} }
if (tuner1 < sizeof(hauppauge_tuner)/sizeof(struct HAUPPAUGE_TUNER)) { if (tuner1 < ARRAY_SIZE(hauppauge_tuner)) {
tvee->tuner_type = hauppauge_tuner[tuner1].id; tvee->tuner_type = hauppauge_tuner[tuner1].id;
t_name1 = hauppauge_tuner[tuner1].name; t_name1 = hauppauge_tuner[tuner1].name;
} else { } else {
t_name1 = "unknown"; t_name1 = "unknown";
} }
if (tuner2 < sizeof(hauppauge_tuner)/sizeof(struct HAUPPAUGE_TUNER)) { if (tuner2 < ARRAY_SIZE(hauppauge_tuner)) {
tvee->tuner2_type = hauppauge_tuner[tuner2].id; tvee->tuner2_type = hauppauge_tuner[tuner2].id;
t_name2 = hauppauge_tuner[tuner2].name; t_name2 = hauppauge_tuner[tuner2].name;
} else { } else {
......
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