summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Anholt <anholt@freebsd.org>2002-09-29 23:21:55 +0000
committerEric Anholt <anholt@freebsd.org>2002-09-29 23:21:55 +0000
commit506c1c02a43970e8ae891c9015eba7ab581d08f3 (patch)
treea0620d513beaa6cb9bebbe8328e7b85e2bd154b6
parentefda4ce3539c9adf5fc798bb5e0ba5e8ce804afb (diff)
Make our set_bit and friends match linux better (cleans up some warnings)
-rw-r--r--bsd-core/drm_os_freebsd.h24
-rw-r--r--bsd/drm_os_freebsd.h24
2 files changed, 24 insertions, 24 deletions
diff --git a/bsd-core/drm_os_freebsd.h b/bsd-core/drm_os_freebsd.h
index 2fa19cee..1206b25f 100644
--- a/bsd-core/drm_os_freebsd.h
+++ b/bsd-core/drm_os_freebsd.h
@@ -220,43 +220,43 @@ typedef u_int8_t u8;
/* Fake this */
static __inline atomic_t
-test_and_set_bit(int b, atomic_t *p)
+test_and_set_bit(int b, volatile void *p)
{
int s = splhigh();
unsigned int m = 1<<b;
- unsigned int r = *p & m;
- *p |= m;
+ unsigned int r = *(volatile int *)p & m;
+ *(volatile int *)p |= m;
splx(s);
return r;
}
static __inline void
-clear_bit(int b, atomic_t *p)
+clear_bit(int b, volatile void *p)
{
- atomic_clear_int(p + (b >> 5), 1 << (b & 0x1f));
+ atomic_clear_int(((volatile int *)p) + (b >> 5), 1 << (b & 0x1f));
}
static __inline void
-set_bit(int b, atomic_t *p)
+set_bit(int b, volatile void *p)
{
- atomic_set_int(p + (b >> 5), 1 << (b & 0x1f));
+ atomic_set_int(((volatile int *)p) + (b >> 5), 1 << (b & 0x1f));
}
static __inline int
-test_bit(int b, atomic_t *p)
+test_bit(int b, volatile void *p)
{
- return p[b >> 5] & (1 << (b & 0x1f));
+ return ((volatile int *)p)[b >> 5] & (1 << (b & 0x1f));
}
static __inline int
-find_first_zero_bit(atomic_t *p, int max)
+find_first_zero_bit(volatile void *p, int max)
{
int b;
for (b = 0; b < max; b += 32) {
- if (p[b >> 5] != ~0) {
+ if (((volatile int *)p)[b >> 5] != ~0) {
for (;;) {
- if ((p[b >> 5] & (1 << (b & 0x1f))) == 0)
+ if ((((volatile int *)p)[b >> 5] & (1 << (b & 0x1f))) == 0)
return b;
b++;
}
diff --git a/bsd/drm_os_freebsd.h b/bsd/drm_os_freebsd.h
index 2fa19cee..1206b25f 100644
--- a/bsd/drm_os_freebsd.h
+++ b/bsd/drm_os_freebsd.h
@@ -220,43 +220,43 @@ typedef u_int8_t u8;
/* Fake this */
static __inline atomic_t
-test_and_set_bit(int b, atomic_t *p)
+test_and_set_bit(int b, volatile void *p)
{
int s = splhigh();
unsigned int m = 1<<b;
- unsigned int r = *p & m;
- *p |= m;
+ unsigned int r = *(volatile int *)p & m;
+ *(volatile int *)p |= m;
splx(s);
return r;
}
static __inline void
-clear_bit(int b, atomic_t *p)
+clear_bit(int b, volatile void *p)
{
- atomic_clear_int(p + (b >> 5), 1 << (b & 0x1f));
+ atomic_clear_int(((volatile int *)p) + (b >> 5), 1 << (b & 0x1f));
}
static __inline void
-set_bit(int b, atomic_t *p)
+set_bit(int b, volatile void *p)
{
- atomic_set_int(p + (b >> 5), 1 << (b & 0x1f));
+ atomic_set_int(((volatile int *)p) + (b >> 5), 1 << (b & 0x1f));
}
static __inline int
-test_bit(int b, atomic_t *p)
+test_bit(int b, volatile void *p)
{
- return p[b >> 5] & (1 << (b & 0x1f));
+ return ((volatile int *)p)[b >> 5] & (1 << (b & 0x1f));
}
static __inline int
-find_first_zero_bit(atomic_t *p, int max)
+find_first_zero_bit(volatile void *p, int max)
{
int b;
for (b = 0; b < max; b += 32) {
- if (p[b >> 5] != ~0) {
+ if (((volatile int *)p)[b >> 5] != ~0) {
for (;;) {
- if ((p[b >> 5] & (1 << (b & 0x1f))) == 0)
+ if ((((volatile int *)p)[b >> 5] & (1 << (b & 0x1f))) == 0)
return b;
b++;
}