Module Name:    src
Committed By:   cegger
Date:           Thu Dec 16 06:45:51 UTC 2010

Modified Files:
        src/sys/dev/pci: genfb_pci.c machfb.c pm2fb.c r128fb.c radeonfb.c
            unichromefb.c vga_pci.c voodoofb.c voyagerfb.c wcfb.c

Log Message:
ioctl: KNF switch-case, remove useless brackets


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/dev/pci/genfb_pci.c
cvs rdiff -u -r1.61 -r1.62 src/sys/dev/pci/machfb.c
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/pci/pm2fb.c
cvs rdiff -u -r1.16 -r1.17 src/sys/dev/pci/r128fb.c \
    src/sys/dev/pci/unichromefb.c
cvs rdiff -u -r1.39 -r1.40 src/sys/dev/pci/radeonfb.c
cvs rdiff -u -r1.51 -r1.52 src/sys/dev/pci/vga_pci.c
cvs rdiff -u -r1.24 -r1.25 src/sys/dev/pci/voodoofb.c
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/pci/voyagerfb.c
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/pci/wcfb.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/genfb_pci.c
diff -u src/sys/dev/pci/genfb_pci.c:1.25 src/sys/dev/pci/genfb_pci.c:1.26
--- src/sys/dev/pci/genfb_pci.c:1.25	Thu Oct  7 07:53:54 2010
+++ src/sys/dev/pci/genfb_pci.c	Thu Dec 16 06:45:50 2010
@@ -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;
-
-		/* 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;
+	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;
 	}
 
 	return EPASSTHROUGH;

Index: src/sys/dev/pci/machfb.c
diff -u src/sys/dev/pci/machfb.c:1.61 src/sys/dev/pci/machfb.c:1.62
--- src/sys/dev/pci/machfb.c:1.61	Sat Oct  2 23:54:03 2010
+++ src/sys/dev/pci/machfb.c	Thu Dec 16 06:45:50 2010
@@ -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_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_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;
+	case WSDISPLAYIO_GTYPE:
+		/* XXX is this the right type to return? */
+		*(u_int *)data = WSDISPLAY_TYPE_PCIMISC;	
+		return 0;
 
