Use ifmedia_fini().

This commit is contained in:
thorpej 2020-02-04 05:15:44 +00:00
parent b26fba762e
commit 8fb0805ccb
2 changed files with 10 additions and 10 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_cpsw.c,v 1.26 2020/01/06 06:50:00 msaitoh Exp $ */
/* $NetBSD: if_cpsw.c,v 1.27 2020/02/04 05:15:44 thorpej Exp $ */
/*
* Copyright (c) 2013 Jonathan A. Kollasch
@ -53,7 +53,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(1, "$NetBSD: if_cpsw.c,v 1.26 2020/01/06 06:50:00 msaitoh Exp $");
__KERNEL_RCSID(1, "$NetBSD: if_cpsw.c,v 1.27 2020/02/04 05:15:44 thorpej Exp $");
#include <sys/param.h>
#include <sys/bus.h>
@ -362,12 +362,12 @@ cpsw_detach(device_t self, int flags)
intr_disestablish(sc->sc_txih);
intr_disestablish(sc->sc_miscih);
/* Delete all media. */
ifmedia_delete_instance(&sc->sc_mii.mii_media, IFM_INST_ANY);
ether_ifdetach(ifp);
if_detach(ifp);
/* Delete all media. */
ifmedia_fini(&sc->sc_mii.mii_media);
/* Free the packet padding buffer */
kmem_free(sc->sc_txpad, ETHER_MIN_LEN);
bus_dmamap_destroy(sc->sc_bdt, sc->sc_txpad_dm);

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_cpsw.c,v 1.11 2020/01/29 06:05:31 thorpej Exp $ */
/* $NetBSD: if_cpsw.c,v 1.12 2020/02/04 05:15:45 thorpej Exp $ */
/*
* Copyright (c) 2013 Jonathan A. Kollasch
@ -53,7 +53,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(1, "$NetBSD: if_cpsw.c,v 1.11 2020/01/29 06:05:31 thorpej Exp $");
__KERNEL_RCSID(1, "$NetBSD: if_cpsw.c,v 1.12 2020/02/04 05:15:45 thorpej Exp $");
#include <sys/param.h>
#include <sys/bus.h>
@ -361,12 +361,12 @@ cpsw_detach(device_t self, int flags)
intr_disestablish(sc->sc_txih);
intr_disestablish(sc->sc_miscih);
/* Delete all media. */
ifmedia_delete_instance(&sc->sc_mii.mii_media, IFM_INST_ANY);
ether_ifdetach(ifp);
if_detach(ifp);
/* Delete all media. */
ifmedia_fini(&sc->sc_mii.mii_media);
/* Free the packet padding buffer */
kmem_free(sc->sc_txpad, ETHER_MIN_LEN);
bus_dmamap_destroy(sc->sc_bdt, sc->sc_txpad_dm);