The lock is not meant to be modified by _rw_is{,_write}_locked(). So
constify it.
This is helpful to be able to assert if the lock is taken when the
underlying structure is const.
Requested-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: Julien Grall <jgrall@amazon.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
local_irq_restore(flags);
}
-static inline int _rw_is_locked(rwlock_t *lock)
+static inline int _rw_is_locked(const rwlock_t *lock)
{
return atomic_read(&lock->cnts);
}
local_irq_restore(flags);
}
-static inline int _rw_is_write_locked(rwlock_t *lock)
+static inline int _rw_is_write_locked(const rwlock_t *lock)
{
return (atomic_read(&lock->cnts) & _QW_WMASK) == _QW_LOCKED;
}