-				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);
-					}
-				}
+	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_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))
+			{
+				/* 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 FBIOSCURPOS:
-			sc->sc_cursor.cc_pos = *(struct fbcurpos *)data;
-			break;
+	case FBIOGCURPOS:
+		*(struct fbcurpos *)data = sc->sc_cursor.cc_pos;
+		break;
 
-		case FBIOGCURMAX:
-			/* max cursor size is 32x32 */
-			((struct fbcurpos *)data)->x = 32;
-			((struct fbcurpos *)data)->y = 32;
-			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;
 #endif
-		case PCI_IOC_CFGREAD:
-		case PCI_IOC_CFGWRITE:
-		{
-			int ret;
-			
-			ret = pci_devioctl(sc->sc_pc, sc->sc_pcitag,
-			    cmd, data, flags, l);
-			
+	case PCI_IOC_CFGREAD:
+	case PCI_IOC_CFGWRITE: {
+		int ret;
+		ret = pci_devioctl(sc->sc_pc, sc->sc_pcitag,
+		    cmd, data, flags, l);
+		
 #ifdef MACHFB_DEBUG
-			printf("pci_devioctl: %d\n", ret);
+		printf("pci_devioctl: %d\n", ret);
 #endif
-			return ret;
+		return ret;
 		}
-		default:
+	default:
 #ifdef MACHFB_DEBUG
-			log(LOG_NOTICE, "machfb_fbioctl(0x%lx) (%s[%d])\n", cmd,
-			    p->p_comm, p->p_pid);
+		log(LOG_NOTICE, "machfb_fbioctl(0x%lx) (%s[%d])\n", cmd,
+		    p->p_comm, p->p_pid);
 #endif
-			return ENOTTY;
+		return ENOTTY;
 	}
 #ifdef MACHFB_DEBUG
 	printf("machfb_fbioctl done\n");

Index: src/sys/dev/pci/pm2fb.c
diff -u src/sys/dev/pci/pm2fb.c:1.5 src/sys/dev/pci/pm2fb.c:1.6
--- src/sys/dev/pci/pm2fb.c:1.5	Sat Nov 13 13:52:08 2010
+++ src/sys/dev/pci/pm2fb.c	Thu Dec 16 06:45:50 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: pm2fb.c,v 1.5 2010/11/13 13:52:08 uebayasi Exp $	*/
+/*	$NetBSD: pm2fb.c,v 1.6 2010/12/16 06:45:50 cegger Exp $	*/
 
 /*
  * Copyright (c) 2009 Michael Lorenz
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pm2fb.c,v 1.5 2010/11/13 13:52:08 uebayasi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pm2fb.c,v 1.6 2010/12/16 06:45:50 cegger Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -307,53 +307,50 @@
 	struct vcons_screen *ms = vd->active;
 
 	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_GINFO:
-			if (ms == NULL)
-				return ENODEV;
-			wdf = (void *)data;
-			wdf->height = ms->scr_ri.ri_height;
-			wdf->width = ms->scr_ri.ri_width;
-			wdf->depth = ms->scr_ri.ri_depth;
-			wdf->cmsize = 256;
-			return 0;
-
-		case WSDISPLAYIO_GETCMAP:
-			return pm2fb_getcmap(sc,
-			    (struct wsdisplay_cmap *)data);
-
-		case WSDISPLAYIO_PUTCMAP:
-			return pm2fb_putcmap(sc,
-			    (struct wsdisplay_cmap *)data);
-
-		case WSDISPLAYIO_LINEBYTES:
-			*(u_int *)data = sc->sc_stride;
-			return 0;
-
-		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) {
-						pm2fb_restore_palette(sc);
-						vcons_redraw_screen(ms);
-					} else
-						pm2fb_flush_engine(sc);
-				}
-			}
-			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_GINFO:
+		if (ms == NULL)
+			return ENODEV;
+		wdf = (void *)data;
+		wdf->height = ms->scr_ri.ri_height;
+		wdf->width = ms->scr_ri.ri_width;
+		wdf->depth = ms->scr_ri.ri_depth;
+		wdf->cmsize = 256;
+		return 0;
+
+	case WSDISPLAYIO_GETCMAP:
+		return pm2fb_getcmap(sc,
+		    (struct wsdisplay_cmap *)data);
+
+	case WSDISPLAYIO_PUTCMAP:
+		return pm2fb_putcmap(sc,
+		    (struct wsdisplay_cmap *)data);
+
+	case WSDISPLAYIO_LINEBYTES:
+		*(u_int *)data = sc->sc_stride;
+		return 0;
+
+	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) {
+				pm2fb_restore_palette(sc);
+				vcons_redraw_screen(ms);
+			} else
+				pm2fb_flush_engine(sc);
+		}
+		}
+		return 0;
 	}
 	return EPASSTHROUGH;
 }

Index: src/sys/dev/pci/r128fb.c
diff -u src/sys/dev/pci/r128fb.c:1.16 src/sys/dev/pci/r128fb.c:1.17
--- src/sys/dev/pci/r128fb.c:1.16	Mon Nov 15 23:19:33 2010
+++ src/sys/dev/pci/r128fb.c	Thu Dec 16 06:45:50 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: r128fb.c,v 1.16 2010/11/15 23:19:33 macallan Exp $	*/
+/*	$NetBSD: r128fb.c,v 1.17 2010/12/16 06:45:50 cegger Exp $	*/
 
 /*
  * Copyright (c) 2007 Michael Lorenz
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: r128fb.c,v 1.16 2010/11/15 23:19:33 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: r128fb.c,v 1.17 2010/12/16 06:45:50 cegger Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -342,85 +342,82 @@
 	struct wsdisplay_param  *param;
 
 	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_GINFO:
-			if (ms == NULL)
-				return ENODEV;
-			wdf = (void *)data;
-			wdf->height = ms->scr_ri.ri_height;
-			wdf->width = ms->scr_ri.ri_width;
-			wdf->depth = ms->scr_ri.ri_depth;
-			wdf->cmsize = 256;
-			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_GINFO:
+		if (ms == NULL)
+			return ENODEV;
+		wdf = (void *)data;
+		wdf->height = ms->scr_ri.ri_height;
+		wdf->width = ms->scr_ri.ri_width;
+		wdf->depth = ms->scr_ri.ri_depth;
+		wdf->cmsize = 256;
+		return 0;
 
-		case WSDISPLAYIO_GETCMAP:
-			return r128fb_getcmap(sc,
-			    (struct wsdisplay_cmap *)data);
-
-		case WSDISPLAYIO_PUTCMAP:
-			return r128fb_putcmap(sc,
-			    (struct wsdisplay_cmap *)data);
+	case WSDISPLAYIO_GETCMAP:
+		return r128fb_getcmap(sc,
+		    (struct wsdisplay_cmap *)data);
+
+	case WSDISPLAYIO_PUTCMAP:
+		return r128fb_putcmap(sc,
+		    (struct wsdisplay_cmap *)data);
 
-		case WSDISPLAYIO_LINEBYTES:
-			*(u_int *)data = sc->sc_stride;
-			return 0;
+	case WSDISPLAYIO_LINEBYTES:
+		*(u_int *)data = sc->sc_stride;
+		return 0;
 
-		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) {
-						r128fb_init(sc);
-						r128fb_restore_palette(sc);
-						vcons_redraw_screen(ms);
-					}
-				}
+	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) {
+				r128fb_init(sc);
+				r128fb_restore_palette(sc);
+				vcons_redraw_screen(ms);
 			}
-			return 0;
+		}
+		}
+		return 0;
 
-		case WSDISPLAYIO_GETPARAM:
-			param = (struct wsdisplay_param *)data;
-			if (sc->sc_have_backlight == 0)
-				return EPASSTHROUGH;
-			switch (param->param) {
-			case WSDISPLAYIO_PARAM_BRIGHTNESS:
-				param->min = 0;
-				param->max = 255;
-				param->curval = sc->sc_bl_level;
-				return 0;
-			case WSDISPLAYIO_PARAM_BACKLIGHT:
-				param->min = 0;
-				param->max = 1;
-				param->curval = sc->sc_bl_on;
-				return 0;
-			}
+	case WSDISPLAYIO_GETPARAM:
+		param = (struct wsdisplay_param *)data;
+		if (sc->sc_have_backlight == 0)
 			return EPASSTHROUGH;
+		switch (param->param) {
+		case WSDISPLAYIO_PARAM_BRIGHTNESS:
+			param->min = 0;
+			param->max = 255;
+			param->curval = sc->sc_bl_level;
+			return 0;
+		case WSDISPLAYIO_PARAM_BACKLIGHT:
+			param->min = 0;
+			param->max = 1;
+			param->curval = sc->sc_bl_on;
+			return 0;
+		}
+		return EPASSTHROUGH;
 
-		case WSDISPLAYIO_SETPARAM:
-			param = (struct wsdisplay_param *)data;
-			if (sc->sc_have_backlight == 0)
-				return EPASSTHROUGH;
-			switch (param->param) {
-			case WSDISPLAYIO_PARAM_BRIGHTNESS:
-				r128fb_set_backlight(sc, param->curval);
-				return 0;
-			case WSDISPLAYIO_PARAM_BACKLIGHT:
-				r128fb_switch_backlight(sc,  param->curval);
-				return 0;
-			}
+	case WSDISPLAYIO_SETPARAM:
+		param = (struct wsdisplay_param *)data;
+		if (sc->sc_have_backlight == 0)
 			return EPASSTHROUGH;
+		switch (param->param) {
+		case WSDISPLAYIO_PARAM_BRIGHTNESS:
+			r128fb_set_backlight(sc, param->curval);
+			return 0;
+		case WSDISPLAYIO_PARAM_BACKLIGHT:
+			r128fb_switch_backlight(sc,  param->curval);
+			return 0;
+		}
+		return EPASSTHROUGH;
 	}
 	return EPASSTHROUGH;
 }
Index: src/sys/dev/pci/unichromefb.c
diff -u src/sys/dev/pci/unichromefb.c:1.16 src/sys/dev/pci/unichromefb.c:1.17
--- src/sys/dev/pci/unichromefb.c:1.16	Wed May  6 10:34:33 2009
+++ src/sys/dev/pci/unichromefb.c	Thu Dec 16 06:45:50 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: unichromefb.c,v 1.16 2009/05/06 10:34:33 cegger Exp $ */
+/* $NetBSD: unichromefb.c,v 1.17 2010/12/16 06:45:50 cegger Exp $ */
 
 /*-
  * Copyright (c) 2006, 2008 Jared D. McNeill <jmcne...@invisible.ca>
@@ -51,7 +51,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: unichromefb.c,v 1.16 2009/05/06 10:34:33 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: unichromefb.c,v 1.17 2010/12/16 06:45:50 cegger Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -452,22 +452,21 @@
 	case WSDISPLAYIO_LINEBYTES:
 		*(u_int *)data = sc->sc_stride;
 		return 0;
-	case WSDISPLAYIO_SMODE:
-		{
-			int new_mode = *(int *)data;
-			if (new_mode != sc->sc_wsmode) {
-				sc->sc_wsmode = new_mode;
-				switch (new_mode) {
-				case WSDISPLAYIO_MODE_EMUL:
-					unichromefb_drm_map(sc);
-					vcons_redraw_screen(vd->active);
-					break;
-				default:
-					unichromefb_drm_unmap(sc);
-					break;
-				}
+	case WSDISPLAYIO_SMODE: {
+		int new_mode = *(int *)data;
+		if (new_mode != sc->sc_wsmode) {
+			sc->sc_wsmode = new_mode;
+			switch (new_mode) {
+			case WSDISPLAYIO_MODE_EMUL:
+				unichromefb_drm_map(sc);
+				vcons_redraw_screen(vd->active);
+				break;
+			default:
+				unichromefb_drm_unmap(sc);
+				break;
 			}
 		}
+		}
 		return 0;
 	case WSDISPLAYIO_SSPLASH:
 		return ENODEV;

Index: src/sys/dev/pci/radeonfb.c
diff -u src/sys/dev/pci/radeonfb.c:1.39 src/sys/dev/pci/radeonfb.c:1.40
--- src/sys/dev/pci/radeonfb.c:1.39	Wed Nov  3 00:49:02 2010
+++ src/sys/dev/pci/radeonfb.c	Thu Dec 16 06:45:50 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: radeonfb.c,v 1.39 2010/11/03 00:49:02 macallan Exp $ */
+/*	$NetBSD: radeonfb.c,v 1.40 2010/12/16 06:45:50 cegger Exp $ */
 
 /*-
  * Copyright (c) 2006 Itronix Inc.
@@ -70,7 +70,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: radeonfb.c,v 1.39 2010/11/03 00:49:02 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: radeonfb.c,v 1.40 2010/12/16 06:45:50 cegger Exp $");
 
 #define RADEONFB_DEFAULT_DEPTH 8
 
@@ -1094,7 +1094,7 @@
 	/* PCI config read/write passthrough. */
 	case PCI_IOC_CFGREAD:
 	case PCI_IOC_CFGWRITE:
-		return (pci_devioctl(sc->sc_pc, sc->sc_pt, cmd, d, flag, l));
+		return pci_devioctl(sc->sc_pc, sc->sc_pt, cmd, d, flag, l);
 
 	default:
 		return EPASSTHROUGH;

Index: src/sys/dev/pci/vga_pci.c
diff -u src/sys/dev/pci/vga_pci.c:1.51 src/sys/dev/pci/vga_pci.c:1.52
--- src/sys/dev/pci/vga_pci.c:1.51	Fri Nov 19 13:38:17 2010
+++ src/sys/dev/pci/vga_pci.c	Thu Dec 16 06:45:50 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: vga_pci.c,v 1.51 2010/11/19 13:38:17 macallan Exp $	*/
+/*	$NetBSD: vga_pci.c,v 1.52 2010/12/16 06:45:50 cegger Exp $	*/
 
 /*
  * Copyright (c) 1995, 1996 Carnegie-Mellon University.
@@ -28,7 +28,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vga_pci.c,v 1.51 2010/11/19 13:38:17 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vga_pci.c,v 1.52 2010/12/16 06:45:50 cegger Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -310,11 +310,11 @@
 	/* PCI config read/write passthrough. */
 	case PCI_IOC_CFGREAD:
 	case PCI_IOC_CFGWRITE:
-		return (pci_devioctl(psc->sc_pc, psc->sc_pcitag,
-		    cmd, data, flag, l));
+		return pci_devioctl(psc->sc_pc, psc->sc_pcitag,
+		    cmd, data, flag, l);
 
 	default:
-		return (EPASSTHROUGH);
+		return EPASSTHROUGH;
 	}
 }
 

