]> xenbits.xensource.com Git - xen.git/commitdiff
xen/common: Constify the parameter of _spin_is_locked()
authorJulien Grall <jgrall@amazon.com>
Fri, 27 Jan 2023 19:05:16 +0000 (19:05 +0000)
committerJulien Grall <julien@xen.org>
Thu, 16 Feb 2023 21:56:09 +0000 (21:56 +0000)
The lock is not meant to be modified by _spin_is_locked(). So constify
it.

This is helpful to be able to assert the locked is taken when the
underlying structure is const.

Signed-off-by: Julien Grall <jgrall@amazon.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Henry Wang <Henry.Wang@arm.com>
Tested-by: Henry Wang <Henry.Wang@arm.com> #Arm
xen/common/spinlock.c
xen/include/xen/spinlock.h

index 84996c3fbc1f03798bdd7f5957d5db00c9ddcffe..a15f0a2eb66790b2ac872b3a0a5461612685cde3 100644 (file)
@@ -368,7 +368,7 @@ void _spin_unlock_irqrestore(spinlock_t *lock, unsigned long flags)
     local_irq_restore(flags);
 }
 
-int _spin_is_locked(spinlock_t *lock)
+int _spin_is_locked(const spinlock_t *lock)
 {
     /*
      * Recursive locks may be locked by another CPU, yet we return
index 2fa6ba36548efd423850ea8935b9f0fa7fdf588f..ca40c71c88f9c4cd6aeaa28712afafee1e15ea37 100644 (file)
@@ -185,7 +185,7 @@ void _spin_unlock(spinlock_t *lock);
 void _spin_unlock_irq(spinlock_t *lock);
 void _spin_unlock_irqrestore(spinlock_t *lock, unsigned long flags);
 
-int _spin_is_locked(spinlock_t *lock);
+int _spin_is_locked(const spinlock_t *lock);
 int _spin_trylock(spinlock_t *lock);
 void _spin_barrier(spinlock_t *lock);