Source-Changes-HG archive

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

[src/trunk]: src/sys/external/bsd/drm2/include/linux Correct return values of...



details:   https://anonhg.NetBSD.org/src/rev/5a9837557066
branches:  trunk
changeset: 330670:5a9837557066
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Thu Jul 17 14:30:33 2014 +0000

description:
Correct return values of Linux test-and-set operations (PR 48999).

Linux's Documentation/atomic_ops.txt says in no uncertain terms these
must return 0 or 1, not zero or nonzero.  I don't think this has
caused an issue for drm (yet), but better to have it right.

diffstat:

 sys/external/bsd/drm2/include/linux/atomic.h |  8 ++++----
 sys/external/bsd/drm2/include/linux/bitops.h |  8 ++++----
 2 files changed, 8 insertions(+), 8 deletions(-)

diffs (72 lines):

diff -r bd9b177e8d37 -r 5a9837557066 sys/external/bsd/drm2/include/linux/atomic.h
--- a/sys/external/bsd/drm2/include/linux/atomic.h      Thu Jul 17 14:28:28 2014 +0000
+++ b/sys/external/bsd/drm2/include/linux/atomic.h      Thu Jul 17 14:30:33 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: atomic.h,v 1.6 2014/07/16 20:59:58 riastradh Exp $     */
+/*     $NetBSD: atomic.h,v 1.7 2014/07/17 14:30:33 riastradh Exp $     */
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -226,7 +226,7 @@
 
        do v = *p; while (atomic_cas_ulong(p, v, (v | mask)) != v);
 
-       return (v & mask);
+       return ((v & mask) != 0);
 }
 
 static inline unsigned long
@@ -239,7 +239,7 @@
 
        do v = *p; while (atomic_cas_ulong(p, v, (v & ~mask)) != v);
 
-       return (v & mask);
+       return ((v & mask) != 0);
 }
 
 static inline unsigned long
@@ -252,7 +252,7 @@
 
        do v = *p; while (atomic_cas_ulong(p, v, (v ^ mask)) != v);
 
-       return (v & mask);
+       return ((v & mask) != 0);
 }
 
 #if defined(MULTIPROCESSOR) && !defined(__HAVE_ATOMIC_AS_MEMBAR)
diff -r bd9b177e8d37 -r 5a9837557066 sys/external/bsd/drm2/include/linux/bitops.h
--- a/sys/external/bsd/drm2/include/linux/bitops.h      Thu Jul 17 14:28:28 2014 +0000
+++ b/sys/external/bsd/drm2/include/linux/bitops.h      Thu Jul 17 14:30:33 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bitops.h,v 1.5 2014/07/17 14:28:28 riastradh Exp $     */
+/*     $NetBSD: bitops.h,v 1.6 2014/07/17 14:30:33 riastradh Exp $     */
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -107,7 +107,7 @@
        v = *p;
        *p |= mask;
 
-       return (v & mask);
+       return ((v & mask) != 0);
 }
 
 static inline unsigned long
@@ -121,7 +121,7 @@
        v = *p;
        *p &= ~mask;
 
-       return (v & mask);
+       return ((v & mask) != 0);
 }
 
 static inline unsigned long
@@ -135,7 +135,7 @@
        v = *p;
        *p ^= mask;
 
-       return (v & mask);
+       return ((v & mask) != 0);
 }
 
 static inline unsigned long



Home | Main Index | Thread Index | Old Index