Module Name:    src
Committed By:   mrg
Date:           Tue Jul 26 08:59:38 UTC 2011

Modified Files:
        src/sys/dev/ic: igsfb.c igsfbvar.h
        src/sys/dev/ir: cir.c cirvar.h
        src/sys/dev/ofw: ofcons.c ofdisk.c ofnet.c ofrtc.c
        src/sys/dev/pci: igsfb_pci.c

Log Message:
convert to device_t, cfdata_t and CFATTACH_DECL_NEW.


To generate a diff of this commit:
cvs rdiff -u -r1.49 -r1.50 src/sys/dev/ic/igsfb.c
cvs rdiff -u -r1.19 -r1.20 src/sys/dev/ic/igsfbvar.h
cvs rdiff -u -r1.28 -r1.29 src/sys/dev/ir/cir.c
cvs rdiff -u -r1.8 -r1.9 src/sys/dev/ir/cirvar.h
cvs rdiff -u -r1.42 -r1.43 src/sys/dev/ofw/ofcons.c
cvs rdiff -u -r1.43 -r1.44 src/sys/dev/ofw/ofdisk.c
cvs rdiff -u -r1.51 -r1.52 src/sys/dev/ofw/ofnet.c
cvs rdiff -u -r1.22 -r1.23 src/sys/dev/ofw/ofrtc.c
cvs rdiff -u -r1.20 -r1.21 src/sys/dev/pci/igsfb_pci.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/ic/igsfb.c
diff -u src/sys/dev/ic/igsfb.c:1.49 src/sys/dev/ic/igsfb.c:1.50
--- src/sys/dev/ic/igsfb.c:1.49	Wed May 12 20:58:52 2010
+++ src/sys/dev/ic/igsfb.c	Tue Jul 26 08:59:37 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: igsfb.c,v 1.49 2010/05/12 20:58:52 macallan Exp $ */
+/*	$NetBSD: igsfb.c,v 1.50 2011/07/26 08:59:37 mrg Exp $ */
 
 /*
  * Copyright (c) 2002, 2003 Valeriy E. Ushakov
@@ -31,7 +31,7 @@
  * Integraphics Systems IGA 168x and CyberPro series.
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: igsfb.c,v 1.49 2010/05/12 20:58:52 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: igsfb.c,v 1.50 2011/07/26 08:59:37 mrg Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -194,14 +194,14 @@
 	dc->dc_console.scr_flags |= VCONS_SCREEN_IS_STATIC;
 
 	printf("%s: %dMB, %s%dx%d, %dbpp\n",
-	       device_xname(&sc->sc_dev),
+	       device_xname(sc->sc_dev),
 	       (uint32_t)(dc->dc_vmemsz >> 20),
 	       (dc->dc_hwflags & IGSFB_HW_BSWAP)
 		   ? (dc->dc_hwflags & IGSFB_HW_BE_SELECT)
 		       ? "hardware bswap, " : "software bswap, "
 		   : "",
 	       dc->dc_width, dc->dc_height, dc->dc_depth);
-	printf("%s: using %dbpp for X\n", device_xname(&sc->sc_dev),
+	printf("%s: using %dbpp for X\n", device_xname(sc->sc_dev),
 	       dc->dc_maxdepth);
 	ri = &dc->dc_console.scr_ri;
 	ri->ri_ops.eraserows(ri, 0, ri->ri_rows, defattr);
@@ -215,7 +215,7 @@
 	waa.accessops = &igsfb_accessops;
 	waa.accesscookie = &dc->dc_vd;
 
-	config_found(&sc->sc_dev, &waa, wsemuldisplaydevprint);
+	config_found(sc->sc_dev, &waa, wsemuldisplaydevprint);
 }
 
 

Index: src/sys/dev/ic/igsfbvar.h
diff -u src/sys/dev/ic/igsfbvar.h:1.19 src/sys/dev/ic/igsfbvar.h:1.20
--- src/sys/dev/ic/igsfbvar.h:1.19	Wed Nov 18 21:59:38 2009
+++ src/sys/dev/ic/igsfbvar.h	Tue Jul 26 08:59:37 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: igsfbvar.h,v 1.19 2009/11/18 21:59:38 macallan Exp $ */
+/*	$NetBSD: igsfbvar.h,v 1.20 2011/07/26 08:59:37 mrg Exp $ */
 
 /*
  * Copyright (c) 2002, 2003 Valeriy E. Ushakov
@@ -127,7 +127,7 @@
 
 
 struct igsfb_softc {
-	struct device sc_dev;
+	device_t sc_dev;
 	struct igsfb_devconfig *sc_dc;
 };
 

Index: src/sys/dev/ir/cir.c
diff -u src/sys/dev/ir/cir.c:1.28 src/sys/dev/ir/cir.c:1.29
--- src/sys/dev/ir/cir.c:1.28	Wed Dec 29 13:43:16 2010
+++ src/sys/dev/ir/cir.c	Tue Jul 26 08:59:38 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: cir.c,v 1.28 2010/12/29 13:43:16 jmcneill Exp $	*/
+/*	$NetBSD: cir.c,v 1.29 2011/07/26 08:59:38 mrg Exp $	*/
 
 /*
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cir.c,v 1.28 2010/12/29 13:43:16 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cir.c,v 1.29 2011/07/26 08:59:38 mrg Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -64,7 +64,7 @@
 void cir_attach(device_t parent, device_t self, void *aux);
 int cir_detach(device_t self, int flags);
 
-CFATTACH_DECL(cir, sizeof(struct cir_softc),
+CFATTACH_DECL_NEW(cir, sizeof(struct cir_softc),
     cir_match, cir_attach, cir_detach, NULL);
 
 extern struct cfdriver cir_cd;
@@ -85,6 +85,8 @@
 	struct cir_softc *sc = device_private(self);
 	struct ir_attach_args *ia = aux;
 
+	sc->sc_dev = self;
+
 	selinit(&sc->sc_rdsel);
 	sc->sc_methods = ia->ia_methods;
 	sc->sc_handle = ia->ia_handle;
@@ -93,7 +95,7 @@
 	if (sc->sc_methods->im_read == NULL ||
 	    sc->sc_methods->im_write == NULL ||
 	    sc->sc_methods->im_setparams == NULL)
-		panic("%s: missing methods", device_xname(&sc->sc_dev));
+		panic("%s: missing methods", device_xname(sc->sc_dev));
 #endif
 	printf("\n");
 }
@@ -125,7 +127,7 @@
 	sc = device_lookup_private(&cir_cd, CIRUNIT(dev));
 	if (sc == NULL)
 		return (ENXIO);
-	if (!device_is_active(&sc->sc_dev))
+	if (!device_is_active(sc->sc_dev))
 		return (EIO);
 	if (sc->sc_open)
 		return (EBUSY);
@@ -167,7 +169,7 @@
 	sc = device_lookup_private(&cir_cd, CIRUNIT(dev));
 	if (sc == NULL)
 		return (ENXIO);
-	if (!device_is_active(&sc->sc_dev))
+	if (!device_is_active(sc->sc_dev))
 		return (EIO);
 	return (sc->sc_methods->im_read(sc->sc_handle, uio, flag));
 }
@@ -180,7 +182,7 @@
 	sc = device_lookup_private(&cir_cd, CIRUNIT(dev));
 	if (sc == NULL)
 		return (ENXIO);
-	if (!device_is_active(&sc->sc_dev))
+	if (!device_is_active(sc->sc_dev))
 		return (EIO);
 	return (sc->sc_methods->im_write(sc->sc_handle, uio, flag));
 }
@@ -194,7 +196,7 @@
 	sc = device_lookup_private(&cir_cd, CIRUNIT(dev));
 	if (sc == NULL)
 		return (ENXIO);
-	if (!device_is_active(&sc->sc_dev))
+	if (!device_is_active(sc->sc_dev))
 		return (EIO);
 
 	switch (cmd) {
@@ -229,7 +231,7 @@
 	sc = device_lookup_private(&cir_cd, CIRUNIT(dev));
 	if (sc == NULL)
 		return (POLLERR);
-	if (!device_is_active(&sc->sc_dev))
+	if (!device_is_active(sc->sc_dev))
 		return (POLLERR);
 
 	revents = 0;

Index: src/sys/dev/ir/cirvar.h
diff -u src/sys/dev/ir/cirvar.h:1.8 src/sys/dev/ir/cirvar.h:1.9
--- src/sys/dev/ir/cirvar.h:1.8	Fri Oct 10 21:50:09 2008
+++ src/sys/dev/ir/cirvar.h	Tue Jul 26 08:59:38 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: cirvar.h,v 1.8 2008/10/10 21:50:09 jmcneill Exp $	*/
+/*	$NetBSD: cirvar.h,v 1.9 2011/07/26 08:59:38 mrg Exp $	*/
 
 /*
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
 };
 
 struct cir_softc {
-	struct	device		sc_dev;
+	device_t		sc_dev;
 	const struct cir_methods *sc_methods;
 	void			*sc_handle;
 	char			sc_open;

Index: src/sys/dev/ofw/ofcons.c
diff -u src/sys/dev/ofw/ofcons.c:1.42 src/sys/dev/ofw/ofcons.c:1.43
--- src/sys/dev/ofw/ofcons.c:1.42	Sun Apr 24 16:27:00 2011
+++ src/sys/dev/ofw/ofcons.c	Tue Jul 26 08:59:38 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: ofcons.c,v 1.42 2011/04/24 16:27:00 rmind Exp $	*/
+/*	$NetBSD: ofcons.c,v 1.43 2011/07/26 08:59:38 mrg Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ofcons.c,v 1.42 2011/04/24 16:27:00 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ofcons.c,v 1.43 2011/07/26 08:59:38 mrg Exp $");
 
 #include <sys/param.h>
 #include <sys/conf.h>
@@ -48,7 +48,6 @@
 #include <dev/ofw/openfirm.h>
 
 struct ofcons_softc {
-	struct device of_dev;
 	struct tty *of_tty;
 	struct callout sc_poll_ch;
 	int of_flags;
@@ -65,7 +64,7 @@
 static int ofcons_match(device_t, cfdata_t, void *);
 static void ofcons_attach(device_t, device_t, void *);
 
-CFATTACH_DECL(ofcons, sizeof(struct ofcons_softc),
+CFATTACH_DECL_NEW(ofcons, sizeof(struct ofcons_softc),
     ofcons_match, ofcons_attach, NULL, NULL);
 
 extern struct cfdriver ofcons_cd;

Index: src/sys/dev/ofw/ofdisk.c
diff -u src/sys/dev/ofw/ofdisk.c:1.43 src/sys/dev/ofw/ofdisk.c:1.44
--- src/sys/dev/ofw/ofdisk.c:1.43	Tue May 12 14:39:22 2009
+++ src/sys/dev/ofw/ofdisk.c	Tue Jul 26 08:59:38 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: ofdisk.c,v 1.43 2009/05/12 14:39:22 cegger Exp $	*/
+/*	$NetBSD: ofdisk.c,v 1.44 2011/07/26 08:59:38 mrg Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ofdisk.c,v 1.43 2009/05/12 14:39:22 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ofdisk.c,v 1.44 2011/07/26 08:59:38 mrg Exp $");
 
 #include <sys/param.h>
 #include <sys/buf.h>
@@ -49,7 +49,7 @@
 #include <dev/ofw/openfirm.h>
 
 struct ofdisk_softc {
-	struct device sc_dev;
+	device_t sc_dev;
 	int sc_phandle;
 	int sc_unit;
 	int sc_flags;
@@ -66,7 +66,7 @@
 static int ofdisk_match (device_t, cfdata_t, void *);
 static void ofdisk_attach (device_t, device_t, void *);
 
-CFATTACH_DECL(ofdisk, sizeof(struct ofdisk_softc),
+CFATTACH_DECL_NEW(ofdisk, sizeof(struct ofdisk_softc),
     ofdisk_match, ofdisk_attach, NULL, NULL);
 
 extern struct cfdriver ofdisk_cd;
@@ -123,6 +123,7 @@
 	char child[64];
 	int l;
 
+	of->sc_dev = self;
 	if ((l = OF_getprop(oba->oba_phandle, "name", child,
 	    sizeof child - 1)) < 0)
 		panic("device without name?");
@@ -134,7 +135,7 @@
 	of->sc_phandle = oba->oba_phandle;
 	of->sc_unit = oba->oba_unit;
 	of->sc_ihandle = 0;
-	disk_init(&of->sc_dk, device_xname(&of->sc_dev), &ofdisk_dkdriver);
+	disk_init(&of->sc_dk, device_xname(of->sc_dev), &ofdisk_dkdriver);
 	disk_attach(&of->sc_dk);
 	printf("\n");
 
@@ -425,7 +426,7 @@
 			return (EBADF);
 
 		/* If the ioctl happens here, the parent is us. */
