Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/arm/pic arm/pic: Use a local variable to reduce #if...



details:   https://anonhg.NetBSD.org/src/rev/454b9d49257b
branches:  trunk
changeset: 372183:454b9d49257b
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sat Oct 29 15:13:27 2022 +0000

description:
arm/pic: Use a local variable to reduce #ifdef scope.

Avoids straddling a conditional this way.

diffstat:

 sys/arch/arm/pic/pic.c |  14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)

diffs (43 lines):

diff -r d80cdac69630 -r 454b9d49257b sys/arch/arm/pic/pic.c
--- a/sys/arch/arm/pic/pic.c    Sat Oct 29 14:01:36 2022 +0000
+++ b/sys/arch/arm/pic/pic.c    Sat Oct 29 15:13:27 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pic.c,v 1.83 2022/07/28 10:26:26 riastradh Exp $       */
+/*     $NetBSD: pic.c,v 1.84 2022/10/29 15:13:27 riastradh Exp $       */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
 #include "opt_multiprocessor.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pic.c,v 1.83 2022/07/28 10:26:26 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pic.c,v 1.84 2022/10/29 15:13:27 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/atomic.h>
@@ -345,7 +345,11 @@
 
        ocpl = curcpu()->ci_cpl;
 #ifdef MULTIPROCESSOR
-       if (!is->is_mpsafe) {
+       const bool mpsafe = is->is_mpsafe;
+#else
+       const bool mpsafe = true;
+#endif
+       if (!mpsafe) {
                KERNEL_LOCK(1, NULL);
                const u_int ci_blcnt __diagused = curcpu()->ci_biglock_count;
                const u_int l_blcnt __diagused = curlwp->l_blcnt;
@@ -353,9 +357,9 @@
                KASSERT(ci_blcnt == curcpu()->ci_biglock_count);
                KASSERT(l_blcnt == curlwp->l_blcnt);
                KERNEL_UNLOCK_ONE(NULL);
-       } else
-#endif
+       } else {
                (void)(*func)(arg);
+       }
        ncpl = curcpu()->ci_cpl;
        KASSERTMSG(ocpl <= ncpl, "pic %s irq %u intrsource %s:"
            " cpl slipped %d -> %d",



Home | Main Index | Thread Index | Old Index