diff options
| author | Pedro F. Giffuni <pfg@FreeBSD.org> | 2016-04-21 19:40:10 +0000 |
|---|---|---|
| committer | Pedro F. Giffuni <pfg@FreeBSD.org> | 2016-04-21 19:40:10 +0000 |
| commit | 323b076e9c3bdccf78698ad0f1934ca8ec5438ce (patch) | |
| tree | eafad75827e36e967c59edef51d49100cec9cad4 /sys/dev/fb | |
| parent | 658b482e0dbe2298ff3b2fef41aa7eed8e68642c (diff) | |
Notes
Diffstat (limited to 'sys/dev/fb')
| -rw-r--r-- | sys/dev/fb/creator.c | 3 | ||||
| -rw-r--r-- | sys/dev/fb/fb.c | 2 | ||||
| -rw-r--r-- | sys/dev/fb/machfb.c | 6 | ||||
| -rw-r--r-- | sys/dev/fb/vesa.c | 4 | ||||
| -rw-r--r-- | sys/dev/fb/vga.c | 14 |
5 files changed, 14 insertions, 15 deletions
diff --git a/sys/dev/fb/creator.c b/sys/dev/fb/creator.c index 488d00d5c130..89cf877641c8 100644 --- a/sys/dev/fb/creator.c +++ b/sys/dev/fb/creator.c @@ -151,8 +151,7 @@ static const struct { { FFB_VIRT_EXP, FFB_PHYS_EXP, FFB_SIZE_EXP }, }; -#define CREATOR_FB_MAP_SIZE \ - (sizeof(creator_fb_map) / sizeof(creator_fb_map[0])) +#define CREATOR_FB_MAP_SIZE nitems(creator_fb_map) extern const struct gfb_font gallant12x22; diff --git a/sys/dev/fb/fb.c b/sys/dev/fb/fb.c index 183e20c7962e..aa2d30005f41 100644 --- a/sys/dev/fb/fb.c +++ b/sys/dev/fb/fb.c @@ -610,7 +610,7 @@ fb_type(int adp_type) }; int i; - for (i = 0; i < sizeof(types)/sizeof(types[0]); ++i) { + for (i = 0; i < nitems(types); ++i) { if (types[i].va_type == adp_type) return types[i].fb_type; } diff --git a/sys/dev/fb/machfb.c b/sys/dev/fb/machfb.c index de1e98e9d66e..03e209d79fb3 100644 --- a/sys/dev/fb/machfb.c +++ b/sys/dev/fb/machfb.c @@ -478,7 +478,7 @@ machfb_configure(int flags) return (0); if (OF_getprop(output, "device-id", &id, sizeof(id)) == -1) return (0); - for (i = 0; i < sizeof(machfb_info) / sizeof(machfb_info[0]); i++) { + for (i = 0; i < nitems(machfb_info); i++) { if (id == machfb_info[i].chip_id) { sc->sc_flags = MACHFB_CONSOLE; sc->sc_node = output; @@ -532,7 +532,7 @@ machfb_init(int unit, video_adapter_t *adp, int flags) return (ENXIO); sc->sc_ramdac_freq = 0; - for (i = 0; i < sizeof(machfb_info) / sizeof(machfb_info[0]); i++) { + for (i = 0; i < nitems(machfb_info); i++) { if (sc->sc_chip_id == machfb_info[i].chip_id) { sc->sc_ramdac_freq = machfb_info[i].ramdac_freq; break; @@ -1139,7 +1139,7 @@ machfb_pci_probe(device_t dev) pci_get_subclass(dev) != PCIS_DISPLAY_VGA) return (ENXIO); - for (i = 0; i < sizeof(machfb_info) / sizeof(machfb_info[0]); i++) { + for (i = 0; i < nitems(machfb_info); i++) { if (pci_get_device(dev) == machfb_info[i].chip_id) { device_set_desc(dev, machfb_info[i].name); return (BUS_PROBE_DEFAULT); diff --git a/sys/dev/fb/vesa.c b/sys/dev/fb/vesa.c index c7c2d641cdf4..cdd836cd3d3c 100644 --- a/sys/dev/fb/vesa.c +++ b/sys/dev/fb/vesa.c @@ -653,7 +653,7 @@ vesa_map_gen_mode_num(int type, int color, int mode) }; int i; - for (i = 0; i < sizeof(mode_map)/sizeof(mode_map[0]); ++i) { + for (i = 0; i < nitems(mode_map); ++i) { if (mode_map[i].from == mode) return (mode_map[i].to); } @@ -676,7 +676,7 @@ vesa_translate_flags(u_int16_t vflags) int flags; int i; - for (flags = 0, i = 0; i < sizeof(ftable)/sizeof(ftable[0]); ++i) { + for (flags = 0, i = 0; i < nitems(ftable); ++i) { flags |= (vflags & ftable[i].mask) ? ftable[i].set : ftable[i].reset; } diff --git a/sys/dev/fb/vga.c b/sys/dev/fb/vga.c index 78abb18590f1..365fca4491d9 100644 --- a/sys/dev/fb/vga.c +++ b/sys/dev/fb/vga.c @@ -602,7 +602,7 @@ map_mode_num(int mode) }; int i; - for (i = 0; i < sizeof(mode_map)/sizeof(mode_map[0]); ++i) { + for (i = 0; i < nitems(mode_map); ++i) { if (mode_map[i].from == mode) return mode_map[i].to; } @@ -655,7 +655,7 @@ map_gen_mode_num(int type, int color, int mode) } } - for (i = 0; i < sizeof(mode_map)/sizeof(mode_map[0]); ++i) { + for (i = 0; i < nitems(mode_map); ++i) { if (mode_map[i].from == mode) return ((color) ? mode_map[i].to_color : mode_map[i].to_mono); } @@ -702,7 +702,7 @@ map_bios_mode_num(int type, int color, int bios_mode) switch (type) { case KD_VGA: - if (bios_mode < sizeof(vga_modes)/sizeof(vga_modes[0])) + if (bios_mode < nitems(vga_modes)) return vga_modes[bios_mode]; else if (color) return M_VGA_C80x25; @@ -711,7 +711,7 @@ map_bios_mode_num(int type, int color, int bios_mode) break; case KD_EGA: - if (bios_mode < sizeof(ega_modes)/sizeof(ega_modes[0])) + if (bios_mode < nitems(ega_modes)) return ega_modes[bios_mode]; else if (color) return M_ENH_C80x25; @@ -720,7 +720,7 @@ map_bios_mode_num(int type, int color, int bios_mode) break; case KD_CGA: - if (bios_mode < sizeof(cga_modes)/sizeof(cga_modes[0])) + if (bios_mode < nitems(cga_modes)) return cga_modes[bios_mode]; else return M_C80x25; @@ -772,7 +772,7 @@ fill_adapter_param(int code, video_adapter_t *adp) { DCC_EGAMONO, DCC_CGA80 }, }; - if ((code < 0) || (code >= sizeof(dcc)/sizeof(dcc[0]))) { + if ((code < 0) || (code >= nitems(dcc))) { adp[V_ADP_PRIMARY] = adapter_init_value[DCC_MONO]; adp[V_ADP_SECONDARY] = adapter_init_value[DCC_CGA80]; } else { @@ -918,7 +918,7 @@ comp_adpregs(u_char *buf1, u_char *buf2) if ((buf1 == NULL) || (buf2 == NULL)) return COMP_DIFFERENT; - for (i = 0; i < sizeof(params)/sizeof(params[0]); ++i) { + for (i = 0; i < nitems(params); ++i) { if (params[i].mask == 0) /* don't care */ continue; if ((buf1[i] & params[i].mask) != (buf2[i] & params[i].mask)) |
