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 Fix indexing convention ...
details: https://anonhg.NetBSD.org/src/rev/dcef5cb5866b
branches: trunk
changeset: 340952:dcef5cb5866b
user: riastradh <riastradh%NetBSD.org@localhost>
date: Tue Oct 13 00:42:20 2015 +0000
description:
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@.
diffstat:
sys/external/bsd/drm2/include/linux/bitops.h | 14 +++++++++++---
1 files changed, 11 insertions(+), 3 deletions(-)
diffs (36 lines):
diff -r 287811f7e9af -r dcef5cb5866b sys/external/bsd/drm2/include/linux/bitops.h
--- a/sys/external/bsd/drm2/include/linux/bitops.h Tue Oct 13 00:29:34 2015 +0000
+++ b/sys/external/bsd/drm2/include/linux/bitops.h Tue Oct 13 00:42:20 2015 +0000
@@ -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
Home |
Main Index |
Thread Index |
Old Index