aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorJulia Lawall <julia@diku.dk>2008-11-12 21:18:21 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2008-12-29 14:53:34 -0500
commit802971257a3b897d2affd39e540be264bae89c3b (patch)
treebcfb454260c3b8ca052f76f84e130a1e50f8ac43 /drivers
parent292ee46107abc213fc073298aa6a838a595d2b78 (diff)
V4L/DVB (9638): drivers/media: use ARRAY_SIZE
ARRAY_SIZE is more concise to use when the size of an array is divided by the size of its type or the size of its first element. The semantic patch that makes this change is as follows: (http://www.emn.fr/x-info/coccinelle/) // <smpl> @i@ @@ @depends on i using "paren.iso"@ type T; T[] E; @@ - (sizeof(E)/sizeof(E[...])) + ARRAY_SIZE(E) @depends on i using "paren.iso"@ type T; T[] E; @@ - (sizeof(E)/sizeof(T)) + ARRAY_SIZE(E) // </smpl> Signed-off-by: Julia Lawall <julia@diku.dk> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/media/common/tuners/mxl5005s.c6
-rw-r--r--drivers/media/video/gspca/gspca.c2
-rw-r--r--drivers/media/video/gspca/mars.c2
-rw-r--r--drivers/media/video/gspca/spca500.c4
-rw-r--r--drivers/media/video/saa7134/saa7134-tvaudio.c2
5 files changed, 8 insertions, 8 deletions
diff --git a/drivers/media/common/tuners/mxl5005s.c b/drivers/media/common/tuners/mxl5005s.c
index a8878244bb3c..31522d2e318e 100644
--- a/drivers/media/common/tuners/mxl5005s.c
+++ b/drivers/media/common/tuners/mxl5005s.c
@@ -3598,7 +3598,7 @@ static u16 MXL_GetInitRegister(struct dvb_frontend *fe, u8 *RegNum,
3598 76, 77, 91, 134, 135, 137, 147, 3598 76, 77, 91, 134, 135, 137, 147,
3599 156, 166, 167, 168, 25 }; 3599 156, 166, 167, 168, 25 };
3600 3600
3601 *count = sizeof(RegAddr) / sizeof(u8); 3601 *count = ARRAY_SIZE(RegAddr);
3602 3602
3603 status += MXL_BlockInit(fe); 3603 status += MXL_BlockInit(fe);
3604 3604
@@ -3630,7 +3630,7 @@ static u16 MXL_GetCHRegister(struct dvb_frontend *fe, u8 *RegNum, u8 *RegVal,
3630 */ 3630 */
3631#endif 3631#endif
3632 3632
3633 *count = sizeof(RegAddr) / sizeof(u8); 3633 *count = ARRAY_SIZE(RegAddr);
3634 3634
3635 for (i = 0 ; i < *count; i++) { 3635 for (i = 0 ; i < *count; i++) {
3636 RegNum[i] = RegAddr[i]; 3636 RegNum[i] = RegAddr[i];
@@ -3648,7 +3648,7 @@ static u16 MXL_GetCHRegister_ZeroIF(struct dvb_frontend *fe, u8 *RegNum,
3648 3648
3649 u8 RegAddr[] = {43, 136}; 3649 u8 RegAddr[] = {43, 136};
3650 3650
3651 *count = sizeof(RegAddr) / sizeof(u8); 3651 *count = ARRAY_SIZE(RegAddr);
3652 3652
3653 for (i = 0; i < *count; i++) { 3653 for (i = 0; i < *count; i++) {
3654 RegNum[i] = RegAddr[i]; 3654 RegNum[i] = RegAddr[i];
diff --git a/drivers/media/video/gspca/gspca.c b/drivers/media/video/gspca/gspca.c
index 78a22144d689..02d6a48ad1b2 100644
--- a/drivers/media/video/gspca/gspca.c
+++ b/drivers/media/video/gspca/gspca.c
@@ -736,7 +736,7 @@ static int vidioc_enum_fmt_vid_cap(struct file *file, void *priv,
736 if (fmtdesc->index == index) 736 if (fmtdesc->index == index)
737 break; /* new format */ 737 break; /* new format */
738 index++; 738 index++;
739 if (index >= sizeof fmt_tb / sizeof fmt_tb[0]) 739 if (index >= ARRAY_SIZE(fmt_tb))
740 return -EINVAL; 740 return -EINVAL;
741 } 741 }
742 } 742 }
diff --git a/drivers/media/video/gspca/mars.c b/drivers/media/video/gspca/mars.c
index 277ca34a8817..492cdd3b5c84 100644
--- a/drivers/media/video/gspca/mars.c
+++ b/drivers/media/video/gspca/mars.c
@@ -123,7 +123,7 @@ static int sd_config(struct gspca_dev *gspca_dev,
123 cam = &gspca_dev->cam; 123 cam = &gspca_dev->cam;
124 cam->epaddr = 0x01; 124 cam->epaddr = 0x01;
125 cam->cam_mode = vga_mode; 125 cam->cam_mode = vga_mode;
126 cam->nmodes = sizeof vga_mode / sizeof vga_mode[0]; 126 cam->nmodes = ARRAY_SIZE(vga_mode);
127 sd->qindex = 1; /* set the quantization table */ 127 sd->qindex = 1; /* set the quantization table */
128 return 0; 128 return 0;
129} 129}
diff --git a/drivers/media/video/gspca/spca500.c b/drivers/media/video/gspca/spca500.c
index bca106c153fa..09ff69791da7 100644
--- a/drivers/media/video/gspca/spca500.c
+++ b/drivers/media/video/gspca/spca500.c
@@ -633,10 +633,10 @@ static int sd_config(struct gspca_dev *gspca_dev,
633 sd->subtype = id->driver_info; 633 sd->subtype = id->driver_info;
634 if (sd->subtype != LogitechClickSmart310) { 634 if (sd->subtype != LogitechClickSmart310) {
635 cam->cam_mode = vga_mode; 635 cam->cam_mode = vga_mode;
636 cam->nmodes = sizeof vga_mode / sizeof vga_mode[0]; 636 cam->nmodes = ARRAY_SIZE(vga_mode);
637 } else { 637 } else {
638 cam->cam_mode = sif_mode; 638 cam->cam_mode = sif_mode;
639 cam->nmodes = sizeof sif_mode / sizeof sif_mode[0]; 639 cam->nmodes = ARRAY_SIZE(sif_mode);
640 } 640 }
641 sd->qindex = 5; 641 sd->qindex = 5;
642 sd->brightness = BRIGHTNESS_DEF; 642 sd->brightness = BRIGHTNESS_DEF;
diff --git a/drivers/media/video/saa7134/saa7134-tvaudio.c b/drivers/media/video/saa7134/saa7134-tvaudio.c
index c5d0b44c179e..76b16407b01e 100644
--- a/drivers/media/video/saa7134/saa7134-tvaudio.c
+++ b/drivers/media/video/saa7134/saa7134-tvaudio.c
@@ -159,7 +159,7 @@ static struct saa7134_tvaudio tvaudio[] = {
159 .mode = TVAUDIO_FM_MONO, 159 .mode = TVAUDIO_FM_MONO,
160 } 160 }
161}; 161};
162#define TVAUDIO (sizeof(tvaudio)/sizeof(struct saa7134_tvaudio)) 162#define TVAUDIO ARRAY_SIZE(tvaudio)
163 163
164/* ------------------------------------------------------------------ */ 164/* ------------------------------------------------------------------ */
165 165