Convert lmc(4) to mutexes, removing ({ }) gcc extension along the way.
This commit is contained in:
parent
e31e503a44
commit
9b5de72b31
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: if_lmc.c,v 1.42 2008/06/12 22:44:47 cegger Exp $ */
|
||||
/* $NetBSD: if_lmc.c,v 1.43 2008/06/27 00:53:41 gmcgarry Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2002-2006 David Boggs. <boggs@boggs.palo-alto.ca.us>
|
||||
|
@ -142,7 +142,7 @@
|
|||
|
||||
#if defined(__NetBSD__)
|
||||
# include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_lmc.c,v 1.42 2008/06/12 22:44:47 cegger Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_lmc.c,v 1.43 2008/06/27 00:53:41 gmcgarry Exp $");
|
||||
# include <sys/param.h> /* OS version */
|
||||
/* -DLKM is passed on the compiler command line */
|
||||
# include "opt_inet.h" /* INET6, INET */
|
||||
|
@ -7167,7 +7167,7 @@ nbsd_attach(struct device *parent, struct device *self, void *aux)
|
|||
}
|
||||
|
||||
/* Initialize the top-half and bottom-half locks. */
|
||||
__cpu_simple_lock_init(&sc->top_lock);
|
||||
mutex_init(&sc->top_lock, MUTEX_DEFAULT, IPL_VM);
|
||||
__cpu_simple_lock_init(&sc->bottom_lock);
|
||||
|
||||
/* Initialize the driver. */
|
||||
|
@ -7191,6 +7191,9 @@ nbsd_detach(struct device *self, int flags)
|
|||
if (sc->csr_handle)
|
||||
bus_space_unmap(sc->csr_tag, sc->csr_handle, TLP_CSR_SIZE);
|
||||
|
||||
/* Destroy locks. */
|
||||
mutex_destroy(&sc->top_lock);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*-
|
||||
* $NetBSD: if_lmc.h,v 1.12 2008/06/12 22:44:47 cegger Exp $
|
||||
* $NetBSD: if_lmc.h,v 1.13 2008/06/27 00:53:41 gmcgarry Exp $
|
||||
*
|
||||
* Copyright (c) 2002-2006 David Boggs. (boggs@boggs.palo-alto.ca.us)
|
||||
* All rights reserved.
|
||||
|
@ -1055,10 +1055,9 @@ typedef int intr_return_t;
|
|||
# define WRITE_CSR(sc, csr, val) bus_space_write_4((sc)->csr_tag, (sc)->csr_handle, csr, val)
|
||||
# define NAME_UNIT device_xname(&sc->dev)
|
||||
# define BOOT_VERBOSE (boothowto & AB_VERBOSE)
|
||||
# define TOP_LOCK(sc) ({ while (__cpu_simple_lock_try(&(sc)->top_lock)==0) \
|
||||
tsleep((sc), PCATCH|PZERO, DEVICE_NAME, 1); 0; })
|
||||
# define TOP_TRYLOCK(sc) __cpu_simple_lock_try(&(sc)->top_lock)
|
||||
# define TOP_UNLOCK(sc) __cpu_simple_unlock (&(sc)->top_lock)
|
||||
# define TOP_LOCK(sc) (mutex_spin_enter(&(sc)->top_lock), 0)
|
||||
# define TOP_TRYLOCK(sc) mutex_tryenter(&(sc)->top_lock)
|
||||
# define TOP_UNLOCK(sc) mutex_spin_exit(&(sc)->top_lock)
|
||||
# define BOTTOM_TRYLOCK(sc) __cpu_simple_lock_try(&(sc)->bottom_lock)
|
||||
# define BOTTOM_UNLOCK(sc) __cpu_simple_unlock (&(sc)->bottom_lock)
|
||||
# define CHECK_CAP kauth_authorize_generic(curlwp->l_cred, KAUTH_GENERIC_ISSUSER, NULL)
|
||||
|
@ -1290,7 +1289,11 @@ struct softc
|
|||
void *irq_cookie;
|
||||
void *sdh_cookie;
|
||||
struct mbuf *tx_mbuf; /* hang mbuf here while building dma descs */
|
||||
#if defined(__NetBSD__)
|
||||
kmutex_t top_lock; /* lock card->watchdog vs ioctls */
|
||||
#else
|
||||
__cpu_simple_lock_t top_lock; /* lock card->watchdog vs ioctls */
|
||||
#endif
|
||||
__cpu_simple_lock_t bottom_lock; /* lock buf queues & descriptor rings */
|
||||
#endif /* __NetBSD__ || __OpenBSD__ */
|
||||
|
||||
|
|
Loading…
Reference in New Issue