Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev Use do .. while (0) for macros.



details:   https://anonhg.NetBSD.org/src/rev/08c20e80e34c
branches:  trunk
changeset: 825753:08c20e80e34c
user:      isaki <isaki%NetBSD.org@localhost>
date:      Sat Jul 29 06:36:21 2017 +0000

description:
Use do .. while (0) for macros.

diffstat:

 sys/dev/audio.c |  18 +++++++++++-------
 1 files changed, 11 insertions(+), 7 deletions(-)

diffs (39 lines):

diff -r 65fda9352e1f -r 08c20e80e34c sys/dev/audio.c
--- a/sys/dev/audio.c   Sat Jul 29 06:33:45 2017 +0000
+++ b/sys/dev/audio.c   Sat Jul 29 06:36:21 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: audio.c,v 1.380 2017/07/29 06:33:45 isaki Exp $        */
+/*     $NetBSD: audio.c,v 1.381 2017/07/29 06:36:21 isaki Exp $        */
 
 /*-
  * Copyright (c) 2016 Nathanial Sloss <nathanialsloss%yahoo.com.au@localhost>
@@ -148,7 +148,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.380 2017/07/29 06:33:45 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.381 2017/07/29 06:36:21 isaki Exp $");
 
 #ifdef _KERNEL_OPT
 #include "audio.h"
@@ -214,11 +214,15 @@
 int    audio_idle_timeout = 30;
 #endif
 
-#define HW_LOCK(x)     if ((x) == SIMPLEQ_FIRST(&sc->sc_audiochan)->vc) \
-                               mutex_enter(sc->sc_intr_lock);
-
-#define HW_UNLOCK(x)   if ((x) == SIMPLEQ_FIRST(&sc->sc_audiochan)->vc) \
-                               mutex_exit(sc->sc_intr_lock);
+#define HW_LOCK(x)     do { \
+       if ((x) == SIMPLEQ_FIRST(&sc->sc_audiochan)->vc) \
+               mutex_enter(sc->sc_intr_lock); \
+} while (0)
+
+#define HW_UNLOCK(x)   do { \
+       if ((x) == SIMPLEQ_FIRST(&sc->sc_audiochan)->vc) \
+               mutex_exit(sc->sc_intr_lock); \
+} while (0)
 
 int    audio_blk_ms = AUDIO_BLK_MS;
 



Home | Main Index | Thread Index | Old Index