use aprint_*_dev and device_xname

This commit is contained in:
cegger 2008-04-05 19:16:49 +00:00
parent 7633a17263
commit 34895c30e4
4 changed files with 41 additions and 47 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: dl.c,v 1.39 2007/11/19 18:51:49 ad Exp $ */ /* $NetBSD: dl.c,v 1.40 2008/04/05 19:16:49 cegger Exp $ */
/*- /*-
* Copyright (c) 1996, 1997 The NetBSD Foundation, Inc. * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
@ -111,7 +111,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: dl.c,v 1.39 2007/11/19 18:51:49 ad Exp $"); __KERNEL_RCSID(0, "$NetBSD: dl.c,v 1.40 2008/04/05 19:16:49 cegger Exp $");
#include <sys/param.h> #include <sys/param.h>
#include <sys/systm.h> #include <sys/systm.h>
@ -260,9 +260,9 @@ dl_attach (struct device *parent, struct device *self, void *aux)
uba_intr_establish(ua->ua_icookie, ua->ua_cvec - 4, uba_intr_establish(ua->ua_icookie, ua->ua_cvec - 4,
dlrint, sc, &sc->sc_rintrcnt); dlrint, sc, &sc->sc_rintrcnt);
evcnt_attach_dynamic(&sc->sc_rintrcnt, EVCNT_TYPE_INTR, ua->ua_evcnt, evcnt_attach_dynamic(&sc->sc_rintrcnt, EVCNT_TYPE_INTR, ua->ua_evcnt,
sc->sc_dev.dv_xname, "rintr"); device_xname(&sc->sc_dev), "rintr");
evcnt_attach_dynamic(&sc->sc_tintrcnt, EVCNT_TYPE_INTR, ua->ua_evcnt, evcnt_attach_dynamic(&sc->sc_tintrcnt, EVCNT_TYPE_INTR, ua->ua_evcnt,
sc->sc_dev.dv_xname, "tintr"); device_xname(&sc->sc_dev), "tintr");
printf("\n"); printf("\n");
} }
@ -293,7 +293,7 @@ dlrint(void *arg)
* else where we can afford the time. * else where we can afford the time.
*/ */
log(LOG_WARNING, "%s: rx overrun\n", log(LOG_WARNING, "%s: rx overrun\n",
sc->sc_dev.dv_xname); device_xname(&sc->sc_dev));
} }
if (c & DL_RBUF_FRAMING_ERR) if (c & DL_RBUF_FRAMING_ERR)
cc |= TTY_FE; cc |= TTY_FE;
@ -304,7 +304,7 @@ dlrint(void *arg)
#if defined(DIAGNOSTIC) #if defined(DIAGNOSTIC)
} else { } else {
log(LOG_WARNING, "%s: stray rx interrupt\n", log(LOG_WARNING, "%s: stray rx interrupt\n",
sc->sc_dev.dv_xname); device_xname(&sc->sc_dev));
#endif #endif
} }
} }

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_dmc.c,v 1.15 2007/10/19 12:01:08 ad Exp $ */ /* $NetBSD: if_dmc.c,v 1.16 2008/04/05 19:16:49 cegger Exp $ */
/* /*
* Copyright (c) 1982, 1986 Regents of the University of California. * Copyright (c) 1982, 1986 Regents of the University of California.
* All rights reserved. * All rights reserved.
@ -41,7 +41,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if_dmc.c,v 1.15 2007/10/19 12:01:08 ad Exp $"); __KERNEL_RCSID(0, "$NetBSD: if_dmc.c,v 1.16 2008/04/05 19:16:49 cegger Exp $");
#undef DMCDEBUG /* for base table dump on fatal error */ #undef DMCDEBUG /* for base table dump on fatal error */
@ -256,7 +256,7 @@ dmcattach(struct device *parent, struct device *self, void *aux)
sc->sc_ioh = ua->ua_ioh; sc->sc_ioh = ua->ua_ioh;
sc->sc_dmat = ua->ua_dmat; sc->sc_dmat = ua->ua_dmat;
strcpy(sc->sc_if.if_xname, sc->sc_dev.dv_xname); strlcpy(sc->sc_if.if_xname, device_xname(&sc->sc_dev), IFNAMSIZ);
sc->sc_if.if_mtu = DMCMTU; sc->sc_if.if_mtu = DMCMTU;
sc->sc_if.if_init = dmcinit; sc->sc_if.if_init = dmcinit;
sc->sc_if.if_output = dmcoutput; sc->sc_if.if_output = dmcoutput;
@ -272,9 +272,9 @@ dmcattach(struct device *parent, struct device *self, void *aux)
&sc->sc_tintrcnt); &sc->sc_tintrcnt);
uba_reset_establish(dmcreset, &sc->sc_dev); uba_reset_establish(dmcreset, &sc->sc_dev);
evcnt_attach_dynamic(&sc->sc_rintrcnt, EVCNT_TYPE_INTR, ua->ua_evcnt, evcnt_attach_dynamic(&sc->sc_rintrcnt, EVCNT_TYPE_INTR, ua->ua_evcnt,
sc->sc_dev.dv_xname, "intr"); device_xname(&sc->sc_dev), "intr");
evcnt_attach_dynamic(&sc->sc_tintrcnt, EVCNT_TYPE_INTR, ua->ua_evcnt, evcnt_attach_dynamic(&sc->sc_tintrcnt, EVCNT_TYPE_INTR, ua->ua_evcnt,
sc->sc_dev.dv_xname, "intr"); device_xname(&sc->sc_dev), "intr");
if_attach(&sc->sc_if); if_attach(&sc->sc_if);
} }
@ -338,8 +338,7 @@ dmcinit(struct ifnet *ifp)
(void *)device_parent(&sc->sc_dev), (void *)device_parent(&sc->sc_dev),
sizeof(struct dmc_header) + DMCMTU, sizeof(struct dmc_header) + DMCMTU,
sc->sc_ifr, NRCV, sc->sc_ifw, NXMT) == 0) { sc->sc_ifr, NRCV, sc->sc_ifw, NXMT) == 0) {
printf("%s: can't allocate uba resources\n", aprint_error_dev(&sc->sc_dev, "can't allocate uba resources\n");
sc->sc_dev.dv_xname);
ifp->if_flags &= ~IFF_UP; ifp->if_flags &= ~IFF_UP;
return 0; return 0;
} }
@ -503,7 +502,7 @@ dmcrint(void *arg)
int n; int n;
if ((qp = sc->sc_qactive) == (struct dmc_command *) 0) { if ((qp = sc->sc_qactive) == (struct dmc_command *) 0) {
printf("%s: dmcrint no command\n", sc->sc_dev.dv_xname); printf("%s: dmcrint no command\n", device_xname(&sc->sc_dev));
return; return;
} }
while (DMC_RBYTE(DMC_BSEL0) & DMC_RDYI) { while (DMC_RBYTE(DMC_BSEL0) & DMC_RDYI) {
@ -590,15 +589,14 @@ dmcxint(void *a)
if (rp >= &sc->sc_rbufs[NRCV]) if (rp >= &sc->sc_rbufs[NRCV])
panic("dmc rcv"); panic("dmc rcv");
if ((rp->flags & DBUF_DMCS) == 0) if ((rp->flags & DBUF_DMCS) == 0)
printf("%s: done unalloc rbuf\n", aprint_error_dev(&sc->sc_dev, "done unalloc rbuf\n");
sc->sc_dev.dv_xname);
len = (arg & DMC_CCOUNT) - sizeof (struct dmc_header); len = (arg & DMC_CCOUNT) - sizeof (struct dmc_header);
if (len < 0 || len > DMCMTU) { if (len < 0 || len > DMCMTU) {
ifp->if_ierrors++; ifp->if_ierrors++;
#ifdef DMCDEBUG #ifdef DMCDEBUG
printd("%s: bad rcv pkt addr 0x%x len 0x%x\n", printd("%s: bad rcv pkt addr 0x%x len 0x%x\n",
sc->sc_dev.dv_xname, pkaddr, len); device_xname(&sc->sc_dev), pkaddr, len);
#endif #endif
goto setup; goto setup;
} }
@ -667,13 +665,13 @@ dmcxint(void *a)
ifxp++; ifxp++;
} }
if (rp >= &sc->sc_xbufs[NXMT]) { if (rp >= &sc->sc_xbufs[NXMT]) {
printf("%s: bad packet address 0x%x\n", aprint_error_dev(&sc->sc_dev, "bad packet address 0x%x\n",
sc->sc_dev.dv_xname, pkaddr); pkaddr);
break; break;
} }
if ((rp->flags & DBUF_DMCS) == 0) if ((rp->flags & DBUF_DMCS) == 0)
printf("%s: unallocated packet 0x%x\n", aprint_error_dev(&sc->sc_dev, "unallocated packet 0x%x\n",
sc->sc_dev.dv_xname, pkaddr); pkaddr);
/* mark buffer free */ /* mark buffer free */
if_ubaend(&sc->sc_ifuba, ifxp); if_ubaend(&sc->sc_ifuba, ifxp);
rp->flags &= ~DBUF_DMCS; rp->flags &= ~DBUF_DMCS;
@ -701,7 +699,7 @@ dmcxint(void *a)
buf, sizeof(buf)); buf, sizeof(buf));
log(LOG_ERR, log(LOG_ERR,
"%s: fatal error, flags=%s\n", "%s: fatal error, flags=%s\n",
sc->sc_dev.dv_xname, buf); device_xname(&sc->sc_dev), buf);
} }
dmcrestart(sc); dmcrestart(sc);
break; break;
@ -734,7 +732,7 @@ dmcxint(void *a)
#ifdef DMCDEBUG #ifdef DMCDEBUG
bitmask_snprintf(arg, CNTLO_BITS, buf, sizeof(buf)); bitmask_snprintf(arg, CNTLO_BITS, buf, sizeof(buf));
printd("%s: soft error, flags=%s\n", printd("%s: soft error, flags=%s\n",
sc->sc_dev.dv_xname, buf); device_xname(&sc->sc_dev), buf);
#endif #endif
if ((sc->sc_flag & DMC_RESTART) == 0) { if ((sc->sc_flag & DMC_RESTART) == 0) {
/* /*
@ -750,7 +748,7 @@ dmcxint(void *a)
default: default:
printf("%s: bad control %o\n", printf("%s: bad control %o\n",
sc->sc_dev.dv_xname, cmd); device_xname(&sc->sc_dev), cmd);
break; break;
} }
} }
@ -881,7 +879,7 @@ dmcrestart(struct dmc_softc *sc)
#ifdef DMCDEBUG #ifdef DMCDEBUG
/* dump base table */ /* dump base table */
printf("%s base table:\n", sc->sc_dev.dv_xname); printf("%s base table:\n", device_xname(&sc->sc_dev));
for (i = 0; i < sizeof (struct dmc_base); i++) for (i = 0; i < sizeof (struct dmc_base); i++)
printf("%o\n" ,dmc_base[unit].d_base[i]); printf("%o\n" ,dmc_base[unit].d_base[i]);
#endif #endif
@ -896,7 +894,7 @@ dmcrestart(struct dmc_softc *sc)
; ;
/* Did the timer expire or did the DMR finish? */ /* Did the timer expire or did the DMR finish? */
if ((DMC_RBYTE(DMC_BSEL1) & DMC_RUN) == 0) { if ((DMC_RBYTE(DMC_BSEL1) & DMC_RUN) == 0) {
log(LOG_ERR, "%s: M820 Test Failed\n", sc->sc_dev.dv_xname); log(LOG_ERR, "%s: M820 Test Failed\n", device_xname(&sc->sc_dev));
return; return;
} }
@ -949,7 +947,7 @@ dmctimeout(struct ifnet *ifp)
bitmask_snprintf(DMC_RBYTE(DMC_BSEL2) & 0xff, DMC2BITS, bitmask_snprintf(DMC_RBYTE(DMC_BSEL2) & 0xff, DMC2BITS,
buf2, sizeof(buf2)); buf2, sizeof(buf2));
log(LOG_ERR, "%s: output timeout, bsel0=%s bsel2=%s\n", log(LOG_ERR, "%s: output timeout, bsel0=%s bsel2=%s\n",
sc->sc_dev.dv_xname, buf1, buf2); device_xname(&sc->sc_dev), buf1, buf2);
dmcrestart(sc); dmcrestart(sc);
} }
} }

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_il.c,v 1.18 2007/10/19 12:01:08 ad Exp $ */ /* $NetBSD: if_il.c,v 1.19 2008/04/05 19:16:49 cegger Exp $ */
/* /*
* Copyright (c) 1982, 1986 Regents of the University of California. * Copyright (c) 1982, 1986 Regents of the University of California.
* All rights reserved. * All rights reserved.
@ -35,7 +35,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if_il.c,v 1.18 2007/10/19 12:01:08 ad Exp $"); __KERNEL_RCSID(0, "$NetBSD: if_il.c,v 1.19 2008/04/05 19:16:49 cegger Exp $");
#include "opt_inet.h" #include "opt_inet.h"
@ -170,11 +170,11 @@ ilattach(struct device *parent, struct device *self, void *aux)
uba_intr_establish(ua->ua_icookie, ua->ua_cvec, ilcint, uba_intr_establish(ua->ua_icookie, ua->ua_cvec, ilcint,
sc, &sc->sc_cintrcnt); sc, &sc->sc_cintrcnt);
evcnt_attach_dynamic(&sc->sc_cintrcnt, EVCNT_TYPE_INTR, ua->ua_evcnt, evcnt_attach_dynamic(&sc->sc_cintrcnt, EVCNT_TYPE_INTR, ua->ua_evcnt,
sc->sc_dev.dv_xname, "intr"); device_xname(&sc->sc_dev), "intr");
uba_intr_establish(ua->ua_icookie, ua->ua_cvec-4, ilrint, uba_intr_establish(ua->ua_icookie, ua->ua_cvec-4, ilrint,
sc, &sc->sc_rintrcnt); sc, &sc->sc_rintrcnt);
evcnt_attach_dynamic(&sc->sc_rintrcnt, EVCNT_TYPE_INTR, ua->ua_evcnt, evcnt_attach_dynamic(&sc->sc_rintrcnt, EVCNT_TYPE_INTR, ua->ua_evcnt,
sc->sc_dev.dv_xname, "intr"); device_xname(&sc->sc_dev), "intr");
uba_reset_establish(ilreset, &sc->sc_dev); uba_reset_establish(ilreset, &sc->sc_dev);
/* /*
@ -193,12 +193,12 @@ ilattach(struct device *parent, struct device *self, void *aux)
IL_WCSR(IL_CSR, ((sc->sc_ui.ui_baddr >> 2) & IL_EUA)|ILC_STAT); IL_WCSR(IL_CSR, ((sc->sc_ui.ui_baddr >> 2) & IL_EUA)|ILC_STAT);
(void)ilwait(sc, "status"); (void)ilwait(sc, "status");
ubfree((struct uba_softc *)parent, &sc->sc_ui); ubfree((struct uba_softc *)parent, &sc->sc_ui);
printf("%s: module=%s firmware=%s\n", sc->sc_dev.dv_xname, printf("%s: module=%s firmware=%s\n", device_xname(&sc->sc_dev),
sc->sc_stats.ils_module, sc->sc_stats.ils_firmware); sc->sc_stats.ils_module, sc->sc_stats.ils_firmware);
printf("%s: hardware address %s\n", sc->sc_dev.dv_xname, printf("%s: hardware address %s\n", device_xname(&sc->sc_dev),
ether_sprintf(sc->sc_stats.ils_addr)); ether_sprintf(sc->sc_stats.ils_addr));
strcpy(ifp->if_xname, sc->sc_dev.dv_xname); strlcpy(ifp->if_xname, device_xname(&sc->sc_dev), IFNAMSIZ);
ifp->if_softc = sc; ifp->if_softc = sc;
ifp->if_flags = IFF_BROADCAST; ifp->if_flags = IFF_BROADCAST;
ifp->if_init = ilinit; ifp->if_init = ilinit;
@ -230,7 +230,7 @@ ilwait(struct il_softc *sc, char *op)
if (IL_RCSR(IL_CSR)&IL_STATUS) { if (IL_RCSR(IL_CSR)&IL_STATUS) {
char bits[64]; char bits[64];
printf("%s: %s failed, csr=%s\n", sc->sc_dev.dv_xname, op, aprint_error_dev(&sc->sc_dev, "%s failed, csr=%s\n", op,
bitmask_snprintf(IL_RCSR(IL_CSR), IL_BITS, bits, bitmask_snprintf(IL_RCSR(IL_CSR), IL_BITS, bits,
sizeof(bits))); sizeof(bits)));
return (-1); return (-1);
@ -247,7 +247,7 @@ ilreset(struct device *dev)
{ {
struct il_softc *sc = (void *)dev; struct il_softc *sc = (void *)dev;
printf(" %s", sc->sc_dev.dv_xname); printf(" %s", device_xname(&sc->sc_dev));
sc->sc_if.if_flags &= ~IFF_RUNNING; sc->sc_if.if_flags &= ~IFF_RUNNING;
sc->sc_flags &= ~ILF_RUNNING; sc->sc_flags &= ~ILF_RUNNING;
ilinit(&sc->sc_if); ilinit(&sc->sc_if);
@ -270,7 +270,7 @@ ilinit(struct ifnet *ifp)
if (if_ubainit(&sc->sc_ifuba, if (if_ubainit(&sc->sc_ifuba,
(void *)device_parent(&sc->sc_dev), (void *)device_parent(&sc->sc_dev),
ETHER_MAX_LEN)) { ETHER_MAX_LEN)) {
printf("%s: can't initialize\n", sc->sc_dev.dv_xname); aprint_error_dev(&sc->sc_dev, "can't initialize\n");
sc->sc_if.if_flags &= ~IFF_UP; sc->sc_if.if_flags &= ~IFF_UP;
return 0; return 0;
} }
@ -318,8 +318,7 @@ ilinit(struct ifnet *ifp)
return 0; return 0;
if (memcmp(sc->sc_stats.ils_addr, if (memcmp(sc->sc_stats.ils_addr,
CLLADDR(ifp->if_sadl), ETHER_ADDR_LEN) != 0) { CLLADDR(ifp->if_sadl), ETHER_ADDR_LEN) != 0) {
printf("%s: setaddr didn't work\n", aprint_error_dev(&sc->sc_dev, "setaddr didn't work\n");
sc->sc_dev.dv_xname);
return 0; return 0;
} }
} }
@ -445,8 +444,7 @@ ilcint(void *arg)
if ((sc->sc_if.if_flags & IFF_OACTIVE) == 0) { if ((sc->sc_if.if_flags & IFF_OACTIVE) == 0) {
char bits[64]; char bits[64];
printf("%s: stray xmit interrupt, csr=%s\n", aprint_error_dev(&sc->sc_dev, "stray xmit interrupt, csr=%s\n",
sc->sc_dev.dv_xname,
bitmask_snprintf(IL_RCSR(IL_CSR), IL_BITS, bits, bitmask_snprintf(IL_RCSR(IL_CSR), IL_BITS, bits,
sizeof(bits))); sizeof(bits)));
return; return;
@ -594,7 +592,7 @@ iltotal(struct il_softc *sc)
if ((sc->sc_flags & ILF_SETADDR) && if ((sc->sc_flags & ILF_SETADDR) &&
(memcmp(sc->sc_stats.ils_addr, CLLADDR(ifp->if_sadl), (memcmp(sc->sc_stats.ils_addr, CLLADDR(ifp->if_sadl),
ETHER_ADDR_LEN) != 0)) { ETHER_ADDR_LEN) != 0)) {
log(LOG_ERR, "%s: physaddr reverted\n", sc->sc_dev.dv_xname); log(LOG_ERR, "%s: physaddr reverted\n", device_xname(&sc->sc_dev));
sc->sc_flags &= ~ILF_RUNNING; sc->sc_flags &= ~ILF_RUNNING;
ilinit(&sc->sc_if); ilinit(&sc->sc_if);
} }

View File

@ -1,4 +1,4 @@
/* $NetBSD: ts.c,v 1.24 2008/03/11 05:34:02 matt Exp $ */ /* $NetBSD: ts.c,v 1.25 2008/04/05 19:16:49 cegger Exp $ */
/*- /*-
* Copyright (c) 1991 The Regents of the University of California. * Copyright (c) 1991 The Regents of the University of California.
@ -66,7 +66,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ts.c,v 1.24 2008/03/11 05:34:02 matt Exp $"); __KERNEL_RCSID(0, "$NetBSD: ts.c,v 1.25 2008/04/05 19:16:49 cegger Exp $");
#undef TSDEBUG #undef TSDEBUG
@ -137,8 +137,6 @@ struct ts_softc {
struct buf ts_cbuf; /* internal cmd buffer (for ioctls) */ struct buf ts_cbuf; /* internal cmd buffer (for ioctls) */
}; };
#define XNAME sc->sc_dev->dv_xname
#define TS_WCSR(csr, val) \ #define TS_WCSR(csr, val) \
bus_space_write_2(sc->sc_iot, sc->sc_ioh, csr, val) bus_space_write_2(sc->sc_iot, sc->sc_ioh, csr, val)
#define TS_RCSR(csr) \ #define TS_RCSR(csr) \
@ -210,7 +208,7 @@ tsmatch(device_t parent, cfdata_t match, void *aux)
sc->sc_mapped = 0; sc->sc_mapped = 0;
sc->sc_dev = &tsdev; sc->sc_dev = &tsdev;
sc->sc_uh = device_private(parent); sc->sc_uh = device_private(parent);
strcpy(XNAME, "ts"); strcpy(sc->sc_dev->dv_xname, "ts");
/* Try to reset the device */ /* Try to reset the device */
for (i = 0; i < 3; i++) { for (i = 0; i < 3; i++) {