kernel/smp: Avoid casting spinlocks, which are structures.

The lock entry is the first thing in the struct, so this is a no-op
change, but it is safer to do in case of changes, of course.

Spinlocks have been structures for quite a long time, so this was
probably just missed in the conversion.
This commit is contained in:
Augustin Cavalier 2021-11-23 13:52:44 -05:00
parent ba3ee26af0
commit 8be37ed439
2 changed files with 3 additions and 3 deletions

View File

@ -182,7 +182,7 @@ CPUSet::IsEmpty() const
static inline bool
try_acquire_spinlock_inline(spinlock* lock)
{
return atomic_get_and_set((int32*)lock, 1) == 0;
return atomic_get_and_set(&lock->lock, 1) == 0;
}
@ -198,7 +198,7 @@ acquire_spinlock_inline(spinlock* lock)
static inline void
release_spinlock_inline(spinlock* lock)
{
atomic_set((int32*)lock, 0);
atomic_set(&lock->lock, 0);
}

View File

@ -330,7 +330,7 @@ try_acquire_spinlock(spinlock* lock)
if (atomic_add(&lock->lock, 1) != 0)
return false;
#else
if (atomic_get_and_set((int32*)lock, 1) != 0)
if (atomic_get_and_set(&lock->lock, 1) != 0)
return false;
# if DEBUG_SPINLOCKS