V4L/DVB (12478): ARRAY_SIZE changes
authorMauro Carvalho Chehab <mchehab@redhat.com>
Wed, 22 Jul 2009 03:02:29 +0000 (00:02 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Sat, 12 Sep 2009 15:19:05 +0000 (12:19 -0300)
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: Stoyan Gaydarov <sgayda2@uiuc.edu>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/video/gspca/conex.c
drivers/media/video/gspca/etoms.c
drivers/media/video/gspca/spca501.c
drivers/media/video/gspca/spca506.c
drivers/media/video/gspca/sunplus.c
drivers/media/video/gspca/zc3xx.c
drivers/media/video/tveeprom.c

index 8d48ea1742c2f7ac808c6b9033d7eba69366ffaa..eca003566ae3c9b586799c17a673a35b906e6e43 100644 (file)
@@ -820,7 +820,7 @@ static int sd_config(struct gspca_dev *gspca_dev,
 
        cam = &gspca_dev->cam;
        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->contrast = CONTRAST_DEF;
index 2c20d06a03e8b7b009e0588cb20fe41d5e1e01c7..c1461e63647f26fc698be301f49039966e840925 100644 (file)
@@ -635,10 +635,10 @@ static int sd_config(struct gspca_dev *gspca_dev,
        sd->sensor = id->driver_info;
        if (sd->sensor == SENSOR_PAS106) {
                cam->cam_mode = sif_mode;
-               cam->nmodes = sizeof sif_mode / sizeof sif_mode[0];
+               cam->nmodes = ARRAY_SIZE(sif_mode);
        } else {
                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);
        }
        sd->brightness = BRIGHTNESS_DEF;
index d48b27c648ca553b1e355fb0b2abed64b498d9e0..b74a34218da05034f3ae77bc86b64e2bc8f9b8d1 100644 (file)
@@ -1923,7 +1923,7 @@ static int sd_config(struct gspca_dev *gspca_dev,
 
        cam = &gspca_dev->cam;
        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->brightness = sd_ctrls[MY_BRIGHTNESS].qctrl.default_value;
        sd->contrast = sd_ctrls[MY_CONTRAST].qctrl.default_value;
index 3a0c893f942da2cdbeb5b388f85f76e48ced6c4f..a199298a6419a4fef681cb50f5a446c1f094cab0 100644 (file)
@@ -286,7 +286,7 @@ static int sd_config(struct gspca_dev *gspca_dev,
 
        cam = &gspca_dev->cam;
        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->contrast = sd_ctrls[SD_CONTRAST].qctrl.default_value;
        sd->colors = sd_ctrls[SD_COLOR].qctrl.default_value;
index eabad47a3ca60ca277883db3eebece8b793e5893..e9481fa77749ace1c0d5d5fad55af1cf3c661d88 100644 (file)
@@ -841,7 +841,7 @@ static int sd_config(struct gspca_dev *gspca_dev,
 /*     case BRIDGE_SPCA504: */
 /*     case BRIDGE_SPCA536: */
                cam->cam_mode = vga_mode;
-               cam->nmodes = sizeof vga_mode / sizeof vga_mode[0];
+               cam->nmodes =ARRAY_SIZE(vga_mode);
                break;
        case BRIDGE_SPCA533:
                cam->cam_mode = custom_mode;
@@ -852,7 +852,7 @@ static int sd_config(struct gspca_dev *gspca_dev,
                break;
        case BRIDGE_SPCA504C:
                cam->cam_mode = vga_mode2;
-               cam->nmodes = sizeof vga_mode2 / sizeof vga_mode2[0];
+               cam->nmodes = ARRAY_SIZE(vga_mode2);
                break;
        }
        sd->brightness = sd_ctrls[SD_BRIGHTNESS].qctrl.default_value;
index 3d2756f7874adac447954820267bf519198f53f8..cdf3357b4c9f307e4aeb82eb0d43270f1e27b87a 100644 (file)
@@ -7574,7 +7574,7 @@ static int sd_get_jcomp(struct gspca_dev *gspca_dev,
 static const struct sd_desc sd_desc = {
        .name = MODULE_NAME,
        .ctrls = sd_ctrls,
-       .nctrls = sizeof sd_ctrls / sizeof sd_ctrls[0],
+       .nctrls = ARRAY_SIZE(sd_ctrls),
        .config = sd_config,
        .init = sd_init,
        .start = sd_start,
index ac02808106c145120fbb49c72eecc85d5a54ac9c..d533ea57e7b10e89529bfa2029fb58056a1791b4 100644 (file)
@@ -646,14 +646,14 @@ void tveeprom_hauppauge_analog(struct i2c_client *c, struct tveeprom *tvee,
                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;
                t_name1 = hauppauge_tuner[tuner1].name;
        } else {
                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;
                t_name2 = hauppauge_tuner[tuner2].name;
        } else {