From f59dd3ae6a2cdfc1b0e1f4230df471b19e42bb31 Mon Sep 17 00:00:00 2001 From: Chuck Paterson Date: Fri, 13 Oct 2000 18:59:29 +0000 Subject: [PATCH] Make mutex name reflect device driver name. Destroy mutex when detaching the device. Submitted by: John Baldwin --- sys/dev/fxp/if_fxp.c | 3 ++- sys/pci/if_fxp.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/sys/dev/fxp/if_fxp.c b/sys/dev/fxp/if_fxp.c index 08e7a29d0df3..9a5def58ce3c 100644 --- a/sys/dev/fxp/if_fxp.c +++ b/sys/dev/fxp/if_fxp.c @@ -317,7 +317,7 @@ fxp_attach(device_t dev) u_long val; int rid; - mtx_init(&sc->sc_mtx, "fxp", MTX_DEF); + mtx_init(&sc->sc_mtx, device_get_nameunit(dev), MTX_DEF); callout_handle_init(&sc->stat_ch); FXP_LOCK(sc); @@ -453,6 +453,7 @@ fxp_detach(device_t dev) free(sc->mcsp, M_DEVBUF); FXP_UNLOCK(sc); + mtx_destroy(&sc->sc_mtx); return 0; } diff --git a/sys/pci/if_fxp.c b/sys/pci/if_fxp.c index 08e7a29d0df3..9a5def58ce3c 100644 --- a/sys/pci/if_fxp.c +++ b/sys/pci/if_fxp.c @@ -317,7 +317,7 @@ fxp_attach(device_t dev) u_long val; int rid; - mtx_init(&sc->sc_mtx, "fxp", MTX_DEF); + mtx_init(&sc->sc_mtx, device_get_nameunit(dev), MTX_DEF); callout_handle_init(&sc->stat_ch); FXP_LOCK(sc); @@ -453,6 +453,7 @@ fxp_detach(device_t dev) free(sc->mcsp, M_DEVBUF); FXP_UNLOCK(sc); + mtx_destroy(&sc->sc_mtx); return 0; }