aboutsummaryrefslogtreecommitdiff
path: root/sys/ofed
diff options
context:
space:
mode:
authorJeff Roberson <jeff@FreeBSD.org>2013-08-09 03:24:12 +0000
committerJeff Roberson <jeff@FreeBSD.org>2013-08-09 03:24:12 +0000
commitba397d0f16f558022785ed069e0b0612ca67c8df (patch)
tree8c0402203faea7390bedfcb6e949919d15ba95f0 /sys/ofed
parent69b1f509a4338e8db65554cc83a66b2eb6bc7ea6 (diff)
Notes
Diffstat (limited to 'sys/ofed')
-rw-r--r--sys/ofed/include/linux/bitops.h13
1 files changed, 9 insertions, 4 deletions
diff --git a/sys/ofed/include/linux/bitops.h b/sys/ofed/include/linux/bitops.h
index 4305a3a76363..658c32e46743 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;