Add detach support.
This commit is contained in:
parent
9cb8699ba1
commit
a909d816d2
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: mb86960.c,v 1.35 1999/09/13 10:31:35 itojun Exp $ */
|
||||
/* $NetBSD: mb86960.c,v 1.36 2000/02/02 09:34:52 enami Exp $ */
|
||||
|
||||
/*
|
||||
* All Rights Reserved, Copyright (C) Fujitsu Limited 1995
|
||||
|
@ -1106,7 +1106,8 @@ mb86960_intr(arg)
|
|||
struct ifnet *ifp = &sc->sc_ec.ec_if;
|
||||
u_char tstat, rstat;
|
||||
|
||||
if (sc->sc_enabled == 0)
|
||||
if (sc->sc_enabled == 0 ||
|
||||
(sc->sc_dev.dv_flags & DVF_ACTIVE) == 0)
|
||||
return (0);
|
||||
|
||||
#if FE_DEBUG >= 4
|
||||
|
@ -1812,6 +1813,11 @@ mb86960_disable(sc)
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* mbe_activate:
|
||||
*
|
||||
* Handle device activation/deactivation requests.
|
||||
*/
|
||||
int
|
||||
mb86960_activate(self, act)
|
||||
struct device *self;
|
||||
|
@ -1827,19 +1833,37 @@ mb86960_activate(self, act)
|
|||
break;
|
||||
|
||||
case DVACT_DEACTIVATE:
|
||||
#ifdef notyet
|
||||
/* First, kill off the interface. */
|
||||
if_detach(sc->sc_ec.ec_if);
|
||||
#endif
|
||||
|
||||
/* Now disable the interface. */
|
||||
mb86960_disable(sc);
|
||||
if_deactivate(&sc->sc_ec.ec_if);
|
||||
break;
|
||||
}
|
||||
splx(s);
|
||||
return (rv);
|
||||
}
|
||||
|
||||
/*
|
||||
* mb86960_detach:
|
||||
*
|
||||
* Detach a MB86960 interface.
|
||||
*/
|
||||
int
|
||||
mb86960_detach(sc)
|
||||
struct mb86960_softc *sc;
|
||||
{
|
||||
struct ifnet *ifp = &sc->sc_ec.ec_if;
|
||||
|
||||
/* Delete all media. */
|
||||
ifmedia_delete_instance(&sc->sc_media, IFM_INST_ANY);
|
||||
|
||||
#if NBPFILTER > 0
|
||||
bpfdetach(ifp);
|
||||
#endif
|
||||
ether_ifdetach(ifp);
|
||||
if_detach(ifp);
|
||||
|
||||
mb86960_disable(sc);
|
||||
return (0);
|
||||
}
|
||||
|
||||
#if FE_DEBUG >= 1
|
||||
void
|
||||
mb86960_dump(level, sc)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: mb86960var.h,v 1.24 1999/03/25 23:19:16 thorpej Exp $ */
|
||||
/* $NetBSD: mb86960var.h,v 1.25 2000/02/02 09:34:52 enami Exp $ */
|
||||
|
||||
/*
|
||||
* All Rights Reserved, Copyright (C) Fujitsu Limited 1995
|
||||
|
@ -203,3 +203,4 @@ int mb86960_intr __P((void *));
|
|||
int mb86960_enable __P((struct mb86960_softc *));
|
||||
void mb86960_disable __P((struct mb86960_softc *));
|
||||
int mb86960_activate __P((struct device *, enum devact));
|
||||
int mb86960_detach __P((struct mb86960_softc *));
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: if_mbe_pcmcia.c,v 1.11 1999/11/29 02:28:19 jun Exp $ */
|
||||
/* $NetBSD: if_mbe_pcmcia.c,v 1.12 2000/02/02 09:34:51 enami Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||
|
@ -249,6 +249,11 @@ mbe_pcmcia_detach(self, flags)
|
|||
int flags;
|
||||
{
|
||||
struct mbe_pcmcia_softc *psc = (struct mbe_pcmcia_softc *)self;
|
||||
int error;
|
||||
|
||||
error = mb86960_detach(&psc->sc_mb86960);
|
||||
if (error != 0)
|
||||
return (error);
|
||||
|
||||
/* Unmap our i/o window. */
|
||||
pcmcia_io_unmap(psc->sc_pf, psc->sc_io_window);
|
||||
|
@ -256,16 +261,7 @@ mbe_pcmcia_detach(self, flags)
|
|||
/* Free our i/o space. */
|
||||
pcmcia_io_free(psc->sc_pf, &psc->sc_pcioh);
|
||||
|
||||
#ifdef notyet
|
||||
/*
|
||||
* Our softc is about to go away, so drop our reference
|
||||
* to the ifnet.
|
||||
*/
|
||||
if_delref(psc->sc_mb86960.sc_ec.ec_if);
|
||||
return (0);
|
||||
#else
|
||||
return (EBUSY);
|
||||
#endif
|
||||
}
|
||||
|
||||
int
|
||||
|
|
Loading…
Reference in New Issue