Module Name:    src
Committed By:   mrg
Date:           Mon Jul 18 00:05:35 UTC 2011

Modified Files:
        src/sys/arch/sparc/dev: cgeight.c cgfour.c cgtwo.c

Log Message:
convert to use device_t, cfdata_t and CFATTACH_DECL_NEW().

XXX: compile time tested only.


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/sys/arch/sparc/dev/cgeight.c
cvs rdiff -u -r1.45 -r1.46 src/sys/arch/sparc/dev/cgfour.c
cvs rdiff -u -r1.54 -r1.55 src/sys/arch/sparc/dev/cgtwo.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/arch/sparc/dev/cgeight.c
diff -u src/sys/arch/sparc/dev/cgeight.c:1.46 src/sys/arch/sparc/dev/cgeight.c:1.47
--- src/sys/arch/sparc/dev/cgeight.c:1.46	Wed Jun 11 21:25:31 2008
+++ src/sys/arch/sparc/dev/cgeight.c	Mon Jul 18 00:05:35 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: cgeight.c,v 1.46 2008/06/11 21:25:31 drochner Exp $	*/
+/*	$NetBSD: cgeight.c,v 1.47 2011/07/18 00:05:35 mrg Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
@@ -102,7 +102,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cgeight.c,v 1.46 2008/06/11 21:25:31 drochner Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cgeight.c,v 1.47 2011/07/18 00:05:35 mrg Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -127,7 +127,6 @@
 
 /* per-display variables */
 struct cgeight_softc {
-	struct device	sc_dev;		/* base device */
 	struct fbdevice	sc_fb;		/* frame buffer device */
 	bus_space_tag_t	sc_bustag;
 	bus_addr_t	sc_paddr;	/* phys address for device mmap() */
@@ -137,15 +136,15 @@
 };
 
 /* autoconfiguration driver */
-static void	cgeightattach(struct device *, struct device *, void *);
-static int	cgeightmatch(struct device *, struct cfdata *, void *);
+static void	cgeightattach(device_t, device_t, void *);
+static int	cgeightmatch(device_t, cfdata_t, void *);
 #if defined(SUN4)
-static void	cgeightunblank(struct device *);
+static void	cgeightunblank(device_t);
 #endif
 
 static int	cg8_pfour_probe(void *, void *);
 
-CFATTACH_DECL(cgeight, sizeof(struct cgeight_softc),
+CFATTACH_DECL_NEW(cgeight, sizeof(struct cgeight_softc),
     cgeightmatch, cgeightattach, NULL, NULL);
 
 extern struct cfdriver cgeight_cd;
@@ -175,7 +174,7 @@
  * Match a cgeight.
  */
 static int
-cgeightmatch(struct device *parent, struct cfdata *cf, void *aux)
+cgeightmatch(device_t parent, cfdata_t cf, void *aux)
 {
 	union obio_attach_args *uoba = aux;
 	struct obio4_attach_args *oba;
@@ -202,7 +201,7 @@
  * Attach a display.  We need to notice if it is the console, too.
  */
 static void
-cgeightattach(struct device *parent, struct device *self, void *aux)
+cgeightattach(device_t parent, device_t self, void *aux)
 {
 #if defined(SUN4)
 	union obio_attach_args *uoba = aux;
@@ -221,15 +220,16 @@
 			  sizeof(uint32_t),
 			  BUS_SPACE_MAP_LINEAR,
 			  &bh) != 0) {
-		printf("%s: cannot map pfour register\n", self->dv_xname);
+		printf("%s: cannot map pfour register\n",
+			device_xname(self));
 		return;
 	}
 	fb->fb_pfour = (volatile uint32_t *)bh;
 
 	fb->fb_driver = &cgeightfbdriver;
-	fb->fb_device = &sc->sc_dev;
+	fb->fb_device = self;
 	fb->fb_type.fb_type = FBTYPE_MEMCOLOR;
-	fb->fb_flags = device_cfdata(&sc->sc_dev)->cf_flags & FB_USERMASK;
+	fb->fb_flags = device_cfdata(self)->cf_flags & FB_USERMASK;
 	fb->fb_flags |= FB_PFOUR;
 
 	ramsize = PFOUR_COLOR_OFF_END - PFOUR_COLOR_OFF_OVERLAY;
@@ -285,7 +285,8 @@
 			  sizeof(struct fbcontrol),
 			  BUS_SPACE_MAP_LINEAR,
 			  &bh) != 0) {
-		printf("%s: cannot map control registers\n", self->dv_xname);
+		printf("%s: cannot map control registers\n",
+			device_xname(self));
 		return;
 	}
 	sc->sc_fbc = (volatile struct fbcontrol *)bh;
