summaryrefslogtreecommitdiffstats
path: root/sys/dev/ed
diff options
context:
space:
mode:
authorbrooks <brooks@FreeBSD.org>2003-10-31 18:32:15 +0000
committerbrooks <brooks@FreeBSD.org>2003-10-31 18:32:15 +0000
commitf1e94c6f29b079e4ad9d9305ef3e90a719bcbbda (patch)
tree4d9e6671d486576767506230a4240131526fea49 /sys/dev/ed
parentbe546fdee455a96afdefee10d0bdba8547399f5b (diff)
downloadFreeBSD-src-f1e94c6f29b079e4ad9d9305ef3e90a719bcbbda.zip
FreeBSD-src-f1e94c6f29b079e4ad9d9305ef3e90a719bcbbda.tar.gz
Replace the if_name and if_unit members of struct ifnet with new members
if_xname, if_dname, and if_dunit. if_xname is the name of the interface and if_dname/unit are the driver name and instance. This change paves the way for interface renaming and enhanced pseudo device creation and configuration symantics. Approved By: re (in principle) Reviewed By: njl, imp Tested On: i386, amd64, sparc64 Obtained From: NetBSD (if_xname)
Diffstat (limited to 'sys/dev/ed')
-rw-r--r--sys/dev/ed/if_ed.c26
-rw-r--r--sys/dev/ed/if_ed_cbus.c2
-rw-r--r--sys/dev/ed/if_ed_isa.c3
-rw-r--r--sys/dev/ed/if_ed_pccard.c3
-rw-r--r--sys/dev/ed/if_ed_pci.c2
-rw-r--r--sys/dev/ed/if_edvar.h2
6 files changed, 17 insertions, 21 deletions
diff --git a/sys/dev/ed/if_ed.c b/sys/dev/ed/if_ed.c
index 0c6a0f6..1ec954f 100644
--- a/sys/dev/ed/if_ed.c
+++ b/sys/dev/ed/if_ed.c
@@ -1700,11 +1700,10 @@ ed_release_resources(dev)
* Install interface into kernel networking data structures
*/
int
-ed_attach(sc, unit, flags)
- struct ed_softc *sc;
- int unit;
- int flags;
+ed_attach(dev)
+ device_t dev;
{
+ struct ed_softc *sc = device_get_softc(dev);
struct ifnet *ifp = &sc->arpcom.ac_if;
callout_handle_init(&sc->tick_ch);
@@ -1717,8 +1716,7 @@ ed_attach(sc, unit, flags)
* Initialize ifnet structure
*/
ifp->if_softc = sc;
- ifp->if_unit = unit;
- ifp->if_name = "ed";
+ if_initname(ifp, device_get_name(dev), device_get_unit(dev));
ifp->if_output = ether_output;
ifp->if_start = ed_start;
ifp->if_ioctl = ed_ioctl;
@@ -1745,7 +1743,7 @@ ed_attach(sc, unit, flags)
* tranceiver for AUI operation), based on compile-time
* config option.
*/
- if (flags & ED_FLAGS_DISABLE_TRANCEIVER)
+ if (device_get_flags(dev) & ED_FLAGS_DISABLE_TRANCEIVER)
ifp->if_flags = (IFF_BROADCAST | IFF_SIMPLEX |
IFF_MULTICAST | IFF_ALTPHYS);
else
@@ -1846,7 +1844,7 @@ ed_watchdog(ifp)
if (sc->gone)
return;
- log(LOG_ERR, "ed%d: device timeout\n", ifp->if_unit);
+ log(LOG_ERR, "%s: device timeout\n", ifp->if_xname);
ifp->if_oerrors++;
ed_reset(ifp);
@@ -2349,8 +2347,8 @@ ed_rint(sc)
* Really BAD. The ring pointers are corrupted.
*/
log(LOG_ERR,
- "ed%d: NIC memory corrupt - invalid packet length %d\n",
- ifp->if_unit, len);
+ "%s: NIC memory corrupt - invalid packet length %d\n",
+ ifp->if_xname, len);
ifp->if_ierrors++;
ed_reset(ifp);
return;
@@ -2554,8 +2552,8 @@ edintr(arg)
ifp->if_ierrors++;
#ifdef DIAGNOSTIC
log(LOG_WARNING,
- "ed%d: warning - receiver ring buffer overrun\n",
- ifp->if_unit);
+ "%s: warning - receiver ring buffer overrun\n",
+ ifp->if_xname);
#endif
/*
@@ -3057,8 +3055,8 @@ ed_pio_write_mbufs(sc, m, dst)
while (((ed_nic_inb(sc, ED_P0_ISR) & ED_ISR_RDC) != ED_ISR_RDC) && --maxwait);
if (!maxwait) {
- log(LOG_WARNING, "ed%d: remote transmit DMA failed to complete\n",
- ifp->if_unit);
+ log(LOG_WARNING, "%s: remote transmit DMA failed to complete\n",
+ ifp->if_xname);
ed_reset(ifp);
return(0);
}
diff --git a/sys/dev/ed/if_ed_cbus.c b/sys/dev/ed/if_ed_cbus.c
index d6c37f2..40f114b 100644
--- a/sys/dev/ed/if_ed_cbus.c
+++ b/sys/dev/ed/if_ed_cbus.c
@@ -277,7 +277,7 @@ ed_isa_attach(dev)
return (error);
}
- return ed_attach(sc, device_get_unit(dev), flags);
+ return ed_attach(dev);
}
#ifdef PC98
diff --git a/sys/dev/ed/if_ed_isa.c b/sys/dev/ed/if_ed_isa.c
index bc5e397..69da715 100644
--- a/sys/dev/ed/if_ed_isa.c
+++ b/sys/dev/ed/if_ed_isa.c
@@ -125,7 +125,6 @@ ed_isa_attach(dev)
device_t dev;
{
struct ed_softc *sc = device_get_softc(dev);
- int flags = device_get_flags(dev);
int error;
if (sc->port_used > 0)
@@ -142,7 +141,7 @@ ed_isa_attach(dev)
return (error);
}
- return ed_attach(sc, device_get_unit(dev), flags);
+ return ed_attach(dev);
}
static device_method_t ed_isa_methods[] = {
diff --git a/sys/dev/ed/if_ed_pccard.c b/sys/dev/ed/if_ed_pccard.c
index 1930b1f..8b9f52d 100644
--- a/sys/dev/ed/if_ed_pccard.c
+++ b/sys/dev/ed/if_ed_pccard.c
@@ -246,7 +246,6 @@ static int
ed_pccard_attach(device_t dev)
{
int error;
- int flags = device_get_flags(dev);
int i;
struct ed_softc *sc = device_get_softc(dev);
u_char sum;
@@ -274,7 +273,7 @@ ed_pccard_attach(device_t dev)
bcopy(ether_addr, sc->arpcom.ac_enaddr, ETHER_ADDR_LEN);
}
- error = ed_attach(sc, device_get_unit(dev), flags);
+ error = ed_attach(dev);
#ifndef ED_NO_MIIBUS
if (error == 0 && sc->vendor == ED_VENDOR_LINKSYS) {
/* Probe for an MII bus, but ignore errors. */
diff --git a/sys/dev/ed/if_ed_pci.c b/sys/dev/ed/if_ed_pci.c
index 87ac950..3d775be 100644
--- a/sys/dev/ed/if_ed_pci.c
+++ b/sys/dev/ed/if_ed_pci.c
@@ -101,7 +101,7 @@ ed_pci_attach(device_t dev)
return (error);
}
- error = ed_attach(sc, device_get_unit(dev), flags);
+ error = ed_attach(dev);
return (error);
}
diff --git a/sys/dev/ed/if_edvar.h b/sys/dev/ed/if_edvar.h
index 3b71c8c..d1f903d 100644
--- a/sys/dev/ed/if_edvar.h
+++ b/sys/dev/ed/if_edvar.h
@@ -204,7 +204,7 @@ int ed_probe_Novell (device_t, int, int);
int ed_probe_Novell_generic (device_t, int);
int ed_probe_HP_pclanp (device_t, int, int);
-int ed_attach (struct ed_softc *, int, int);
+int ed_attach (device_t);
void ed_stop (struct ed_softc *);
void ed_pio_readmem (struct ed_softc *, int, unsigned char *,
unsigned short);
OpenPOWER on IntegriCloud