summaryrefslogtreecommitdiffstats
path: root/sys/ofed
diff options
context:
space:
mode:
authorjeff <jeff@FreeBSD.org>2013-08-09 03:24:12 +0000
committerjeff <jeff@FreeBSD.org>2013-08-09 03:24:12 +0000
commitfd428c40becfb29227d4db32094c1c1c4f1bbf27 (patch)
tree8c0402203faea7390bedfcb6e949919d15ba95f0 /sys/ofed
parent33ac73409e6f46730963bb9e967295872c50c5ff (diff)
downloadFreeBSD-src-fd428c40becfb29227d4db32094c1c1c4f1bbf27.zip
FreeBSD-src-fd428c40becfb29227d4db32094c1c1c4f1bbf27.tar.gz
- Use the correct type in the linux bitops emulation.
Submitted by: Maxim Ignatenko <gelraen.ua@gmail.com>
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 4305a3a..658c32e 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;
OpenPOWER on IntegriCloud