MFC rev. 1.164:

Consistently use if_printf() only in interface methods: if_start,
  if_ioctl, if_watchdog, etc, or in functions that are used by
  these methods only. In all other cases use device_printf().

  This also fixes several panics, when if_printf() is called before
  softc->ifp was initialized.

PR:		kern/102974
Submitted by:	Alex Lyashkov <umka sevcity.net>
Approved by:	re (hrs)
This commit is contained in:
glebius 2006-10-13 07:39:25 +00:00
parent 5e64b941db
commit f0f7122975

View File

@ -578,7 +578,7 @@ rl_miibus_readreg(device_t dev, int phy, int reg)
rval = CSR_READ_1(sc, RL_MEDIASTAT);
return (rval);
default:
if_printf(sc->rl_ifp, "bad phy register\n");
device_printf(sc->rl_dev, "bad phy register\n");
return (0);
}
rval = CSR_READ_2(sc, rl8139_reg);
@ -628,7 +628,7 @@ rl_miibus_writereg(device_t dev, int phy, int reg, int data)
return (0);
break;
default:
if_printf(sc->rl_ifp, "bad phy register\n");
device_printf(sc->rl_dev, "bad phy register\n");
return (0);
}
CSR_WRITE_2(sc, rl8139_reg, data);
@ -718,7 +718,7 @@ rl_reset(struct rl_softc *sc)
break;
}
if (i == RL_TIMEOUT)
if_printf(sc->rl_ifp, "reset never completed!\n");
device_printf(sc->rl_dev, "reset never completed!\n");
}
/*
@ -793,6 +793,7 @@ rl_attach(device_t dev)
sc = device_get_softc(dev);
unit = device_get_unit(dev);
sc->rl_dev = dev;
mtx_init(&sc->rl_mtx, device_get_nameunit(dev), MTX_NETWORK_LOCK,
MTX_DEF);
@ -974,7 +975,7 @@ rl_attach(device_t dev)
error = bus_setup_intr(dev, sc->rl_irq, INTR_TYPE_NET | INTR_MPSAFE,
rl_intr, sc, &sc->rl_intrhand);
if (error) {
if_printf(ifp, "couldn't set up irq\n");
device_printf(sc->rl_dev, "couldn't set up irq\n");
ether_ifdetach(ifp);
}