mirror of
https://git.rtems.org/rtems-libbsd/
synced 2025-07-27 20:55:28 +08:00
Fix warnings in <sys/refcount.h>
This commit is contained in:
parent
025d8f20f5
commit
7c801d1b01
@ -51,7 +51,11 @@ static __inline void
|
|||||||
refcount_acquire(volatile u_int *count)
|
refcount_acquire(volatile u_int *count)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
#ifndef __rtems__
|
||||||
atomic_add_acq_int(count, 1);
|
atomic_add_acq_int(count, 1);
|
||||||
|
#else /* __rtems__ */
|
||||||
|
atomic_add_acq_int((volatile int *) count, 1);
|
||||||
|
#endif /* __rtems__ */
|
||||||
}
|
}
|
||||||
|
|
||||||
static __inline int
|
static __inline int
|
||||||
@ -60,7 +64,11 @@ refcount_release(volatile u_int *count)
|
|||||||
u_int old;
|
u_int old;
|
||||||
|
|
||||||
/* XXX: Should this have a rel membar? */
|
/* XXX: Should this have a rel membar? */
|
||||||
|
#ifndef __rtems__
|
||||||
old = atomic_fetchadd_int(count, -1);
|
old = atomic_fetchadd_int(count, -1);
|
||||||
|
#else /* __rtems__ */
|
||||||
|
old = atomic_fetchadd_int((volatile int *) count, -1);
|
||||||
|
#endif /* __rtems__ */
|
||||||
KASSERT(old > 0, ("negative refcount %p", count));
|
KASSERT(old > 0, ("negative refcount %p", count));
|
||||||
return (old == 1);
|
return (old == 1);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user