Index: src/sys/dev/pci/voodoofb.c
diff -u src/sys/dev/pci/voodoofb.c:1.24 src/sys/dev/pci/voodoofb.c:1.25
--- src/sys/dev/pci/voodoofb.c:1.24	Sat Nov 13 13:52:09 2010
+++ src/sys/dev/pci/voodoofb.c	Thu Dec 16 06:45:50 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: voodoofb.c,v 1.24 2010/11/13 13:52:09 uebayasi Exp $	*/
+/*	$NetBSD: voodoofb.c,v 1.25 2010/12/16 06:45:50 cegger Exp $	*/
 
 /*
  * Copyright (c) 2005, 2006 Michael Lorenz
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: voodoofb.c,v 1.24 2010/11/13 13:52:09 uebayasi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: voodoofb.c,v 1.25 2010/12/16 06:45:50 cegger Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -928,57 +928,54 @@
 	struct vcons_screen *ms = vd->active;
 
 	switch (cmd) {
-		case WSDISPLAYIO_GTYPE:
-			*(u_int *)data = WSDISPLAY_TYPE_PCIMISC;
-			return 0;
-
-		case WSDISPLAYIO_GINFO:
-			wdf = (void *)data;
-			wdf->height = ms->scr_ri.ri_height;
-			wdf->width = ms->scr_ri.ri_width;
-			wdf->depth = ms->scr_ri.ri_depth;
-			wdf->cmsize = 256;
-			return 0;
-			
-		case WSDISPLAYIO_GETCMAP:
-			return voodoofb_getcmap(sc,
-			    (struct wsdisplay_cmap *)data);
-
-		case WSDISPLAYIO_PUTCMAP:
-			return voodoofb_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)
-					{
-						voodoofb_drm_map(sc);
-						int i;
-						
-						/* restore the palette */
-						for (i = 0; i < 256; i++) {
-							voodoofb_putpalreg(sc, 
-							   i, 
-							   sc->sc_cmap_red[i], 
-							   sc->sc_cmap_green[i],
-							   sc->sc_cmap_blue[i]);
-						}
-						vcons_redraw_screen(ms);
-					} else
-						voodoofb_drm_unmap(sc);
+	case WSDISPLAYIO_GTYPE:
+		*(u_int *)data = WSDISPLAY_TYPE_PCIMISC;
+		return 0;
+
+	case WSDISPLAYIO_GINFO:
+		wdf = (void *)data;
+		wdf->height = ms->scr_ri.ri_height;
+		wdf->width = ms->scr_ri.ri_width;
+		wdf->depth = ms->scr_ri.ri_depth;
+		wdf->cmsize = 256;
+		return 0;
+		
+	case WSDISPLAYIO_GETCMAP:
+		return voodoofb_getcmap(sc,
+		    (struct wsdisplay_cmap *)data);
+
+	case WSDISPLAYIO_PUTCMAP:
+		return voodoofb_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) {
+				voodoofb_drm_map(sc);
+				int i;
+				
+				/* restore the palette */
+				for (i = 0; i < 256; i++) {
+					voodoofb_putpalreg(sc, 
+					   i, 
+					   sc->sc_cmap_red[i], 
+					   sc->sc_cmap_green[i],
+					   sc->sc_cmap_blue[i]);
 				}
-			}
-			return 0;
+				vcons_redraw_screen(ms);
+			} else
+				voodoofb_drm_unmap(sc);
+		}
+		}
+		return 0;
 	}
 	return EPASSTHROUGH;
 }

