diff options
author | Tobias Klauser <tklauser@nuerscht.ch> | 2006-03-27 04:17:39 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-03-27 11:44:58 -0500 |
commit | d1ae418eef4ce763a95edec0b5fc095af5daca2e (patch) | |
tree | 251158f7887435cd058293c2532eafd722adff3a /drivers | |
parent | b0c87978216836455ef5fbcac6df1ce6679750b0 (diff) |
[PATCH] drivers/video: Use ARRAY_SIZE macro
Use ARRAY_SIZE macro instead of sizeof(x)/sizeof(x[0]) and remove
duplicates of ARRAY_SIZE. Some coding style and trailing whitespaces are
also fixed.
Compile-tested where possible (some are other arch or BROKEN)
Signed-off-by: Tobias Klauser <tklauser@nuerscht.ch>
Cc: "Antonino A. Daplas" <adaplas@pol.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/video/acornfb.c | 8 | ||||
-rw-r--r-- | drivers/video/asiliantfb.c | 14 | ||||
-rw-r--r-- | drivers/video/aty/aty128fb.c | 4 | ||||
-rw-r--r-- | drivers/video/aty/atyfb_base.c | 8 | ||||
-rw-r--r-- | drivers/video/aty/mach64_gx.c | 3 | ||||
-rw-r--r-- | drivers/video/chipsfb.c | 14 | ||||
-rw-r--r-- | drivers/video/console/fonts.c | 2 | ||||
-rw-r--r-- | drivers/video/imsttfb.c | 24 | ||||
-rw-r--r-- | drivers/video/macmodes.c | 2 | ||||
-rw-r--r-- | drivers/video/matrox/matroxfb_g450.c | 2 | ||||
-rw-r--r-- | drivers/video/matrox/matroxfb_maven.c | 6 | ||||
-rw-r--r-- | drivers/video/modedb.c | 2 | ||||
-rw-r--r-- | drivers/video/neofb.c | 8 | ||||
-rw-r--r-- | drivers/video/pmagb-b-fb.c | 2 | ||||
-rw-r--r-- | drivers/video/radeonfb.c | 2 | ||||
-rw-r--r-- | drivers/video/sstfb.c | 11 | ||||
-rw-r--r-- | drivers/video/virgefb.c | 3 |
17 files changed, 58 insertions, 57 deletions
diff --git a/drivers/video/acornfb.c b/drivers/video/acornfb.c index 76448d6ae896..98baecccb3fd 100644 --- a/drivers/video/acornfb.c +++ b/drivers/video/acornfb.c | |||
@@ -1308,7 +1308,7 @@ static int __init acornfb_probe(struct platform_device *dev) | |||
1308 | /* | 1308 | /* |
1309 | * Try to select a suitable default mode | 1309 | * Try to select a suitable default mode |
1310 | */ | 1310 | */ |
1311 | for (i = 0; i < sizeof(modedb) / sizeof(*modedb); i++) { | 1311 | for (i = 0; i < ARRAY_SIZE(modedb); i++) { |
1312 | unsigned long hs; | 1312 | unsigned long hs; |
1313 | 1313 | ||
1314 | hs = modedb[i].refresh * | 1314 | hs = modedb[i].refresh * |
@@ -1380,7 +1380,7 @@ static int __init acornfb_probe(struct platform_device *dev) | |||
1380 | */ | 1380 | */ |
1381 | free_unused_pages(PAGE_OFFSET + size, PAGE_OFFSET + MAX_SIZE); | 1381 | free_unused_pages(PAGE_OFFSET + size, PAGE_OFFSET + MAX_SIZE); |
1382 | #endif | 1382 | #endif |
1383 | 1383 | ||
1384 | fb_info.fix.smem_len = size; | 1384 | fb_info.fix.smem_len = size; |
1385 | current_par.palette_size = VIDC_PALETTE_SIZE; | 1385 | current_par.palette_size = VIDC_PALETTE_SIZE; |
1386 | 1386 | ||
@@ -1391,7 +1391,7 @@ static int __init acornfb_probe(struct platform_device *dev) | |||
1391 | */ | 1391 | */ |
1392 | do { | 1392 | do { |
1393 | rc = fb_find_mode(&fb_info.var, &fb_info, NULL, modedb, | 1393 | rc = fb_find_mode(&fb_info.var, &fb_info, NULL, modedb, |
1394 | sizeof(modedb) / sizeof(*modedb), | 1394 | ARRAY_SIZE(modedb), |
1395 | &acornfb_default_mode, DEFAULT_BPP); | 1395 | &acornfb_default_mode, DEFAULT_BPP); |
1396 | /* | 1396 | /* |
1397 | * If we found an exact match, all ok. | 1397 | * If we found an exact match, all ok. |
@@ -1408,7 +1408,7 @@ static int __init acornfb_probe(struct platform_device *dev) | |||
1408 | break; | 1408 | break; |
1409 | 1409 | ||
1410 | rc = fb_find_mode(&fb_info.var, &fb_info, NULL, modedb, | 1410 | rc = fb_find_mode(&fb_info.var, &fb_info, NULL, modedb, |
1411 | sizeof(modedb) / sizeof(*modedb), | 1411 | ARRAY_SIZE(modedb), |
1412 | &acornfb_default_mode, DEFAULT_BPP); | 1412 | &acornfb_default_mode, DEFAULT_BPP); |
1413 | if (rc) | 1413 | if (rc) |
1414 | break; | 1414 | break; |
diff --git a/drivers/video/asiliantfb.c b/drivers/video/asiliantfb.c index c924d81f7978..29f9f0dfe3b4 100644 --- a/drivers/video/asiliantfb.c +++ b/drivers/video/asiliantfb.c | |||
@@ -353,8 +353,6 @@ struct chips_init_reg { | |||
353 | unsigned char data; | 353 | unsigned char data; |
354 | }; | 354 | }; |
355 | 355 | ||
356 | #define N_ELTS(x) (sizeof(x) / sizeof(x[0])) | ||
357 | |||
358 | static struct chips_init_reg chips_init_sr[] = | 356 | static struct chips_init_reg chips_init_sr[] = |
359 | { | 357 | { |
360 | {0x00, 0x03}, /* Reset register */ | 358 | {0x00, 0x03}, /* Reset register */ |
@@ -460,22 +458,22 @@ static void __devinit chips_hw_init(struct fb_info *p) | |||
460 | { | 458 | { |
461 | int i; | 459 | int i; |
462 | 460 | ||
463 | for (i = 0; i < N_ELTS(chips_init_xr); ++i) | 461 | for (i = 0; i < ARRAY_SIZE(chips_init_xr); ++i) |
464 | write_xr(chips_init_xr[i].addr, chips_init_xr[i].data); | 462 | write_xr(chips_init_xr[i].addr, chips_init_xr[i].data); |
465 | write_xr(0x81, 0x12); | 463 | write_xr(0x81, 0x12); |
466 | write_xr(0x82, 0x08); | 464 | write_xr(0x82, 0x08); |
467 | write_xr(0x20, 0x00); | 465 | write_xr(0x20, 0x00); |
468 | for (i = 0; i < N_ELTS(chips_init_sr); ++i) | 466 | for (i = 0; i < ARRAY_SIZE(chips_init_sr); ++i) |
469 | write_sr(chips_init_sr[i].addr, chips_init_sr[i].data); | 467 | write_sr(chips_init_sr[i].addr, chips_init_sr[i].data); |
470 | for (i = 0; i < N_ELTS(chips_init_gr); ++i) | 468 | for (i = 0; i < ARRAY_SIZE(chips_init_gr); ++i) |
471 | write_gr(chips_init_gr[i].addr, chips_init_gr[i].data); | 469 | write_gr(chips_init_gr[i].addr, chips_init_gr[i].data); |
472 | for (i = 0; i < N_ELTS(chips_init_ar); ++i) | 470 | for (i = 0; i < ARRAY_SIZE(chips_init_ar); ++i) |
473 | write_ar(chips_init_ar[i].addr, chips_init_ar[i].data); | 471 | write_ar(chips_init_ar[i].addr, chips_init_ar[i].data); |
474 | /* Enable video output in attribute index register */ | 472 | /* Enable video output in attribute index register */ |
475 | writeb(0x20, mmio_base + 0x780); | 473 | writeb(0x20, mmio_base + 0x780); |
476 | for (i = 0; i < N_ELTS(chips_init_cr); ++i) | 474 | for (i = 0; i < ARRAY_SIZE(chips_init_cr); ++i) |
477 | write_cr(chips_init_cr[i].addr, chips_init_cr[i].data); | 475 | write_cr(chips_init_cr[i].addr, chips_init_cr[i].data); |
478 | for (i = 0; i < N_ELTS(chips_init_fr); ++i) | 476 | for (i = 0; i < ARRAY_SIZE(chips_init_fr); ++i) |
479 | write_fr(chips_init_fr[i].addr, chips_init_fr[i].data); | 477 | write_fr(chips_init_fr[i].addr, chips_init_fr[i].data); |
480 | } | 478 | } |
481 | 479 | ||
diff --git a/drivers/video/aty/aty128fb.c b/drivers/video/aty/aty128fb.c index 620c9a934e0e..821c6da8e42c 100644 --- a/drivers/video/aty/aty128fb.c +++ b/drivers/video/aty/aty128fb.c | |||
@@ -1725,9 +1725,9 @@ static int __init aty128_init(struct pci_dev *pdev, const struct pci_device_id * | |||
1725 | strcpy(video_card, "Rage128 XX "); | 1725 | strcpy(video_card, "Rage128 XX "); |
1726 | video_card[8] = ent->device >> 8; | 1726 | video_card[8] = ent->device >> 8; |
1727 | video_card[9] = ent->device & 0xFF; | 1727 | video_card[9] = ent->device & 0xFF; |
1728 | 1728 | ||
1729 | /* range check to make sure */ | 1729 | /* range check to make sure */ |
1730 | if (ent->driver_data < (sizeof(r128_family)/sizeof(char *))) | 1730 | if (ent->driver_data < ARRAY_SIZE(r128_family)) |
1731 | strncat(video_card, r128_family[ent->driver_data], sizeof(video_card)); | 1731 | strncat(video_card, r128_family[ent->driver_data], sizeof(video_card)); |
1732 | 1732 | ||
1733 | printk(KERN_INFO "aty128fb: %s [chip rev 0x%x] ", video_card, chip_rev); | 1733 | printk(KERN_INFO "aty128fb: %s [chip rev 0x%x] ", video_card, chip_rev); |
diff --git a/drivers/video/aty/atyfb_base.c b/drivers/video/aty/atyfb_base.c index d790ee76cc70..e799fcca365a 100644 --- a/drivers/video/aty/atyfb_base.c +++ b/drivers/video/aty/atyfb_base.c | |||
@@ -434,7 +434,7 @@ static int __devinit correct_chipset(struct atyfb_par *par) | |||
434 | const char *name; | 434 | const char *name; |
435 | int i; | 435 | int i; |
436 | 436 | ||
437 | for (i = sizeof(aty_chips) / sizeof(*aty_chips) - 1; i >= 0; i--) | 437 | for (i = ARRAY_SIZE(aty_chips) - 1; i >= 0; i--) |
438 | if (par->pci_id == aty_chips[i].pci_id) | 438 | if (par->pci_id == aty_chips[i].pci_id) |
439 | break; | 439 | break; |
440 | 440 | ||
@@ -2168,10 +2168,10 @@ static void __init aty_calc_mem_refresh(struct atyfb_par *par, int xclk) | |||
2168 | 2168 | ||
2169 | if (IS_XL(par->pci_id) || IS_MOBILITY(par->pci_id)) { | 2169 | if (IS_XL(par->pci_id) || IS_MOBILITY(par->pci_id)) { |
2170 | refresh_tbl = ragexl_tbl; | 2170 | refresh_tbl = ragexl_tbl; |
2171 | size = sizeof(ragexl_tbl)/sizeof(int); | 2171 | size = ARRAY_SIZE(ragexl_tbl); |
2172 | } else { | 2172 | } else { |
2173 | refresh_tbl = ragepro_tbl; | 2173 | refresh_tbl = ragepro_tbl; |
2174 | size = sizeof(ragepro_tbl)/sizeof(int); | 2174 | size = ARRAY_SIZE(ragepro_tbl); |
2175 | } | 2175 | } |
2176 | 2176 | ||
2177 | for (i=0; i < size; i++) { | 2177 | for (i=0; i < size; i++) { |
@@ -3399,7 +3399,7 @@ static int __devinit atyfb_pci_probe(struct pci_dev *pdev, const struct pci_devi | |||
3399 | struct atyfb_par *par; | 3399 | struct atyfb_par *par; |
3400 | int i, rc = -ENOMEM; | 3400 | int i, rc = -ENOMEM; |
3401 | 3401 | ||
3402 | for (i = sizeof(aty_chips) / sizeof(*aty_chips) - 1; i >= 0; i--) | 3402 | for (i = ARRAY_SIZE(aty_chips); i >= 0; i--) |
3403 | if (pdev->device == aty_chips[i].pci_id) | 3403 | if (pdev->device == aty_chips[i].pci_id) |
3404 | break; | 3404 | break; |
3405 | 3405 | ||
diff --git a/drivers/video/aty/mach64_gx.c b/drivers/video/aty/mach64_gx.c index 01fdff79483b..2045639cb671 100644 --- a/drivers/video/aty/mach64_gx.c +++ b/drivers/video/aty/mach64_gx.c | |||
@@ -149,8 +149,7 @@ static int aty_var_to_pll_514(const struct fb_info *info, u32 vclk_per, | |||
149 | }; | 149 | }; |
150 | int i; | 150 | int i; |
151 | 151 | ||
152 | for (i = 0; i < sizeof(RGB514_clocks) / sizeof(*RGB514_clocks); | 152 | for (i = 0; i < ARRAY_SIZE(RGB514_clocks); i++) |
153 | i++) | ||
154 | if (vclk_per <= RGB514_clocks[i].limit) { | 153 | if (vclk_per <= RGB514_clocks[i].limit) { |
155 | pll->ibm514.m = RGB514_clocks[i].m; | 154 | pll->ibm514.m = RGB514_clocks[i].m; |
156 | pll->ibm514.n = RGB514_clocks[i].n; | 155 | pll->ibm514.n = RGB514_clocks[i].n; |
diff --git a/drivers/video/chipsfb.c b/drivers/video/chipsfb.c index bc061d4ec786..72ff6bf75e5e 100644 --- a/drivers/video/chipsfb.c +++ b/drivers/video/chipsfb.c | |||
@@ -178,8 +178,6 @@ struct chips_init_reg { | |||
178 | unsigned char data; | 178 | unsigned char data; |
179 | }; | 179 | }; |
180 | 180 | ||
181 | #define N_ELTS(x) (sizeof(x) / sizeof(x[0])) | ||
182 | |||
183 | static struct chips_init_reg chips_init_sr[] = { | 181 | static struct chips_init_reg chips_init_sr[] = { |
184 | { 0x00, 0x03 }, | 182 | { 0x00, 0x03 }, |
185 | { 0x01, 0x01 }, | 183 | { 0x01, 0x01 }, |
@@ -287,18 +285,18 @@ static void __init chips_hw_init(void) | |||
287 | { | 285 | { |
288 | int i; | 286 | int i; |
289 | 287 | ||
290 | for (i = 0; i < N_ELTS(chips_init_xr); ++i) | 288 | for (i = 0; i < ARRAY_SIZE(chips_init_xr); ++i) |
291 | write_xr(chips_init_xr[i].addr, chips_init_xr[i].data); | 289 | write_xr(chips_init_xr[i].addr, chips_init_xr[i].data); |
292 | outb(0x29, 0x3c2); /* set misc output reg */ | 290 | outb(0x29, 0x3c2); /* set misc output reg */ |
293 | for (i = 0; i < N_ELTS(chips_init_sr); ++i) | 291 | for (i = 0; i < ARRAY_SIZE(chips_init_sr); ++i) |
294 | write_sr(chips_init_sr[i].addr, chips_init_sr[i].data); | 292 | write_sr(chips_init_sr[i].addr, chips_init_sr[i].data); |
295 | for (i = 0; i < N_ELTS(chips_init_gr); ++i) | 293 | for (i = 0; i < ARRAY_SIZE(chips_init_gr); ++i) |
296 | write_gr(chips_init_gr[i].addr, chips_init_gr[i].data); | 294 | write_gr(chips_init_gr[i].addr, chips_init_gr[i].data); |
297 | for (i = 0; i < N_ELTS(chips_init_ar); ++i) | 295 | for (i = 0; i < ARRAY_SIZE(chips_init_ar); ++i) |
298 | write_ar(chips_init_ar[i].addr, chips_init_ar[i].data); | 296 | write_ar(chips_init_ar[i].addr, chips_init_ar[i].data); |
299 | for (i = 0; i < N_ELTS(chips_init_cr); ++i) | 297 | for (i = 0; i < ARRAY_SIZE(chips_init_cr); ++i) |
300 | write_cr(chips_init_cr[i].addr, chips_init_cr[i].data); | 298 | write_cr(chips_init_cr[i].addr, chips_init_cr[i].data); |
301 | for (i = 0; i < N_ELTS(chips_init_fr); ++i) | 299 | for (i = 0; i < ARRAY_SIZE(chips_init_fr); ++i) |
302 | write_fr(chips_init_fr[i].addr, chips_init_fr[i].data); | 300 | write_fr(chips_init_fr[i].addr, chips_init_fr[i].data); |
303 | } | 301 | } |
304 | 302 | ||
diff --git a/drivers/video/console/fonts.c b/drivers/video/console/fonts.c index 4fd07d9eca03..0cc1bfda76a6 100644 --- a/drivers/video/console/fonts.c +++ b/drivers/video/console/fonts.c | |||
@@ -66,7 +66,7 @@ static const struct font_desc *fonts[] = { | |||
66 | #endif | 66 | #endif |
67 | }; | 67 | }; |
68 | 68 | ||
69 | #define num_fonts (sizeof(fonts)/sizeof(*fonts)) | 69 | #define num_fonts ARRAY_SIZE(fonts) |
70 | 70 | ||
71 | #ifdef NO_FONTS | 71 | #ifdef NO_FONTS |
72 | #error No fonts configured. | 72 | #error No fonts configured. |
diff --git a/drivers/video/imsttfb.c b/drivers/video/imsttfb.c index 859ba7edfb42..f73c642b50c2 100644 --- a/drivers/video/imsttfb.c +++ b/drivers/video/imsttfb.c | |||
@@ -1372,18 +1372,24 @@ init_imstt(struct fb_info *info) | |||
1372 | write_reg_le32(par->dc_regs, STGCTL, tmp & ~0x1); | 1372 | write_reg_le32(par->dc_regs, STGCTL, tmp & ~0x1); |
1373 | write_reg_le32(par->dc_regs, SSR, 0); | 1373 | write_reg_le32(par->dc_regs, SSR, 0); |
1374 | 1374 | ||
1375 | /* set default values for DAC registers */ | 1375 | /* set default values for DAC registers */ |
1376 | if (par->ramdac == IBM) { | 1376 | if (par->ramdac == IBM) { |
1377 | par->cmap_regs[PPMASK] = 0xff; eieio(); | 1377 | par->cmap_regs[PPMASK] = 0xff; |
1378 | par->cmap_regs[PIDXHI] = 0; eieio(); | 1378 | eieio(); |
1379 | for (i = 0; i < sizeof(ibm_initregs) / sizeof(*ibm_initregs); i++) { | 1379 | par->cmap_regs[PIDXHI] = 0; |
1380 | par->cmap_regs[PIDXLO] = ibm_initregs[i].addr; eieio(); | 1380 | eieio(); |
1381 | par->cmap_regs[PIDXDATA] = ibm_initregs[i].value; eieio(); | 1381 | for (i = 0; i < ARRAY_SIZE(ibm_initregs); i++) { |
1382 | par->cmap_regs[PIDXLO] = ibm_initregs[i].addr; | ||
1383 | eieio(); | ||
1384 | par->cmap_regs[PIDXDATA] = ibm_initregs[i].value; | ||
1385 | eieio(); | ||
1382 | } | 1386 | } |
1383 | } else { | 1387 | } else { |
1384 | for (i = 0; i < sizeof(tvp_initregs) / sizeof(*tvp_initregs); i++) { | 1388 | for (i = 0; i < ARRAY_SIZE(tvp_initregs); i++) { |
1385 | par->cmap_regs[TVPADDRW] = tvp_initregs[i].addr; eieio(); | 1389 | par->cmap_regs[TVPADDRW] = tvp_initregs[i].addr; |
1386 | par->cmap_regs[TVPIDATA] = tvp_initregs[i].value; eieio(); | 1390 | eieio(); |
1391 | par->cmap_regs[TVPIDATA] = tvp_initregs[i].value; | ||
1392 | eieio(); | ||
1387 | } | 1393 | } |
1388 | } | 1394 | } |
1389 | 1395 | ||
diff --git a/drivers/video/macmodes.c b/drivers/video/macmodes.c index 2fc71081f7e7..c0385c6f7db5 100644 --- a/drivers/video/macmodes.c +++ b/drivers/video/macmodes.c | |||
@@ -380,7 +380,7 @@ int __init mac_find_mode(struct fb_var_screeninfo *var, struct fb_info *info, | |||
380 | if (mode_option && !strncmp(mode_option, "mac", 3)) { | 380 | if (mode_option && !strncmp(mode_option, "mac", 3)) { |
381 | mode_option += 3; | 381 | mode_option += 3; |
382 | db = mac_modedb; | 382 | db = mac_modedb; |
383 | dbsize = sizeof(mac_modedb)/sizeof(*mac_modedb); | 383 | dbsize = ARRAY_SIZE(mac_modedb); |
384 | } | 384 | } |
385 | return fb_find_mode(var, info, mode_option, db, dbsize, | 385 | return fb_find_mode(var, info, mode_option, db, dbsize, |
386 | &mac_modedb[DEFAULT_MODEDB_INDEX], default_bpp); | 386 | &mac_modedb[DEFAULT_MODEDB_INDEX], default_bpp); |
diff --git a/drivers/video/matrox/matroxfb_g450.c b/drivers/video/matrox/matroxfb_g450.c index c122d8743dd2..4d610b405d45 100644 --- a/drivers/video/matrox/matroxfb_g450.c +++ b/drivers/video/matrox/matroxfb_g450.c | |||
@@ -59,7 +59,7 @@ static const struct mctl g450_controls[] = | |||
59 | }, offsetof(struct matrox_fb_info, altout.tvo_params.testout) }, | 59 | }, offsetof(struct matrox_fb_info, altout.tvo_params.testout) }, |
60 | }; | 60 | }; |
61 | 61 | ||
62 | #define G450CTRLS (sizeof(g450_controls)/sizeof(g450_controls[0])) | 62 | #define G450CTRLS ARRAY_SIZE(g450_controls) |
63 | 63 | ||
64 | /* Return: positive number: id found | 64 | /* Return: positive number: id found |
65 | -EINVAL: id not found, return failure | 65 | -EINVAL: id not found, return failure |
diff --git a/drivers/video/matrox/matroxfb_maven.c b/drivers/video/matrox/matroxfb_maven.c index d8b3429cbed3..5d29a26b8cdf 100644 --- a/drivers/video/matrox/matroxfb_maven.c +++ b/drivers/video/matrox/matroxfb_maven.c | |||
@@ -89,12 +89,12 @@ static const struct mctl maven_controls[] = | |||
89 | }, offsetof(struct matrox_fb_info, altout.tvo_params.hue) }, | 89 | }, offsetof(struct matrox_fb_info, altout.tvo_params.hue) }, |
90 | { { V4L2_CID_GAMMA, V4L2_CTRL_TYPE_INTEGER, | 90 | { { V4L2_CID_GAMMA, V4L2_CTRL_TYPE_INTEGER, |
91 | "gamma", | 91 | "gamma", |
92 | 0, sizeof(maven_gamma)/sizeof(maven_gamma[0])-1, 1, 3, | 92 | 0, ARRAY_SIZE(maven_gamma) - 1, 1, 3, |
93 | 0, | 93 | 0, |
94 | }, offsetof(struct matrox_fb_info, altout.tvo_params.gamma) }, | 94 | }, offsetof(struct matrox_fb_info, altout.tvo_params.gamma) }, |
95 | { { MATROXFB_CID_TESTOUT, V4L2_CTRL_TYPE_BOOLEAN, | 95 | { { MATROXFB_CID_TESTOUT, V4L2_CTRL_TYPE_BOOLEAN, |
96 | "test output", | 96 | "test output", |
97 | 0, 1, 1, 0, | 97 | 0, 1, 1, 0, |
98 | 0, | 98 | 0, |
99 | }, offsetof(struct matrox_fb_info, altout.tvo_params.testout) }, | 99 | }, offsetof(struct matrox_fb_info, altout.tvo_params.testout) }, |
100 | { { MATROXFB_CID_DEFLICKER, V4L2_CTRL_TYPE_INTEGER, | 100 | { { MATROXFB_CID_DEFLICKER, V4L2_CTRL_TYPE_INTEGER, |
@@ -105,7 +105,7 @@ static const struct mctl maven_controls[] = | |||
105 | 105 | ||
106 | }; | 106 | }; |
107 | 107 | ||
108 | #define MAVCTRLS (sizeof(maven_controls)/sizeof(maven_controls[0])) | 108 | #define MAVCTRLS ARRAY_SIZE(maven_controls) |
109 | 109 | ||
110 | /* Return: positive number: id found | 110 | /* Return: positive number: id found |
111 | -EINVAL: id not found, return failure | 111 | -EINVAL: id not found, return failure |
diff --git a/drivers/video/modedb.c b/drivers/video/modedb.c index 244a21adc3fe..26a1c618a205 100644 --- a/drivers/video/modedb.c +++ b/drivers/video/modedb.c | |||
@@ -500,7 +500,7 @@ int fb_find_mode(struct fb_var_screeninfo *var, | |||
500 | /* Set up defaults */ | 500 | /* Set up defaults */ |
501 | if (!db) { | 501 | if (!db) { |
502 | db = modedb; | 502 | db = modedb; |
503 | dbsize = sizeof(modedb)/sizeof(*modedb); | 503 | dbsize = ARRAY_SIZE(modedb); |
504 | } | 504 | } |
505 | if (!default_mode) | 505 | if (!default_mode) |
506 | default_mode = &modedb[DEFAULT_MODEDB_INDEX]; | 506 | default_mode = &modedb[DEFAULT_MODEDB_INDEX]; |
diff --git a/drivers/video/neofb.c b/drivers/video/neofb.c index b961d5601bd9..24b12f71d5a8 100644 --- a/drivers/video/neofb.c +++ b/drivers/video/neofb.c | |||
@@ -165,20 +165,20 @@ static int neoFindMode(int xres, int yres, int depth) | |||
165 | 165 | ||
166 | switch (depth) { | 166 | switch (depth) { |
167 | case 8: | 167 | case 8: |
168 | size = sizeof(bios8) / sizeof(biosMode); | 168 | size = ARRAY_SIZE(bios8); |
169 | mode = bios8; | 169 | mode = bios8; |
170 | break; | 170 | break; |
171 | case 16: | 171 | case 16: |
172 | size = sizeof(bios16) / sizeof(biosMode); | 172 | size = ARRAY_SIZE(bios16); |
173 | mode = bios16; | 173 | mode = bios16; |
174 | break; | 174 | break; |
175 | case 24: | 175 | case 24: |
176 | size = sizeof(bios24) / sizeof(biosMode); | 176 | size = ARRAY_SIZE(bios24); |
177 | mode = bios24; | 177 | mode = bios24; |
178 | break; | 178 | break; |
179 | #ifdef NO_32BIT_SUPPORT_YET | 179 | #ifdef NO_32BIT_SUPPORT_YET |
180 | case 32: | 180 | case 32: |
181 | size = sizeof(bios32) / sizeof(biosMode); | 181 | size = ARRAY_SIZE(bios32); |
182 | mode = bios32; | 182 | mode = bios32; |
183 | break; | 183 | break; |
184 | #endif | 184 | #endif |
diff --git a/drivers/video/pmagb-b-fb.c b/drivers/video/pmagb-b-fb.c index eeeac924b500..73e2d7d16608 100644 --- a/drivers/video/pmagb-b-fb.c +++ b/drivers/video/pmagb-b-fb.c | |||
@@ -228,7 +228,7 @@ static void __init pmagbbfb_osc_setup(struct fb_info *info) | |||
228 | 228 | ||
229 | freq1 = (par->osc0 * count1 + count0 / 2) / count0; | 229 | freq1 = (par->osc0 * count1 + count0 / 2) / count0; |
230 | par->osc1 = freq1; | 230 | par->osc1 = freq1; |
231 | for (i = 0; i < sizeof(pmagbbfb_freqs) / sizeof(*pmagbbfb_freqs); i++) | 231 | for (i = 0; i < ARRAY_SIZE(pmagbbfb_freqs); i++) |
232 | if (freq1 >= pmagbbfb_freqs[i] - | 232 | if (freq1 >= pmagbbfb_freqs[i] - |
233 | (pmagbbfb_freqs[i] + 128) / 256 && | 233 | (pmagbbfb_freqs[i] + 128) / 256 && |
234 | freq1 <= pmagbbfb_freqs[i] + | 234 | freq1 <= pmagbbfb_freqs[i] + |
diff --git a/drivers/video/radeonfb.c b/drivers/video/radeonfb.c index db9fb9074dbc..24982adb3aa2 100644 --- a/drivers/video/radeonfb.c +++ b/drivers/video/radeonfb.c | |||
@@ -759,7 +759,7 @@ static void __iomem *radeon_find_rom(struct radeonfb_info *rinfo) | |||
759 | rom = rom_base; | 759 | rom = rom_base; |
760 | 760 | ||
761 | for (i = 0; (i < 512) && (stage != 4); i++) { | 761 | for (i = 0; (i < 512) && (stage != 4); i++) { |
762 | for(j = 0;j < sizeof(radeon_sig)/sizeof(char *);j++) { | 762 | for (j = 0; j < ARRAY_SIZE(radeon_sig); j++) { |
763 | if (radeon_sig[j][0] == *rom) | 763 | if (radeon_sig[j][0] == *rom) |
764 | if (strncmp(radeon_sig[j], rom, | 764 | if (strncmp(radeon_sig[j], rom, |
765 | strlen(radeon_sig[j])) == 0) { | 765 | strlen(radeon_sig[j])) == 0) { |
diff --git a/drivers/video/sstfb.c b/drivers/video/sstfb.c index 8c1a8b5135c6..c44de90ca12e 100644 --- a/drivers/video/sstfb.c +++ b/drivers/video/sstfb.c | |||
@@ -1194,10 +1194,11 @@ static struct dac_switch dacs[] __devinitdata = { | |||
1194 | static int __devinit sst_detect_dactype(struct fb_info *info, struct sstfb_par *par) | 1194 | static int __devinit sst_detect_dactype(struct fb_info *info, struct sstfb_par *par) |
1195 | { | 1195 | { |
1196 | int i, ret = 0; | 1196 | int i, ret = 0; |
1197 | 1197 | ||
1198 | for (i=0; i<sizeof(dacs)/sizeof(dacs[0]); i++) { | 1198 | for (i = 0; i < ARRAY_SIZE(dacs); i++) { |
1199 | ret = dacs[i].detect(info); | 1199 | ret = dacs[i].detect(info); |
1200 | if (ret) break; | 1200 | if (ret) |
1201 | break; | ||
1201 | } | 1202 | } |
1202 | if (!ret) | 1203 | if (!ret) |
1203 | return 0; | 1204 | return 0; |
@@ -1604,8 +1605,8 @@ static int sstfb_dump_regs(struct fb_info *info) | |||
1604 | {FBZMODE,"fbzmode"}, | 1605 | {FBZMODE,"fbzmode"}, |
1605 | }; | 1606 | }; |
1606 | 1607 | ||
1607 | const int pci_s = sizeof(pci_regs)/sizeof(pci_regs[0]); | 1608 | const int pci_s = ARRAY_SIZE(pci_regs); |
1608 | const int sst_s = sizeof(sst_regs)/sizeof(sst_regs[0]); | 1609 | const int sst_s = ARRAY_SIZE(sst_regs); |
1609 | struct sstfb_par *par = info->par; | 1610 | struct sstfb_par *par = info->par; |
1610 | struct pci_dev *dev = par->dev; | 1611 | struct pci_dev *dev = par->dev; |
1611 | u32 pci_res[pci_s]; | 1612 | u32 pci_res[pci_s]; |
diff --git a/drivers/video/virgefb.c b/drivers/video/virgefb.c index ed78747487e2..5ea2345dab99 100644 --- a/drivers/video/virgefb.c +++ b/drivers/video/virgefb.c | |||
@@ -616,8 +616,7 @@ static struct { | |||
616 | #endif | 616 | #endif |
617 | }; | 617 | }; |
618 | 618 | ||
619 | #define arraysize(x) (sizeof(x)/sizeof(*(x))) | 619 | #define NUM_TOTAL_MODES ARRAY_SIZE(virgefb_predefined) |
620 | #define NUM_TOTAL_MODES arraysize(virgefb_predefined) | ||
621 | 620 | ||
622 | /* | 621 | /* |
623 | * Default to 800x600 for video=virge8:, virge16: or virge32: | 622 | * Default to 800x600 for video=virge8:, virge16: or virge32: |