Source-Changes-HG archive

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

[src/netbsd-7]: src/sys/external/bsd/drm2/include/linux Pull up following rev...



details:   https://anonhg.NetBSD.org/src/rev/5bd7a98395c3
branches:  netbsd-7
changeset: 799664:5bd7a98395c3
user:      riz <riz%NetBSD.org@localhost>
date:      Fri Nov 06 22:58:20 2015 +0000

description:
Pull up following revision(s) (requested by riastradh in ticket #1001):
        sys/external/bsd/drm2/include/linux/bitops.h: revision 1.10
        sys/external/bsd/drm2/include/linux/bitops.h: revision 1.11
Fix indexing convention of Linux __ffs/__ffs64 shims.
They reject zero input, and yield zero-based indexing, unlike our
ffs/ffs64, which return zero for zero and yield one-based indexing.
May let nouveau make a little more progress toward booting!
Found by mrg@.
Fix comment in previous.

diffstat:

 sys/external/bsd/drm2/include/linux/bitops.h |  14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)

diffs (36 lines):

diff -r 8cad6b519063 -r 5bd7a98395c3 sys/external/bsd/drm2/include/linux/bitops.h
--- a/sys/external/bsd/drm2/include/linux/bitops.h      Fri Nov 06 22:55:10 2015 +0000
+++ b/sys/external/bsd/drm2/include/linux/bitops.h      Fri Nov 06 22:58:20 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bitops.h,v 1.7.2.2 2015/03/06 21:39:10 snj Exp $       */
+/*     $NetBSD: bitops.h,v 1.7.2.3 2015/11/06 22:58:20 riz Exp $       */
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -42,16 +42,24 @@
 
 #include <lib/libkern/libkern.h>
 
+/*
+ * Linux __ffs/__ffs64 is zero-based; zero input is undefined.  Our
+ * ffs/ffs64 is one-based; zero input yields zero.
+ */
 static inline unsigned long
 __ffs(unsigned long x)
 {
-       return ffs64(x);
+
+       KASSERT(x != 0);
+       return ffs64(x) - 1;
 }
 
 static inline unsigned long
 __ffs64(uint64_t x)
 {
-       return ffs64(x);
+
+       KASSERT(x != 0);
+       return ffs64(x) - 1;
 }
 
 static inline unsigned int



Home | Main Index | Thread Index | Old Index