-		strlcpy(dkw->dkw_parent, device_xname(&of->sc_dev),
+		strlcpy(dkw->dkw_parent, device_xname(of->sc_dev),
 			sizeof(dkw->dkw_parent));
 		return (dkwedge_add(dkw));
 	    }
@@ -441,7 +442,7 @@
 			return (EBADF);
 
 		/* If the ioctl happens here, the parent is us. */
-		strlcpy(dkw->dkw_parent, device_xname(&of->sc_dev),
+		strlcpy(dkw->dkw_parent, device_xname(of->sc_dev),
 			sizeof(dkw->dkw_parent));
 		return (dkwedge_del(dkw));
 	    }
@@ -563,6 +564,6 @@
 		    unit, RAW_PART), ofdisk_strategy, lp,
 		    of->sc_dk.dk_cpulabel);
 		if (errmes != NULL)
-			printf("%s: %s\n", device_xname(&of->sc_dev), errmes);
+			printf("%s: %s\n", device_xname(of->sc_dev), errmes);
 	}
 }

Index: src/sys/dev/ofw/ofnet.c
diff -u src/sys/dev/ofw/ofnet.c:1.51 src/sys/dev/ofw/ofnet.c:1.52
--- src/sys/dev/ofw/ofnet.c:1.51	Sun Aug  8 18:22:39 2010
+++ src/sys/dev/ofw/ofnet.c	Tue Jul 26 08:59:38 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: ofnet.c,v 1.51 2010/08/08 18:22:39 chs Exp $	*/
+/*	$NetBSD: ofnet.c,v 1.52 2011/07/26 08:59:38 mrg Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ofnet.c,v 1.51 2010/08/08 18:22:39 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ofnet.c,v 1.52 2011/07/26 08:59:38 mrg Exp $");
 
 #include "ofnet.h"
 #include "opt_inet.h"
@@ -74,7 +74,7 @@
 #endif
 
 struct ofnet_softc {
-	struct device sc_dev;
+	device_t sc_dev;
 	int sc_phandle;
 	int sc_ihandle;
 	struct ethercom sc_ethercom;
@@ -84,7 +84,7 @@
 static int ofnet_match (device_t, cfdata_t, void *);
 static void ofnet_attach (device_t, device_t, void *);
 
-CFATTACH_DECL(ofnet, sizeof(struct ofnet_softc),
+CFATTACH_DECL_NEW(ofnet, sizeof(struct ofnet_softc),
     ofnet_match, ofnet_attach, NULL, NULL);
 
 static void ofnet_read (struct ofnet_softc *);
@@ -130,10 +130,12 @@
 	int l;
 	u_int8_t myaddr[ETHER_ADDR_LEN];
 
+	of->sc_dev = self;
+
 	of->sc_phandle = oba->oba_phandle;
 #if NIPKDB_OFN > 0
 	if (kifp &&
-	    kifp->unit - 1 == device_unit(&of->sc_dev) &&
+	    kifp->unit - 1 == device_unit(of->sc_dev) &&
 	    OF_instance_to_package(kifp->port) == oba->oba_phandle)  {
 		ipkdb_of = of;
 		of->sc_ihandle = kifp->port;
@@ -151,7 +153,7 @@
 
 	callout_init(&of->sc_callout, 0);
 
-	strlcpy(ifp->if_xname, device_xname(&of->sc_dev), IFNAMSIZ);
+	strlcpy(ifp->if_xname, device_xname(of->sc_dev), IFNAMSIZ);
 	ifp->if_softc = of;
 	ifp->if_start = ofnet_start;
 	ifp->if_ioctl = ofnet_ioctl;
@@ -408,7 +410,7 @@
 {
 	struct ofnet_softc *of = ifp->if_softc;
 
-	log(LOG_ERR, "%s: device timeout\n", device_xname(&of->sc_dev));
+	log(LOG_ERR, "%s: device timeout\n", device_xname(of->sc_dev));
 	ifp->if_oerrors++;
 	ofnet_stop(of);
 	ofnet_init(of);

Index: src/sys/dev/ofw/ofrtc.c
diff -u src/sys/dev/ofw/ofrtc.c:1.22 src/sys/dev/ofw/ofrtc.c:1.23
--- src/sys/dev/ofw/ofrtc.c:1.22	Tue May 12 14:39:22 2009
+++ src/sys/dev/ofw/ofrtc.c	Tue Jul 26 08:59:38 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: ofrtc.c,v 1.22 2009/05/12 14:39:22 cegger Exp $	*/
+/*	$NetBSD: ofrtc.c,v 1.23 2011/07/26 08:59:38 mrg Exp $	*/
 
 /*
  * Copyright (C) 1996 Wolfgang Solfrank.
@@ -64,7 +64,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ofrtc.c,v 1.22 2009/05/12 14:39:22 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ofrtc.c,v 1.23 2011/07/26 08:59:38 mrg Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -83,7 +83,6 @@
 #define OFRTC_YR  5
 
 struct ofrtc_softc {
-	struct device sc_dev;
 	int sc_phandle;
 	int sc_ihandle;
 	struct todr_chip_handle sc_todr;
@@ -94,7 +93,7 @@
 static int ofrtc_gettod(todr_chip_handle_t, struct clock_ymdhms *);
 static int ofrtc_settod(todr_chip_handle_t, struct clock_ymdhms *);
 
-CFATTACH_DECL(ofrtc, sizeof(struct ofrtc_softc),
+CFATTACH_DECL_NEW(ofrtc, sizeof(struct ofrtc_softc),
     ofrtc_match, ofrtc_attach, NULL, NULL);
 
 static int

Index: src/sys/dev/pci/igsfb_pci.c
diff -u src/sys/dev/pci/igsfb_pci.c:1.20 src/sys/dev/pci/igsfb_pci.c:1.21
--- src/sys/dev/pci/igsfb_pci.c:1.20	Tue May 12 08:23:01 2009
+++ src/sys/dev/pci/igsfb_pci.c	Tue Jul 26 08:59:37 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: igsfb_pci.c,v 1.20 2009/05/12 08:23:01 cegger Exp $ */
+/*	$NetBSD: igsfb_pci.c,v 1.21 2011/07/26 08:59:37 mrg Exp $ */
 
 /*
  * Copyright (c) 2002, 2003 Valeriy E. Ushakov
@@ -31,7 +31,7 @@
  * Integraphics Systems IGA 168x and CyberPro series.
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: igsfb_pci.c,v 1.20 2009/05/12 08:23:01 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: igsfb_pci.c,v 1.21 2011/07/26 08:59:37 mrg Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -158,10 +158,11 @@
 	int isconsole;
 	char devinfo[256];
 
+	sc->sc_dev = self;
+
 	pci_devinfo(pa->pa_id, pa->pa_class, 0, devinfo, sizeof(devinfo));
 	printf(": %s (rev. 0x%02x)\n", devinfo, PCI_REVISION(pa->pa_class));
 
-
 #if defined(__sparc__) && !defined(KRUPS_FORCE_SERIAL_CONSOLE)
 	/* XXX: this doesn't belong here */
 	if (PCITAG_NODE(pa->pa_tag) == prom_instance_to_package(prom_stdout()))

Reply via email to