@@ -481,7 +482,7 @@
  * Undo the effect of an FBIOSVIDEO that turns the video off.
  */
 static void
-cgeightunblank(struct device *dev)
+cgeightunblank(device_t dev)
 {
 
 	cgeight_set_video(device_private(dev), 1);

Index: src/sys/arch/sparc/dev/cgfour.c
diff -u src/sys/arch/sparc/dev/cgfour.c:1.45 src/sys/arch/sparc/dev/cgfour.c:1.46
--- src/sys/arch/sparc/dev/cgfour.c:1.45	Wed Jun 11 21:25:31 2008
+++ src/sys/arch/sparc/dev/cgfour.c	Mon Jul 18 00:05:35 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: cgfour.c,v 1.45 2008/06/11 21:25:31 drochner Exp $	*/
+/*	$NetBSD: cgfour.c,v 1.46 2011/07/18 00:05:35 mrg Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
@@ -102,7 +102,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cgfour.c,v 1.45 2008/06/11 21:25:31 drochner Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cgfour.c,v 1.46 2011/07/18 00:05:35 mrg Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -125,7 +125,6 @@
 
 /* per-display variables */
 struct cgfour_softc {
-	struct device	sc_dev;		/* base device */
 	struct fbdevice	sc_fb;		/* frame buffer device */
 	bus_space_tag_t	sc_bustag;
 	bus_addr_t	sc_paddr;	/* phys address for device mmap() */
@@ -135,8 +134,8 @@
 };
 
 /* autoconfiguration driver */
-static int	cgfourmatch(struct device *, struct cfdata *, void *);
-static void	cgfourattach(struct device *, struct device *, void *);
+static int	cgfourmatch(device_t, cfdata_t, void *);
+static void	cgfourattach(device_t, device_t, void *);
 
 #if defined(SUN4)
 static void	cgfourunblank(struct device *);
@@ -144,7 +143,7 @@
 
 static int	cg4_pfour_probe(void *, void *);
 
-CFATTACH_DECL(cgfour, sizeof(struct cgfour_softc),
+CFATTACH_DECL_NEW(cgfour, sizeof(struct cgfour_softc),
     cgfourmatch, cgfourattach, NULL, NULL);
 
 extern struct cfdriver cgfour_cd;
@@ -174,7 +173,7 @@
  * Match a cgfour.
  */
 static int
-cgfourmatch(struct device *parent, struct cfdata *cf, void *aux)
+cgfourmatch(device_t parent, cfdata_t cf, void *aux)
 {
 	union obio_attach_args *uoba = aux;
 	struct obio4_attach_args *oba;
@@ -201,7 +200,7 @@
  * Attach a display.  We need to notice if it is the console, too.
  */
 static void
-cgfourattach(struct device *parent, struct device *self, void *aux)
+cgfourattach(device_t parent, device_t self, void *aux)
 {
 #if defined(SUN4)
 	struct cgfour_softc *sc = device_private(self);
@@ -220,15 +219,16 @@
 			  sizeof(uint32_t),
 			  BUS_SPACE_MAP_LINEAR,
 			  &bh) != 0) {
-		printf("%s: cannot map control registers\n", self->dv_xname);
+		printf("%s: cannot map control registers\n",
+			device_xname(self));
 		return;
 	}
 	fb->fb_pfour = (volatile uint32_t *)bh;
 
 	fb->fb_driver = &cgfourfbdriver;
-	fb->fb_device = &sc->sc_dev;
+	fb->fb_device = self;
 	fb->fb_type.fb_type = FBTYPE_SUN4COLOR;
-	fb->fb_flags = device_cfdata(&sc->sc_dev)->cf_flags & FB_USERMASK;
+	fb->fb_flags = device_cfdata(self)->cf_flags & FB_USERMASK;
 	fb->fb_flags |= FB_PFOUR;
 
 	ramsize = PFOUR_COLOR_OFF_END - PFOUR_COLOR_OFF_OVERLAY;
@@ -283,7 +283,8 @@
 			  sizeof(struct fbcontrol),
 			  BUS_SPACE_MAP_LINEAR,
 			  &bh) != 0) {
-		printf("%s: cannot map control registers\n", self->dv_xname);
+		printf("%s: cannot map control registers\n",
+			device_xname(self));
 		return;
 	}
 	sc->sc_fbc = (volatile struct fbcontrol *)bh;

