Module Name:    src
Committed By:   tsutsui
Date:           Fri Apr 17 14:48:17 UTC 2009

Modified Files:
        src/sys/arch/newsmips/apbus: if_tlp_ap.c

Log Message:
Split device_t/softc, use aprint_*().


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/newsmips/apbus/if_tlp_ap.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/newsmips/apbus/if_tlp_ap.c
diff -u src/sys/arch/newsmips/apbus/if_tlp_ap.c:1.10 src/sys/arch/newsmips/apbus/if_tlp_ap.c:1.11
--- src/sys/arch/newsmips/apbus/if_tlp_ap.c:1.10	Mon Apr 28 20:23:30 2008
+++ src/sys/arch/newsmips/apbus/if_tlp_ap.c	Fri Apr 17 14:48:17 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_tlp_ap.c,v 1.10 2008/04/28 20:23:30 martin Exp $	*/
+/*	$NetBSD: if_tlp_ap.c,v 1.11 2009/04/17 14:48:17 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_tlp_ap.c,v 1.10 2008/04/28 20:23:30 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_tlp_ap.c,v 1.11 2009/04/17 14:48:17 tsutsui Exp $");
 
 #include <sys/param.h>
 #include <sys/device.h>
@@ -78,10 +78,10 @@
 	bus_space_handle_t sc_cfsh;
 };
 
-static int	tlp_ap_match(struct device *, struct cfdata *, void *);
-static void	tlp_ap_attach(struct device *, struct device *, void *);
+static int	tlp_ap_match(device_t, cfdata_t, void *);
+static void	tlp_ap_attach(device_t, device_t, void *);
 
-CFATTACH_DECL(tlp_ap, sizeof(struct tulip_ap_softc),
+CFATTACH_DECL_NEW(tlp_ap, sizeof(struct tulip_ap_softc),
     tlp_ap_match, tlp_ap_attach, NULL, NULL);
 
 static void tlp_ap_preinit(struct tulip_softc *);
@@ -94,7 +94,7 @@
 };
 
 static int
-tlp_ap_match(struct device *parent, struct cfdata *cf, void *aux)
+tlp_ap_match(device_t parent, cfdata_t cf, void *aux)
 {
 	struct apbus_attach_args *apa = aux;
 
@@ -108,16 +108,18 @@
  * Install interface into kernel networking data structures
  */
 static void
-tlp_ap_attach(struct device *parent, struct device *self, void *aux)
+tlp_ap_attach(device_t parent, device_t self, void *aux)
 {
-	struct tulip_ap_softc *psc = (void *) self;
+	struct tulip_ap_softc *psc = device_private(self);
 	struct tulip_softc *sc = &psc->sc_tulip;
 	struct apbus_attach_args *apa = aux;
 	uint8_t enaddr[ETHER_ADDR_LEN];
 	u_int intrmask;
 	int i;
 
-	printf(" slot%d addr 0x%lx", apa->apa_slotno, apa->apa_hwbase);
+	sc->sc_dev = self;
+
+	aprint_normal(" slot%d addr 0x%lx", apa->apa_slotno, apa->apa_hwbase);
 
 	/* PCI configuration register */
 	psc->sc_cfst = 0;
@@ -133,11 +135,11 @@
 			sc->sc_chip = TULIP_CHIP_21140;
 		break;
 	default:
-		printf(": unable to handle your board\n");
+		aprint_error(": unable to handle your board\n");
 		return;
 	}
 
-	printf(": %s Ethernet, pass %d.%d\n",
+	aprint_normal(": %s Ethernet, pass %d.%d\n",
 	    tlp_chip_names[sc->sc_chip],
 	    (sc->sc_rev >> 4) & 0xf, sc->sc_rev & 0xf);
 
@@ -146,7 +148,7 @@
 	sc->sc_sh = apa->apa_hwbase + TLP_AP_CSR;
 	sc->sc_dmat = apbus_dmatag_init(apa);
 	if (sc->sc_dmat == NULL) {
-		printf("%s: cannot allocate memory\n", sc->sc_dev.dv_xname);
+		aprint_error_dev(self, "cannot allocate memory\n");
 		return;
 	}
 
@@ -202,7 +204,7 @@
 	TULIP_WRITE(sc, CSR_GPP, 0xcf);			/* mask abort/DMA err */
 
 	if (tlp_read_srom(sc) == 0) {
-		printf("%s: srom read failed\n", sc->sc_dev.dv_xname);
+		aprint_error_dev(self, "srom read failed\n");
 		free(sc->sc_dmat, M_DEVBUF);
 		return;
 	}

Reply via email to