Module Name: src
Committed By: riastradh
Date: Thu Jul 17 14:30:33 UTC 2014
Modified Files:
src/sys/external/bsd/drm2/include/linux: atomic.h bitops.h
Log Message:
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.
To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/external/bsd/drm2/include/linux/atomic.h
cvs rdiff -u -r1.5 -r1.6 src/sys/external/bsd/drm2/include/linux/bitops.h
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/external/bsd/drm2/include/linux/atomic.h
diff -u src/sys/external/bsd/drm2/include/linux/atomic.h:1.6 src/sys/external/bsd/drm2/include/linux/atomic.h:1.7
--- src/sys/external/bsd/drm2/include/linux/atomic.h:1.6 Wed Jul 16 20:59:58 2014
+++ src/sys/external/bsd/drm2/include/linux/atomic.h Thu Jul 17 14:30:33 2014
@@ -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 @@ test_and_set_bit(unsigned int bit, volat
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 @@ test_and_clear_bit(unsigned int bit, vol
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 @@ test_and_change_bit(unsigned int bit, vo
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)
Index: src/sys/external/bsd/drm2/include/linux/bitops.h
diff -u src/sys/external/bsd/drm2/include/linux/bitops.h:1.5 src/sys/external/bsd/drm2/include/linux/bitops.h:1.6
--- src/sys/external/bsd/drm2/include/linux/bitops.h:1.5 Thu Jul 17 14:28:28 2014
+++ src/sys/external/bsd/drm2/include/linux/bitops.h Thu Jul 17 14:30:33 2014
@@ -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 @@ __test_and_set_bit(unsigned int bit, vol
v = *p;
*p |= mask;
- return (v & mask);
+ return ((v & mask) != 0);
}
static inline unsigned long
@@ -121,7 +121,7 @@ __test_and_clear_bit(unsigned int bit, v
v = *p;
*p &= ~mask;
- return (v & mask);
+ return ((v & mask) != 0);
}
static inline unsigned long
@@ -135,7 +135,7 @@ __test_and_change_bit(unsigned int bit,
v = *p;
*p ^= mask;
- return (v & mask);
+ return ((v & mask) != 0);
}
static inline unsigned long