Index: if_fxpvar.h =================================================================== RCS file: /home/ncvs/src/sys/dev/fxp/if_fxpvar.h,v retrieving revision 1.27 diff -u -r1.27 if_fxpvar.h --- if_fxpvar.h 30 Apr 2003 01:54:38 -0000 1.27 +++ if_fxpvar.h 7 Jun 2003 19:20:30 -0000 @@ -111,8 +111,14 @@ #define mtx_destroy(a) struct mtx { int dummy; }; #else -#define FXP_LOCK(_sc) mtx_lock(&(_sc)->sc_mtx) -#define FXP_UNLOCK(_sc) mtx_unlock(&(_sc)->sc_mtx) +#define FXP_LOCK(_sc) do { \ + if (mtx_owned(&(_sc)->sc_mtx)) \ + mtx_lock(&(_sc)->sc_mtx); \ +} while (0) +#define FXP_UNLOCK(_sc) do { \ + if (!mtx_owned(&(_sc)->sc_mtx)); \ + mtx_unlock(&(_sc)->sc_mtx); \ +} while (0) #endif /*