Date: Fri, 9 Aug 2013 03:24:12 +0000 (UTC) From: Jeff Roberson <jeff@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254120 - head/sys/ofed/include/linux Message-ID: <201308090324.r793OC4C005685@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jeff Date: Fri Aug 9 03:24:12 2013 New Revision: 254120 URL: http://svnweb.freebsd.org/changeset/base/254120 Log: - Use the correct type in the linux bitops emulation. Submitted by: Maxim Ignatenko <gelraen.ua@gmail.com> Modified: head/sys/ofed/include/linux/bitops.h Modified: head/sys/ofed/include/linux/bitops.h ============================================================================== --- head/sys/ofed/include/linux/bitops.h Fri Aug 9 01:27:05 2013 (r254119) +++ head/sys/ofed/include/linux/bitops.h Fri Aug 9 03:24:12 2013 (r254120) @@ -272,22 +272,25 @@ bitmap_empty(unsigned long *addr, int si 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;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201308090324.r793OC4C005685>