rust: Fix build error

When CONFIG_DEBUG_SPINLOCK=y and CONFIG_PREEMPT_RT=y the following build error occurs:

In file included from rust/helpers/helpers.c:22:
rust/helpers/spinlock.c: In function ‘rust_helper___spin_lock_init’:
rust/helpers/spinlock.c:10:30: error: implicit declaration of function ‘spinlock_check’; did you mean ‘spin_lock_bh’? [-Wimplicit-function-declaration]
   10 |         __raw_spin_lock_init(spinlock_check(lock), name, key, LD_WAIT_CONFIG);
      |                              ^~~~~~~~~~~~~~
      |                              spin_lock_bh
rust/helpers/spinlock.c:10:30: error: passing argument 1 of ‘__raw_spin_lock_init’ makes pointer from integer without a cast [-Wint-conversion]
   10 |         __raw_spin_lock_init(spinlock_check(lock), name, key, LD_WAIT_CONFIG);
      |                              ^~~~~~~~~~~~~~~~~~~~
      |                              |
      |                              int
In file included from ./include/linux/wait.h:9,
                 from ./include/linux/wait_bit.h:8,
                 from ./include/linux/fs.h:6,
                 from ./include/linux/highmem.h:5,
                 from ./include/linux/bvec.h:10,
                 from ./include/linux/blk_types.h:10,
                 from ./include/linux/blkdev.h:9,
                 from ./include/linux/blk-mq.h:5,
                 from rust/helpers/blk.c:3,
                 from rust/helpers/helpers.c:10:
./include/linux/spinlock.h:101:52: note: expected ‘raw_spinlock_t *’ {aka ‘struct raw_spinlock *’} but argument is of type ‘int’
  101 |   extern void __raw_spin_lock_init(raw_spinlock_t *lock, const char *name,
      |                                    ~~~~~~~~~~~~~~~~^~~~
make[2]: *** [scripts/Makefile.build:229: rust/helpers/helpers.o] Error 1

Error observed while building a rt-debug kernel for aarch64.

Map the spin_lock functions to the raw variants for PREEMPT_RT=n as previously done in 'include/linux/spinlock.h'.

Signed-off-by: Eder Zulian ezulian@redhat.com

Merge request reports

Loading