Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/pci ioctl: KNF switch-case, remove useless brackets
details: https://anonhg.NetBSD.org/src/rev/cbe0eaf978fd
branches: trunk
changeset: 759753:cbe0eaf978fd
user: cegger <cegger%NetBSD.org@localhost>
date: Thu Dec 16 06:45:50 2010 +0000
description:
ioctl: KNF switch-case, remove useless brackets
diffstat:
sys/dev/pci/genfb_pci.c | 43 ++++----
sys/dev/pci/machfb.c | 221 ++++++++++++++++++++++-----------------------
sys/dev/pci/pm2fb.c | 83 ++++++++--------
sys/dev/pci/r128fb.c | 137 +++++++++++++--------------
sys/dev/pci/radeonfb.c | 6 +-
sys/dev/pci/unichromefb.c | 31 +++---
sys/dev/pci/vga_pci.c | 10 +-
sys/dev/pci/voodoofb.c | 95 +++++++++----------
sys/dev/pci/voyagerfb.c | 79 +++++++--------
sys/dev/pci/wcfb.c | 29 ++---
10 files changed, 357 insertions(+), 377 deletions(-)
diffs (truncated from 1010 to 300 lines):
diff -r 5e568572a09d -r cbe0eaf978fd sys/dev/pci/genfb_pci.c
--- a/sys/dev/pci/genfb_pci.c Thu Dec 16 06:19:01 2010 +0000
+++ b/sys/dev/pci/genfb_pci.c Thu Dec 16 06:45:50 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: genfb_pci.c,v 1.25 2010/10/07 07:53:54 macallan Exp $ */
+/* $NetBSD: genfb_pci.c,v 1.26 2010/12/16 06:45:50 cegger Exp $ */
/*-
* Copyright (c) 2007 Michael Lorenz
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: genfb_pci.c,v 1.25 2010/10/07 07:53:54 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: genfb_pci.c,v 1.26 2010/12/16 06:45:50 cegger Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -188,27 +188,26 @@
struct pci_genfb_softc *sc = v;
switch (cmd) {
- case WSDISPLAYIO_GTYPE:
- *(u_int *)data = WSDISPLAY_TYPE_PCIMISC;
- return 0;
+ case WSDISPLAYIO_GTYPE:
+ *(u_int *)data = WSDISPLAY_TYPE_PCIMISC;
+ return 0;
- /* PCI config read/write passthrough. */
- case PCI_IOC_CFGREAD:
- case PCI_IOC_CFGWRITE:
- return (pci_devioctl(sc->sc_pc, sc->sc_pcitag,
- cmd, data, flag, l));
- case WSDISPLAYIO_SMODE:
- {
- int new_mode = *(int*)data, i;
- if (new_mode == WSDISPLAYIO_MODE_EMUL) {
- for (i = 0; i < 9; i++)
- pci_conf_write(sc->sc_pc,
- sc->sc_pcitag,
- 0x10 + (i << 2),
- sc->sc_bars[i]);
- }
- }
- return 0;
+ /* PCI config read/write passthrough. */
+ case PCI_IOC_CFGREAD:
+ case PCI_IOC_CFGWRITE:
+ return pci_devioctl(sc->sc_pc, sc->sc_pcitag,
+ cmd, data, flag, l);
+ case WSDISPLAYIO_SMODE: {
+ int new_mode = *(int*)data, i;
+ if (new_mode == WSDISPLAYIO_MODE_EMUL) {
+ for (i = 0; i < 9; i++)
+ pci_conf_write(sc->sc_pc,
+ sc->sc_pcitag,
+ 0x10 + (i << 2),
+ sc->sc_bars[i]);
+ }
+ }
+ return 0;
}
return EPASSTHROUGH;
diff -r 5e568572a09d -r cbe0eaf978fd sys/dev/pci/machfb.c
--- a/sys/dev/pci/machfb.c Thu Dec 16 06:19:01 2010 +0000
+++ b/sys/dev/pci/machfb.c Thu Dec 16 06:45:50 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: machfb.c,v 1.61 2010/10/02 23:54:03 macallan Exp $ */
+/* $NetBSD: machfb.c,v 1.62 2010/12/16 06:45:50 cegger Exp $ */
/*
* Copyright (c) 2002 Bang Jun-Young
@@ -34,7 +34,7 @@
#include <sys/cdefs.h>
__KERNEL_RCSID(0,
- "$NetBSD: machfb.c,v 1.61 2010/10/02 23:54:03 macallan Exp $");
+ "$NetBSD: machfb.c,v 1.62 2010/12/16 06:45:50 cegger Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -1679,58 +1679,55 @@
struct vcons_screen *ms = vd->active;
switch (cmd) {
- case WSDISPLAYIO_GTYPE:
- /* XXX is this the right type to return? */
- *(u_int *)data = WSDISPLAY_TYPE_PCIMISC;
- return 0;
+ case WSDISPLAYIO_GTYPE:
+ /* XXX is this the right type to return? */
+ *(u_int *)data = WSDISPLAY_TYPE_PCIMISC;
+ return 0;
- case WSDISPLAYIO_LINEBYTES:
- *(u_int *)data = sc->virt_x * sc->bits_per_pixel / 8;
- return 0;
+ case WSDISPLAYIO_LINEBYTES:
+ *(u_int *)data = sc->virt_x * sc->bits_per_pixel / 8;
+ return 0;
- case WSDISPLAYIO_GINFO:
- wdf = (void *)data;
- wdf->height = sc->virt_y;
- wdf->width = sc->virt_x;
- wdf->depth = sc->bits_per_pixel;
- wdf->cmsize = 256;
- return 0;
-
- case WSDISPLAYIO_GETCMAP:
- return mach64_getcmap(sc,
- (struct wsdisplay_cmap *)data);
+ case WSDISPLAYIO_GINFO:
+ wdf = (void *)data;
+ wdf->height = sc->virt_y;
+ wdf->width = sc->virt_x;
+ wdf->depth = sc->bits_per_pixel;
+ wdf->cmsize = 256;
+ return 0;
+
+ case WSDISPLAYIO_GETCMAP:
+ return mach64_getcmap(sc,
+ (struct wsdisplay_cmap *)data);
- case WSDISPLAYIO_PUTCMAP:
- return mach64_putcmap(sc,
- (struct wsdisplay_cmap *)data);
-
- /* PCI config read/write passthrough. */
- case PCI_IOC_CFGREAD:
- case PCI_IOC_CFGWRITE:
- return (pci_devioctl(sc->sc_pc, sc->sc_pcitag,
- cmd, data, flag, l));
-
- case WSDISPLAYIO_SMODE:
+ case WSDISPLAYIO_PUTCMAP:
+ return mach64_putcmap(sc,
+ (struct wsdisplay_cmap *)data);
+
+ /* PCI config read/write passthrough. */
+ case PCI_IOC_CFGREAD:
+ case PCI_IOC_CFGWRITE:
+ return pci_devioctl(sc->sc_pc, sc->sc_pcitag,
+ cmd, data, flag, l);
+
+ case WSDISPLAYIO_SMODE: {
+ int new_mode = *(int*)data;
+ if (new_mode != sc->sc_mode) {
+ sc->sc_mode = new_mode;
+ if ((new_mode == WSDISPLAYIO_MODE_EMUL)
+ && (ms != NULL))
{
- int new_mode = *(int*)data;
-
- if (new_mode != sc->sc_mode)
- {
- sc->sc_mode = new_mode;
- if ((new_mode == WSDISPLAYIO_MODE_EMUL)
- && (ms != NULL))
- {
- /* restore initial video mode */
- mach64_init(sc);
- mach64_init_engine(sc);
- mach64_init_lut(sc);
- mach64_modeswitch(sc, sc->sc_my_mode);
- vcons_redraw_screen(ms);
- }
- }
+ /* restore initial video mode */
+ mach64_init(sc);
+ mach64_init_engine(sc);
+ mach64_init_lut(sc);
+ mach64_modeswitch(sc, sc->sc_my_mode);
+ vcons_redraw_screen(ms);
}
- return 0;
-
+ }
+ }
+ return 0;
+
}
return EPASSTHROUGH;
}
@@ -1934,90 +1931,88 @@
printf("machfb_fbioctl(%d, %lx)\n", minor(dev), cmd);
#endif
switch (cmd) {
- case FBIOGTYPE:
- *(struct fbtype *)data = sc->sc_fb.fb_type;
- break;
+ case FBIOGTYPE:
+ *(struct fbtype *)data = sc->sc_fb.fb_type;
+ break;
- case FBIOGATTR:
+ case FBIOGATTR:
#define fba ((struct fbgattr *)data)
- fba->real_type = sc->sc_fb.fb_type.fb_type;
- fba->owner = 0; /* XXX ??? */
- fba->fbtype = sc->sc_fb.fb_type;
- fba->sattr.flags = 0;
- fba->sattr.emu_type = sc->sc_fb.fb_type.fb_type;
- fba->sattr.dev_specific[0] = sc->sc_nbus;
- fba->sattr.dev_specific[1] = sc->sc_ndev;
- fba->sattr.dev_specific[2] = sc->sc_nfunc;
- fba->sattr.dev_specific[3] = -1;
- fba->emu_types[0] = sc->sc_fb.fb_type.fb_type;
- fba->emu_types[1] = -1;
+ fba->real_type = sc->sc_fb.fb_type.fb_type;
+ fba->owner = 0; /* XXX ??? */
+ fba->fbtype = sc->sc_fb.fb_type;
+ fba->sattr.flags = 0;
+ fba->sattr.emu_type = sc->sc_fb.fb_type.fb_type;
+ fba->sattr.dev_specific[0] = sc->sc_nbus;
+ fba->sattr.dev_specific[1] = sc->sc_ndev;
+ fba->sattr.dev_specific[2] = sc->sc_nfunc;
+ fba->sattr.dev_specific[3] = -1;
+ fba->emu_types[0] = sc->sc_fb.fb_type.fb_type;
+ fba->emu_types[1] = -1;
#undef fba
- break;
-
+ break;
+
#if 0
- case FBIOGETCMAP:
+ case FBIOGETCMAP:
#define p ((struct fbcmap *)data)
- return (bt_getcmap(p, &sc->sc_cmap, 256, 1));
+ return bt_getcmap(p, &sc->sc_cmap, 256, 1);
- case FBIOPUTCMAP:
- /* copy to software map */
- error = bt_putcmap(p, &sc->sc_cmap, 256, 1);
- if (error)
- return error;
- /* now blast them into the chip */
- /* XXX should use retrace interrupt */
- cg6_loadcmap(sc, p->index, p->count);
+ case FBIOPUTCMAP:
+ /* copy to software map */
+ error = bt_putcmap(p, &sc->sc_cmap, 256, 1);
+ if (error)
+ return error;
+ /* now blast them into the chip */
+ /* XXX should use retrace interrupt */
+ cg6_loadcmap(sc, p->index, p->count);
#undef p
- break;
+ break;
#endif
- case FBIOGVIDEO:
- *(int *)data = sc->sc_blanked;
- break;
+ case FBIOGVIDEO:
+ *(int *)data = sc->sc_blanked;
+ break;
- case FBIOSVIDEO:
- machfb_blank(sc, *(int *)data);
- break;
+ case FBIOSVIDEO:
+ machfb_blank(sc, *(int *)data);
+ break;
#if 0
- case FBIOGCURSOR:
- break;
-
- case FBIOSCURSOR:
- break;
+ case FBIOGCURSOR:
+ break;
- case FBIOGCURPOS:
- *(struct fbcurpos *)data = sc->sc_cursor.cc_pos;
- break;
+ case FBIOSCURSOR:
+ break;
+
+ case FBIOGCURPOS:
+ *(struct fbcurpos *)data = sc->sc_cursor.cc_pos;
+ break;
- case FBIOSCURPOS:
- sc->sc_cursor.cc_pos = *(struct fbcurpos *)data;
- break;
+ case FBIOSCURPOS:
+ sc->sc_cursor.cc_pos = *(struct fbcurpos *)data;
+ break;
- case FBIOGCURMAX:
- /* max cursor size is 32x32 */
- ((struct fbcurpos *)data)->x = 32;
- ((struct fbcurpos *)data)->y = 32;
- break;
+ case FBIOGCURMAX:
Home |
Main Index |
Thread Index |
Old Index