Module Name: src
Committed By: riastradh
Date: Tue Oct 13 00:42:20 UTC 2015
Modified Files:
src/sys/external/bsd/drm2/include/linux: bitops.h
Log Message:
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@.
To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 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/bitops.h
diff -u src/sys/external/bsd/drm2/include/linux/bitops.h:1.9 src/sys/external/bsd/drm2/include/linux/bitops.h:1.10
--- src/sys/external/bsd/drm2/include/linux/bitops.h:1.9 Wed Feb 25 15:40:20 2015
+++ src/sys/external/bsd/drm2/include/linux/bitops.h Tue Oct 13 00:42:20 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: bitops.h,v 1.9 2015/02/25 15:40:20 riastradh Exp $ */
+/* $NetBSD: bitops.h,v 1.10 2015/10/13 00:42:20 riastradh 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/ffs 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