aboutsummaryrefslogtreecommitdiffstats
path: root/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/1858-drm-amd-Avoid-using-x86-specific-_BITOPS_LONG_SHIFT.patch
blob: e000ed16dcbf1c296157e62ad8531c705fb5427e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
From e35bd48969f381d1f1de92f402669c5b95698cba Mon Sep 17 00:00:00 2001
From: Felix Kuehling <Felix.Kuehling@amd.com>
Date: Tue, 19 Sep 2017 16:11:30 -0400
Subject: [PATCH 1858/4131] drm/amd: Avoid using x86-specific
 _BITOPS_LONG_SHIFT
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
---
 drivers/gpu/drm/amd/include/linux/chash.h | 22 +++++++++++++++-------
 1 file changed, 15 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/amd/include/linux/chash.h b/drivers/gpu/drm/amd/include/linux/chash.h
index c89b92b..6dc1599 100644
--- a/drivers/gpu/drm/amd/include/linux/chash.h
+++ b/drivers/gpu/drm/amd/include/linux/chash.h
@@ -27,7 +27,15 @@
 #include <linux/types.h>
 #include <linux/hash.h>
 #include <linux/bug.h>
-#include <linux/bitops.h>
+#include <asm/bitsperlong.h>
+
+#if BITS_PER_LONG == 32
+# define _CHASH_LONG_SHIFT 5
+#elif BITS_PER_LONG == 64
+# define _CHASH_LONG_SHIFT 6
+#else
+# error "Unexpected BITS_PER_LONG"
+#endif
 
 struct __chash_table {
 	u8 bits;
@@ -283,31 +291,31 @@ struct chash_iter {
 static inline bool chash_iter_is_valid(const struct chash_iter iter)
 {
 	BUG_ON((unsigned)iter.slot >= (1 << iter.table->bits));
-	return !!(iter.table->valid_bitmap[iter.slot >> _BITOPS_LONG_SHIFT] &
+	return !!(iter.table->valid_bitmap[iter.slot >> _CHASH_LONG_SHIFT] &
 		  iter.mask);
 }
 static inline bool chash_iter_is_empty(const struct chash_iter iter)
 {
 	BUG_ON((unsigned)iter.slot >= (1 << iter.table->bits));
-	return !(iter.table->occup_bitmap[iter.slot >> _BITOPS_LONG_SHIFT] &
+	return !(iter.table->occup_bitmap[iter.slot >> _CHASH_LONG_SHIFT] &
 		 iter.mask);
 }
 
 static inline void chash_iter_set_valid(const struct chash_iter iter)
 {
 	BUG_ON((unsigned)iter.slot >= (1 << iter.table->bits));
-	iter.table->valid_bitmap[iter.slot >> _BITOPS_LONG_SHIFT] |= iter.mask;
-	iter.table->occup_bitmap[iter.slot >> _BITOPS_LONG_SHIFT] |= iter.mask;
+	iter.table->valid_bitmap[iter.slot >> _CHASH_LONG_SHIFT] |= iter.mask;
+	iter.table->occup_bitmap[iter.slot >> _CHASH_LONG_SHIFT] |= iter.mask;
 }
 static inline void chash_iter_set_invalid(const struct chash_iter iter)
 {
 	BUG_ON((unsigned)iter.slot >= (1 << iter.table->bits));
-	iter.table->valid_bitmap[iter.slot >> _BITOPS_LONG_SHIFT] &= ~iter.mask;
+	iter.table->valid_bitmap[iter.slot >> _CHASH_LONG_SHIFT] &= ~iter.mask;
 }
 static inline void chash_iter_set_empty(const struct chash_iter iter)
 {
 	BUG_ON((unsigned)iter.slot >= (1 << iter.table->bits));
-	iter.table->occup_bitmap[iter.slot >> _BITOPS_LONG_SHIFT] &= ~iter.mask;
+	iter.table->occup_bitmap[iter.slot >> _CHASH_LONG_SHIFT] &= ~iter.mask;
 }
 
 static inline u32 chash_iter_key32(const struct chash_iter iter)
-- 
2.7.4