diff options
-rw-r--r-- | drivers/gpu/nvgpu/common/posix/bitmap.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/gpu/nvgpu/common/posix/bitmap.c b/drivers/gpu/nvgpu/common/posix/bitmap.c index b45838df..f25f6e64 100644 --- a/drivers/gpu/nvgpu/common/posix/bitmap.c +++ b/drivers/gpu/nvgpu/common/posix/bitmap.c | |||
@@ -29,14 +29,15 @@ | |||
29 | #define BIT_MASK(nr) (1UL << ((nr) % BITS_PER_LONG)) | 29 | #define BIT_MASK(nr) (1UL << ((nr) % BITS_PER_LONG)) |
30 | #define BIT_WORD(nr) ((nr) / BITS_PER_LONG) | 30 | #define BIT_WORD(nr) ((nr) / BITS_PER_LONG) |
31 | 31 | ||
32 | unsigned long __nvgpu_posix_fls(unsigned long word) | 32 | unsigned long __nvgpu_posix_ffs(unsigned long word) |
33 | { | 33 | { |
34 | return __builtin_clzl(word); | 34 | return (__builtin_ffsl(word) - 1) & |
35 | ((sizeof(unsigned long) * 8UL) - 1UL); | ||
35 | } | 36 | } |
36 | 37 | ||
37 | unsigned long __nvgpu_posix_ffs(unsigned long word) | 38 | unsigned long __nvgpu_posix_fls(unsigned long word) |
38 | { | 39 | { |
39 | return __builtin_ffsl(word); | 40 | return ((sizeof(unsigned long) * 8UL) - 1UL) - __builtin_clzl(word); |
40 | } | 41 | } |
41 | 42 | ||
42 | static unsigned long __find_next_bit(const unsigned long *addr, | 43 | static unsigned long __find_next_bit(const unsigned long *addr, |