Index: src/sys/arch/sparc/dev/cgtwo.c
diff -u src/sys/arch/sparc/dev/cgtwo.c:1.54 src/sys/arch/sparc/dev/cgtwo.c:1.55
--- src/sys/arch/sparc/dev/cgtwo.c:1.54	Wed Jun 11 21:25:31 2008
+++ src/sys/arch/sparc/dev/cgtwo.c	Mon Jul 18 00:05:35 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: cgtwo.c,v 1.54 2008/06/11 21:25:31 drochner Exp $ */
+/*	$NetBSD: cgtwo.c,v 1.55 2011/07/18 00:05:35 mrg Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -49,7 +49,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cgtwo.c,v 1.54 2008/06/11 21:25:31 drochner Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cgtwo.c,v 1.55 2011/07/18 00:05:35 mrg Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -76,7 +76,6 @@
 
 /* per-display variables */
 struct cgtwo_softc {
-	struct	device sc_dev;		/* base device */
 	struct	fbdevice sc_fb;		/* frame buffer device */
 	vme_addr_t		sc_paddr;
 	vme_chipset_tag_t	sc_ct;
@@ -89,13 +88,13 @@
 };
 
 /* autoconfiguration driver */
-static int	cgtwomatch(struct device *, struct cfdata *, void *);
-static void	cgtwoattach(struct device *, struct device *, void *);
-static void	cgtwounblank(struct device *);
+static int	cgtwomatch(device_t, cfdata_t, void *);
+static void	cgtwoattach(device_t, device_t, void *);
+static void	cgtwounblank(device_t);
 int		cgtwogetcmap(struct cgtwo_softc *, struct fbcmap *);
 int		cgtwoputcmap(struct cgtwo_softc *, struct fbcmap *);
 
-CFATTACH_DECL(cgtwo, sizeof(struct cgtwo_softc),
+CFATTACH_DECL_NEW(cgtwo, sizeof(struct cgtwo_softc),
     cgtwomatch, cgtwoattach, NULL, NULL);
 
 extern struct cfdriver cgtwo_cd;
@@ -119,7 +118,7 @@
  * Match a cgtwo.
  */
 static int
-cgtwomatch(struct device *parent, struct cfdata *cf, void *aux)
+cgtwomatch(device_t parent, cfdata_t cf, void *aux)
 {
 	struct vme_attach_args	*va = aux;
 	vme_chipset_tag_t	ct = va->va_vct;
@@ -143,7 +142,7 @@
  * Attach a display.  We need to notice if it is the console, too.
  */
 static void
-cgtwoattach(struct device *parent, struct device *self, void *aux)
+cgtwoattach(device_t parent, device_t self, void *aux)
 {
 	struct vme_attach_args	*va = aux;
 	vme_chipset_tag_t	ct = va->va_vct;
@@ -158,9 +157,9 @@
 
 	sc->sc_ct = ct;
 	fb->fb_driver = &cgtwofbdriver;
-	fb->fb_device = &sc->sc_dev;
+	fb->fb_device = self;
 	fb->fb_type.fb_type = FBTYPE_SUN2COLOR;
-	fb->fb_flags = device_cfdata(&sc->sc_dev)->cf_flags;
+	fb->fb_flags = device_cfdata(self)->cf_flags;
 
 	fb->fb_type.fb_depth = 8;
 	fb_setsize_eeprom(fb, fb->fb_type.fb_depth, 1152, 900);
@@ -279,7 +278,7 @@
  * Undo the effect of an FBIOSVIDEO that turns the video off.
  */
 static void
-cgtwounblank(struct device *dev)
+cgtwounblank(device_t dev)
 {
 	struct cgtwo_softc *sc = device_private(dev);
 	sc->sc_reg->video_enab = 1;

Reply via email to