From ba397d0f16f558022785ed069e0b0612ca67c8df Mon Sep 17 00:00:00 2001 From: Jeff Roberson Date: Fri, 9 Aug 2013 03:24:12 +0000 Subject: [PATCH] - Use the correct type in the linux bitops emulation. Submitted by: Maxim Ignatenko --- sys/ofed/include/linux/bitops.h | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/sys/ofed/include/linux/bitops.h b/sys/ofed/include/linux/bitops.h index 4305a3a7636..658c32e4674 100644 --- a/sys/ofed/include/linux/bitops.h +++ b/sys/ofed/include/linux/bitops.h @@ -272,22 +272,25 @@ bitmap_empty(unsigned long *addr, int size) return (1); } -#define NBINT (NBBY * sizeof(int)) +#define NBLONG (NBBY * sizeof(long)) #define set_bit(i, a) \ - atomic_set_int(&((volatile int *)(a))[(i)/NBINT], 1 << (i) % NBINT) + atomic_set_long(&((volatile long *)(a))[(i)/NBLONG], 1 << (i) % NBLONG) #define clear_bit(i, a) \ - atomic_clear_int(&((volatile int *)(a))[(i)/NBINT], 1 << (i) % NBINT) + atomic_clear_long(&((volatile long *)(a))[(i)/NBLONG], 1 << (i) % NBLONG) #define test_bit(i, a) \ - !!(atomic_load_acq_int(&((volatile int *)(a))[(i)/NBINT]) & 1 << ((i) % NBINT)) + !!(atomic_load_acq_long(&((volatile long *)(a))[(i)/NBLONG]) & \ + 1 << ((i) % NBLONG)) static inline long test_and_clear_bit(long bit, long *var) { long val; + var += bit / (sizeof(long) * NBBY); + bit %= sizeof(long) * NBBY; bit = 1 << bit; do { val = *(volatile long *)var; @@ -301,6 +304,8 @@ test_and_set_bit(long bit, long *var) { long val; + var += bit / (sizeof(long) * NBBY); + bit %= sizeof(long) * NBBY; bit = 1 << bit; do { val = *(volatile long *)var;