Module Name:    src
Committed By:   christos
Date:           Thu Jun  2 00:24:24 UTC 2011

Modified Files:
        src/sys/arch/sparc64/dev: auxio.c ebus.c ebus_mainbus.c ebusvar.h
            psycho.c psychovar.h sab.c

Log Message:
split auxio, ebus, psycho, sab.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/sparc64/dev/auxio.c
cvs rdiff -u -r1.56 -r1.57 src/sys/arch/sparc64/dev/ebus.c
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/sparc64/dev/ebus_mainbus.c
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/sparc64/dev/ebusvar.h
cvs rdiff -u -r1.106 -r1.107 src/sys/arch/sparc64/dev/psycho.c
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/sparc64/dev/psychovar.h
cvs rdiff -u -r1.47 -r1.48 src/sys/arch/sparc64/dev/sab.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/sparc64/dev/auxio.c
diff -u src/sys/arch/sparc64/dev/auxio.c:1.21 src/sys/arch/sparc64/dev/auxio.c:1.22
--- src/sys/arch/sparc64/dev/auxio.c:1.21	Sat Mar 12 06:43:38 2011
+++ src/sys/arch/sparc64/dev/auxio.c	Wed Jun  1 20:24:23 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: auxio.c,v 1.21 2011/03/12 11:43:38 nakayama Exp $	*/
+/*	$NetBSD: auxio.c,v 1.22 2011/06/02 00:24:23 christos Exp $	*/
 
 /*
  * Copyright (c) 2000, 2001 Matthew R. Green
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: auxio.c,v 1.21 2011/03/12 11:43:38 nakayama Exp $");
+__KERNEL_RCSID(0, "$NetBSD: auxio.c,v 1.22 2011/06/02 00:24:23 christos Exp $");
 
 #include "opt_auxio.h"
 
@@ -60,7 +60,7 @@
  */
 
 struct auxio_softc {
-	struct device		sc_dev;
+	device_t		sc_dev;
 
 	/* parent's tag */
 	bus_space_tag_t		sc_tag;
@@ -81,15 +81,15 @@
 #define	AUXIO_ROM_NAME		"auxio"
 
 void	auxio_attach_common(struct auxio_softc *);
-int	auxio_ebus_match(struct device *, struct cfdata *, void *);
-void	auxio_ebus_attach(struct device *, struct device *, void *);
-int	auxio_sbus_match(struct device *, struct cfdata *, void *);
-void	auxio_sbus_attach(struct device *, struct device *, void *);
+int	auxio_ebus_match(device_t, cfdata_t, void *);
+void	auxio_ebus_attach(device_t, device_t, void *);
+int	auxio_sbus_match(device_t, cfdata_t, void *);
+void	auxio_sbus_attach(device_t, device_t, void *);
 
-CFATTACH_DECL(auxio_ebus, sizeof(struct auxio_softc),
+CFATTACH_DECL_NEW(auxio_ebus, sizeof(struct auxio_softc),
     auxio_ebus_match, auxio_ebus_attach, NULL, NULL);
 
-CFATTACH_DECL(auxio_sbus, sizeof(struct auxio_softc),
+CFATTACH_DECL_NEW(auxio_sbus, sizeof(struct auxio_softc),
     auxio_sbus_match, auxio_sbus_attach, NULL, NULL);
 
 extern struct cfdriver auxio_cd;
@@ -153,7 +153,7 @@
 }
 
 int
-auxio_ebus_match(struct device *parent, struct cfdata *cf, void *aux)
+auxio_ebus_match(device_t parent, cfdata_t cf, void *aux)
 {
 	struct ebus_attach_args *ea = aux;
 
@@ -161,11 +161,12 @@
 }
 
 void
-auxio_ebus_attach(struct device *parent, struct device *self, void *aux)
+auxio_ebus_attach(device_t parent, device_t self, void *aux)
 {
-	struct auxio_softc *sc = (struct auxio_softc *)self;
+	struct auxio_softc *sc = device_private(self);
 	struct ebus_attach_args *ea = aux;
 
+	sc->sc_dev = self;
 	sc->sc_tag = ea->ea_bustag;
 
 	if (ea->ea_nreg < 1) {
@@ -212,19 +213,20 @@
 }
 
 int
-auxio_sbus_match(struct device *parent, struct cfdata *cf, void *aux)
+auxio_sbus_match(device_t parent, cfdata_t cf, void *aux)
 {
 	struct sbus_attach_args *sa = aux;
 
-	return (strcmp(AUXIO_ROM_NAME, sa->sa_name) == 0);
+	return strcmp(AUXIO_ROM_NAME, sa->sa_name) == 0;
 }
 
 void
-auxio_sbus_attach(struct device *parent, struct device *self, void *aux)
+auxio_sbus_attach(device_t parent, device_t self, void *aux)
 {
-	struct auxio_softc *sc = (struct auxio_softc *)self;
+	struct auxio_softc *sc = device_private(self);
 	struct sbus_attach_args *sa = aux;
 
+	sc->sc_dev = self;
 	sc->sc_tag = sa->sa_bustag;
 
 	if (sa->sa_nreg < 1) {

Index: src/sys/arch/sparc64/dev/ebus.c
diff -u src/sys/arch/sparc64/dev/ebus.c:1.56 src/sys/arch/sparc64/dev/ebus.c:1.57
--- src/sys/arch/sparc64/dev/ebus.c:1.56	Fri Mar 18 05:52:54 2011
+++ src/sys/arch/sparc64/dev/ebus.c	Wed Jun  1 20:24:23 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: ebus.c,v 1.56 2011/03/18 09:52:54 mrg Exp $	*/
+/*	$NetBSD: ebus.c,v 1.57 2011/06/02 00:24:23 christos Exp $	*/
 
 /*
  * Copyright (c) 1999, 2000, 2001 Matthew R. Green
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ebus.c,v 1.56 2011/03/18 09:52:54 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ebus.c,v 1.57 2011/06/02 00:24:23 christos Exp $");
 
 #include "opt_ddb.h"
 
@@ -76,10 +76,10 @@
 #include <dev/ebus/ebusvar.h>
 #include <sparc64/dev/ebusvar.h>
 
-int	ebus_match(struct device *, struct cfdata *, void *);
-void	ebus_attach(struct device *, struct device *, void *);
+int	ebus_match(device_t, cfdata_t, void *);
+void	ebus_attach(device_t, device_t, void *);
 
-CFATTACH_DECL(ebus, sizeof(struct ebus_softc),
+CFATTACH_DECL_NEW(ebus, sizeof(struct ebus_softc),
     ebus_match, ebus_attach, NULL, NULL);
 
 /*
@@ -91,7 +91,7 @@
 	void *, void(*)(void));
 
 int
-ebus_match(struct device *parent, struct cfdata *match, void *aux)
+ebus_match(device_t parent, cfdata_t match, void *aux)
 {
 	struct pci_attach_args *pa = aux;
 	char *name;
@@ -131,15 +131,17 @@
  * after the sbus code which does similar things.
  */
 void
-ebus_attach(struct device *parent, struct device *self, void *aux)
+ebus_attach(device_t parent, device_t self, void *aux)
 {
-	struct ebus_softc *sc = (struct ebus_softc *)self;
+	struct ebus_softc *sc = device_private(self);
 	struct pci_attach_args *pa = aux;
 	struct ebus_attach_args eba;
 	struct ebus_interrupt_map_mask *immp;
 	int node, nmapmask, error;
 	char devinfo[256];
 
+	sc->sc_dev = self;
+
 	aprint_normal("\n");
 	aprint_naive("\n");
 

Index: src/sys/arch/sparc64/dev/ebus_mainbus.c
diff -u src/sys/arch/sparc64/dev/ebus_mainbus.c:1.3 src/sys/arch/sparc64/dev/ebus_mainbus.c:1.4
--- src/sys/arch/sparc64/dev/ebus_mainbus.c:1.3	Wed Mar 16 00:00:42 2011
+++ src/sys/arch/sparc64/dev/ebus_mainbus.c	Wed Jun  1 20:24:23 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: ebus_mainbus.c,v 1.3 2011/03/16 04:00:42 mrg Exp $	*/
+/*	$NetBSD: ebus_mainbus.c,v 1.4 2011/06/02 00:24:23 christos Exp $	*/
 /*	$OpenBSD: ebus_mainbus.c,v 1.7 2010/11/11 17:58:23 miod Exp $	*/
 
 /*
@@ -53,10 +53,10 @@
 #include <dev/ebus/ebusvar.h>
 #include <sparc64/dev/ebusvar.h>
 
-int	ebus_mainbus_match(struct device *, struct cfdata *, void *);
-void	ebus_mainbus_attach(struct device *, struct device *, void *);
+int	ebus_mainbus_match(device_t, cfdata_t, void *);
+void	ebus_mainbus_attach(device_t, device_t, void *);
 
-CFATTACH_DECL(ebus_mainbus, sizeof(struct ebus_softc),
+CFATTACH_DECL_NEW(ebus_mainbus, sizeof(struct ebus_softc),
     ebus_mainbus_match, ebus_mainbus_attach, NULL, NULL);
 
 int ebus_mainbus_bus_map(bus_space_tag_t, bus_addr_t, bus_size_t, int,
@@ -67,7 +67,7 @@
 void ebus_mainbus_intr_ack(struct intrhand *);
 
 int
-ebus_mainbus_match(struct device *parent, struct cfdata *match, void *aux)
+ebus_mainbus_match(struct device *parent, cfdata_t cf, void *aux)
 {
 	struct mainbus_attach_args *ma = aux;
 
@@ -79,7 +79,7 @@
 void
 ebus_mainbus_attach(struct device *parent, struct device *self, void *aux)
 {
-	struct ebus_softc *sc = (struct ebus_softc *)self;
+	struct ebus_softc *sc = device_private(self);
 	struct mainbus_attach_args *ma = aux;
 	struct ebus_attach_args eba;
 	struct ebus_interrupt_map_mask *immp;
@@ -87,6 +87,7 @@
 	struct pyro_softc *psc;
 	int i;
 
+	sc->sc_dev = self;
 	sc->sc_node = node = ma->ma_node;
 	sc->sc_ign = INTIGN((ma->ma_upaid) << INTMAP_IGN_SHIFT);
 

Index: src/sys/arch/sparc64/dev/ebusvar.h
diff -u src/sys/arch/sparc64/dev/ebusvar.h:1.9 src/sys/arch/sparc64/dev/ebusvar.h:1.10
--- src/sys/arch/sparc64/dev/ebusvar.h:1.9	Fri Mar 18 05:52:54 2011
+++ src/sys/arch/sparc64/dev/ebusvar.h	Wed Jun  1 20:24:23 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: ebusvar.h,v 1.9 2011/03/18 09:52:54 mrg Exp $	*/
+/*	$NetBSD: ebusvar.h,v 1.10 2011/06/02 00:24:23 christos Exp $	*/
 
 /*
  * Copyright (c) 1999, 2000, 2001 Matthew R. Green
@@ -46,7 +46,7 @@
 #include <dev/ebus/ebusvar.h>
 
 struct ebus_softc {
-	struct device			sc_dev;
+	device_t			sc_dev;
 
 	int				sc_node;
 

Index: src/sys/arch/sparc64/dev/psycho.c
diff -u src/sys/arch/sparc64/dev/psycho.c:1.106 src/sys/arch/sparc64/dev/psycho.c:1.107
--- src/sys/arch/sparc64/dev/psycho.c:1.106	Tue May 17 13:34:53 2011
+++ src/sys/arch/sparc64/dev/psycho.c	Wed Jun  1 20:24:23 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: psycho.c,v 1.106 2011/05/17 17:34:53 dyoung Exp $	*/
+/*	$NetBSD: psycho.c,v 1.107 2011/06/02 00:24:23 christos Exp $	*/
 
 /*
  * Copyright (c) 1999, 2000 Matthew R. Green
@@ -55,7 +55,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: psycho.c,v 1.106 2011/05/17 17:34:53 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: psycho.c,v 1.107 2011/06/02 00:24:23 christos Exp $");
 
 #include "opt_ddb.h"
 
@@ -161,11 +161,11 @@
 /*
  * autoconfiguration
  */
-static	int	psycho_match(struct device *, struct cfdata *, void *);
-static	void	psycho_attach(struct device *, struct device *, void *);
+static	int	psycho_match(device_t, cfdata_t, void *);
+static	void	psycho_attach(device_t, device_t, void *);
 static	int	psycho_print(void *aux, const char *p);
 
-CFATTACH_DECL(psycho, sizeof(struct psycho_softc),
+CFATTACH_DECL_NEW(psycho, sizeof(struct psycho_softc),
     psycho_match, psycho_attach, NULL, NULL);
 
 /*
@@ -221,7 +221,7 @@
 };
 
 static	int
-psycho_match(struct device *parent, struct cfdata *match, void *aux)
+psycho_match(device_t parent, cfdata_t match, void *aux)
 {
 	struct mainbus_attach_args *ma = aux;
 	char *model = prom_getpropstring(ma->ma_node, "model");
@@ -285,9 +285,9 @@
  *	  just copy it's tags and addresses.
  */
 static	void
-psycho_attach(struct device *parent, struct device *self, void *aux)
+psycho_attach(device_t parent, device_t self, void *aux)
 {
-	struct psycho_softc *sc = (struct psycho_softc *)self;
+	struct psycho_softc *sc = device_private(self);
 	struct psycho_softc *osc = NULL;
 	struct psycho_pbm *pp;
 	struct pcibus_attach_args pba;
@@ -303,6 +303,7 @@
 
 	aprint_normal("\n");
 
+	sc->sc_dev = self;
 	sc->sc_node = ma->ma_node;
 	sc->sc_bustag = ma->ma_bustag;
 	sc->sc_dmatag = ma->ma_dmatag;
@@ -718,14 +719,14 @@
 	sc->sc_powerpressed = 0;
 	sc->sc_smcontext = malloc(sizeof(struct sysmon_pswitch), M_DEVBUF, 0);
 	if (!sc->sc_smcontext) {
-		aprint_error_dev(&sc->sc_dev, "could not allocate power button context\n");
+		aprint_error_dev(sc->sc_dev, "could not allocate power button context\n");
 		return;
 	}
 	memset(sc->sc_smcontext, 0, sizeof(struct sysmon_pswitch));
-	sc->sc_smcontext->smpsw_name = device_xname(&sc->sc_dev);
+	sc->sc_smcontext->smpsw_name = device_xname(sc->sc_dev);
 	sc->sc_smcontext->smpsw_type = PSWITCH_TYPE_POWER;
 	if (sysmon_pswitch_register(sc->sc_smcontext) != 0)
-		aprint_error_dev(&sc->sc_dev, "unable to register power button with sysmon\n");
+		aprint_error_dev(sc->sc_dev, "unable to register power button with sysmon\n");
 }
 
 static void
@@ -885,12 +886,12 @@
 	 * It's uncorrectable.  Dump the regs and panic.
 	 */
 	snprintb(bits, sizeof(bits), PSYCHO_UE_AFSR_BITS, afsr);
-	aprint_error_dev(&sc->sc_dev,
+	aprint_error_dev(sc->sc_dev,
 	    "uncorrectable DMA error AFAR %" PRIx64 " AFSR %s\n", afar, bits);
 
 	/* Sometimes the AFAR points to an IOTSB entry */
 	if (afar >= is->is_ptsb && afar < is->is_ptsb + size) {
-		aprint_error_dev(&sc->sc_dev,
+		aprint_error_dev(sc->sc_dev,
 		    "IOVA %" PRIx64 " IOTTE %" PRIx64 "\n",
 		    (afar - is->is_ptsb) / sizeof(is->is_tsb[0]) * PAGE_SIZE
 		    + is->is_dvmabase, ldxa(afar, ASI_PHYS_CACHED));
@@ -912,7 +913,7 @@
 	/*
 	 * It's correctable.  Dump the regs and continue.
 	 */
-	aprint_error_dev(&sc->sc_dev,
+	aprint_error_dev(sc->sc_dev,
 	    "correctable DMA error AFAR %" PRIx64 " AFSR %" PRIx64 "\n",
 	    regs->psy_ce_afar, regs->psy_ce_afsr);
 	return (1);
@@ -929,7 +930,7 @@
 	 */
 
 	panic("%s: PCI bus A error AFAR %" PRIx64 " AFSR %" PRIx64,
-	    device_xname(&sc->sc_dev),
+	    device_xname(sc->sc_dev),
 	    regs->psy_pcictl[0].pci_afar, regs->psy_pcictl[0].pci_afsr);
 	return (1);
 }
@@ -945,7 +946,7 @@
 	 */
 
 	panic("%s: PCI bus B error AFAR %" PRIx64 " AFSR %" PRIx64,
-	    device_xname(&sc->sc_dev),
+	    device_xname(sc->sc_dev),
 	    regs->psy_pcictl[0].pci_afar, regs->psy_pcictl[0].pci_afsr);
 	return (1);
 }
@@ -975,7 +976,7 @@
 	 * Gee, we don't really have a framework to deal with this
 	 * properly.
 	 */
-	aprint_error_dev(&sc->sc_dev, "power management wakeup\n");
+	aprint_error_dev(sc->sc_dev, "power management wakeup\n");
 	return (1);
 }
 
@@ -1027,7 +1028,7 @@
 	name = (char *)malloc(32, M_DEVBUF, M_NOWAIT);
 	if (name == 0)
 		panic("couldn't malloc iommu name");
-	snprintf(name, 32, "%s dvma", device_xname(&sc->sc_dev));
+	snprintf(name, 32, "%s dvma", device_xname(sc->sc_dev));
 
 	iommu_init(name, is, tsbsize, iobase);
 }

Index: src/sys/arch/sparc64/dev/psychovar.h
diff -u src/sys/arch/sparc64/dev/psychovar.h:1.17 src/sys/arch/sparc64/dev/psychovar.h:1.18
--- src/sys/arch/sparc64/dev/psychovar.h:1.17	Tue Dec  9 08:14:38 2008
+++ src/sys/arch/sparc64/dev/psychovar.h	Wed Jun  1 20:24:23 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: psychovar.h,v 1.17 2008/12/09 13:14:38 nakayama Exp $	*/
+/*	$NetBSD: psychovar.h,v 1.18 2011/06/02 00:24:23 christos Exp $	*/
 
 /*
  * Copyright (c) 1999, 2000 Matthew R. Green
@@ -83,7 +83,7 @@
  * per pair of psycho's.
  */
 struct psycho_softc {
-	struct	device			sc_dev;
+	device_t			sc_dev;
 
 	/*
 	 * one sabre has two simba's.  psycho's are separately attached,

Index: src/sys/arch/sparc64/dev/sab.c
diff -u src/sys/arch/sparc64/dev/sab.c:1.47 src/sys/arch/sparc64/dev/sab.c:1.48
--- src/sys/arch/sparc64/dev/sab.c:1.47	Mon May 23 21:17:36 2011
+++ src/sys/arch/sparc64/dev/sab.c	Wed Jun  1 20:24:23 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: sab.c,v 1.47 2011/05/24 01:17:36 mrg Exp $	*/
+/*	$NetBSD: sab.c,v 1.48 2011/06/02 00:24:23 christos Exp $	*/
 /*	$OpenBSD: sab.c,v 1.7 2002/04/08 17:49:42 jason Exp $	*/
 
 /*
@@ -42,7 +42,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sab.c,v 1.47 2011/05/24 01:17:36 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sab.c,v 1.48 2011/06/02 00:24:23 christos Exp $");
 
 #include "opt_kgdb.h"
 #include <sys/types.h>
@@ -77,7 +77,7 @@
 #define	SABTTY_RBUF_SIZE	1024	/* must be divisible by 2 */
 
 struct sab_softc {
-	struct device		sc_dv;
+	device_t		sc_dev;
 	struct intrhand *	sc_ih;
 	bus_space_tag_t		sc_bt;
 	bus_space_handle_t	sc_bh;
@@ -92,7 +92,7 @@
 };
 
 struct sabtty_softc {
-	struct device		sc_dv;
+	device_t		sc_dev;
 	struct sab_softc *	sc_parent;
 	bus_space_tag_t		sc_bt;
 	bus_space_handle_t	sc_bh;
@@ -128,8 +128,8 @@
 #define	SAB_WRITE_BLOCK(sc,r,p,c)	\
     bus_space_write_region_1((sc)->sc_bt, (sc)->sc_bh, (r), (p), (c))
 
-int sab_match(struct device *, struct cfdata *, void *);
-void sab_attach(struct device *, struct device *, void *);
+int sab_match(device_t, cfdata_t, void *);
+void sab_attach(device_t, device_t, void *);
 int sab_print(void *, const char *);
 int sab_intr(void *);
 
@@ -138,8 +138,8 @@
 int sab_cngetc(dev_t);
 void sab_cnpollc(dev_t, int);
 
-int sabtty_match(struct device *, struct cfdata *, void *);
-void sabtty_attach(struct device *, struct device *, void *);
+int sabtty_match(device_t, cfdata_t, void *);
+void sabtty_attach(device_t, device_t, void *);
 void sabtty_start(struct tty *);
 int sabtty_param(struct tty *, struct termios *);
 int sabtty_intr(struct sabtty_softc *, int *);
@@ -163,12 +163,12 @@
 void sabtty_cnputc(struct sabtty_softc *, int);
 int sabtty_cngetc(struct sabtty_softc *);
 
-CFATTACH_DECL(sab, sizeof(struct sab_softc),
+CFATTACH_DECL_NEW(sab, sizeof(struct sab_softc),
     sab_match, sab_attach, NULL, NULL);
 
 extern struct cfdriver sab_cd;
 
-CFATTACH_DECL(sabtty, sizeof(struct sabtty_softc),
+CFATTACH_DECL_NEW(sabtty, sizeof(struct sabtty_softc),
     sabtty_match, sabtty_attach, NULL, NULL);
 
 extern struct cfdriver sabtty_cd;
@@ -222,7 +222,7 @@
 };
 
 int
-sab_match(struct device *parent, struct cfdata *match, void *aux)
+sab_match(device_t parent, cfdata_t match, void *aux)
 {
 	struct ebus_attach_args *ea = aux;
 	char *compat;
@@ -239,14 +239,15 @@
 }
 
 void
-sab_attach(struct device *parent, struct device *self, void *aux)
+sab_attach(device_t parent, device_t self, void *aux)
 {
-	struct sab_softc *sc = (struct sab_softc *)self;
+	struct sab_softc *sc = device_private(self);
 	struct ebus_attach_args *ea = aux;
 	uint8_t r;
 	u_int i;
 	int locs[SABCF_NLOCS];
 
+	sc->sc_dev = self;
 	sc->sc_bt = ea->ea_bustag;
 	sc->sc_node = ea->ea_node;
 
@@ -309,9 +310,8 @@
 
 		locs[SABCF_CHANNEL] = i;
 
-		sc->sc_child[i] =
-		    (struct sabtty_softc *)config_found_sm_loc(self,
-		     "sab", locs, &stax, sab_print, config_stdsubmatch);
+		sc->sc_child[i] = device_private(config_found_sm_loc(self,
+		     "sab", locs, &stax, sab_print, config_stdsubmatch));
 		if (sc->sc_child[i] != NULL)
 			sc->sc_nchild++;
 	}
@@ -365,21 +365,22 @@
 }
 
 int
-sabtty_match(struct device *parent, struct cfdata *match, void *aux)
+sabtty_match(device_t parent, cfdata_t match, void *aux)
 {
 
 	return (1);
 }
 
 void
-sabtty_attach(struct device *parent, struct device *self, void *aux)
+sabtty_attach(device_t parent, device_t self, void *aux)
 {
-	struct sabtty_softc *sc = (struct sabtty_softc *)self;
+	struct sabtty_softc *sc = device_private(self);
 	struct sabtty_attach_args *sa = aux;
 	int r;
 	int maj;
 	int is_kgdb = 0;
 
+	sc->sc_dev = self;
 #ifdef KGDB
 	is_kgdb = sab_kgdb_check(sc);
 #endif
@@ -395,7 +396,7 @@
 		sc->sc_tty->t_param = sabtty_param;
 	}
 
-	sc->sc_parent = (struct sab_softc *)parent;
+	sc->sc_parent = device_private(parent);
 	sc->sc_bt = sc->sc_parent->sc_bt;
 	sc->sc_portno = sa->sbt_portno;
 	sc->sc_rend = sc->sc_rbuf + SABTTY_RBUF_SIZE;
@@ -647,7 +648,7 @@
 
 	if (flags & SABTTYF_RINGOVERFLOW)
 		log(LOG_WARNING, "%s: ring overflow\n",
-		    device_xname(&sc->sc_dv));
+		    device_xname(sc->sc_dev));
 
 	if (flags & SABTTYF_DONE) {
 		ndflush(&tp->t_outq, sc->sc_txp - tp->t_outq.c_cf);
@@ -1349,7 +1350,7 @@
 int
 sab_kgdb_check(struct sabtty_softc *sc)
 {
-	return strcmp(device_xname(&sc->sc_dv), KGDB_DEVNAME) == 0;
+	return strcmp(device_xname(sc->sc_dev), KGDB_DEVNAME) == 0;
 }
 
 void

Reply via email to