Index: src/sys/dev/pci/voyagerfb.c
diff -u src/sys/dev/pci/voyagerfb.c:1.4 src/sys/dev/pci/voyagerfb.c:1.5
--- src/sys/dev/pci/voyagerfb.c:1.4	Sat Nov 13 13:52:09 2010
+++ src/sys/dev/pci/voyagerfb.c	Thu Dec 16 06:45:51 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: voyagerfb.c,v 1.4 2010/11/13 13:52:09 uebayasi Exp $	*/
+/*	$NetBSD: voyagerfb.c,v 1.5 2010/12/16 06:45:51 cegger Exp $	*/
 
 /*
  * Copyright (c) 2009 Michael Lorenz
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: voyagerfb.c,v 1.4 2010/11/13 13:52:09 uebayasi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: voyagerfb.c,v 1.5 2010/12/16 06:45:51 cegger Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -315,52 +315,49 @@
 	struct vcons_screen *ms = vd->active;
 
 	switch (cmd) {
+	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_GINFO:
+		if (ms == NULL)
+			return ENODEV;
+		wdf = (void *)data;
+		wdf->height = ms->scr_ri.ri_height;
+		wdf->width = ms->scr_ri.ri_width;
+		wdf->depth = ms->scr_ri.ri_depth;
+		wdf->cmsize = 256;
+		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_GINFO:
-			if (ms == NULL)
-				return ENODEV;
-			wdf = (void *)data;
-			wdf->height = ms->scr_ri.ri_height;
-			wdf->width = ms->scr_ri.ri_width;
-			wdf->depth = ms->scr_ri.ri_depth;
-			wdf->cmsize = 256;
-			return 0;
-
-		case WSDISPLAYIO_GETCMAP:
-			return voyagerfb_getcmap(sc,
-			    (struct wsdisplay_cmap *)data);
-
-		case WSDISPLAYIO_PUTCMAP:
-			return voyagerfb_putcmap(sc,
-			    (struct wsdisplay_cmap *)data);
-
-		case WSDISPLAYIO_LINEBYTES:
-			*(u_int *)data = sc->sc_stride;
-			return 0;
-
-		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) {
-						voyagerfb_restore_palette(sc);
-						vcons_redraw_screen(ms);
-					}
-				}
+	case WSDISPLAYIO_GETCMAP:
+		return voyagerfb_getcmap(sc,
+		    (struct wsdisplay_cmap *)data);
+
+	case WSDISPLAYIO_PUTCMAP:
+		return voyagerfb_putcmap(sc,
+		    (struct wsdisplay_cmap *)data);
+
+	case WSDISPLAYIO_LINEBYTES:
+		*(u_int *)data = sc->sc_stride;
+		return 0;
+
+	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) {
+				voyagerfb_restore_palette(sc);
+				vcons_redraw_screen(ms);
 			}
-			return 0;
+		}
+		}
+		return 0;
 	}
 	return EPASSTHROUGH;
 }

Index: src/sys/dev/pci/wcfb.c
diff -u src/sys/dev/pci/wcfb.c:1.6 src/sys/dev/pci/wcfb.c:1.7
--- src/sys/dev/pci/wcfb.c:1.6	Wed Mar 10 05:16:17 2010
+++ src/sys/dev/pci/wcfb.c	Thu Dec 16 06:45:51 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: wcfb.c,v 1.6 2010/03/10 05:16:17 macallan Exp $ */
+/*	$NetBSD: wcfb.c,v 1.7 2010/12/16 06:45:51 cegger Exp $ */
 
 /*-
  * Copyright (c) 2010 Michael Lorenz
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: wcfb.c,v 1.6 2010/03/10 05:16:17 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wcfb.c,v 1.7 2010/12/16 06:45:51 cegger Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -309,20 +309,19 @@
 	struct wcfb_softc *sc = v;
 
 	switch (cmd) {
-		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;*/
-			}
-			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;*/
+		}
+		return 0;
 	}
 
 	return EPASSTHROUGH;

Reply via email to