hwspin_trylock_irqsave(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– hwspin_trylock_irqsave(9) πŸ’–

okay bestie, welcome to the hwspin_trylock_irqsave(9) page from the Kernel API Manual ✨ this one is short, iconic, and very β€œtry it, don’t wait around” energy.


🌸 NAME 🌸

hwspin_trylock_irqsave β€” try to lock an hwspinlock, disable interrupts πŸ’…

πŸ¦‹ SYNOPSIS πŸ¦‹

int hwspin_trylock_irqsave (struct hwspinlock *hwlock , unsigned long
       *flags );

πŸŽ€ ARGUMENTS πŸŽ€

  • hwlock β€” an hwspinlock which we want to trylock πŸ‘€
  • flags β€” a pointer to where the caller's interrupt state will be saved at πŸ’Ύ

πŸ”₯ DESCRIPTION πŸ”₯

This function attempts to lock the underlying hwspinlock, and will immediately fail if the hwspinlock is already locked. No waiting around, no drama, just instant β€œnope” energy 😭

Upon a successful return from this function, preemption and local interrupts are disabled (previous interrupts state is saved at flags), so the caller must not sleep, and is advised to release the hwspinlock as soon as possible. That part is important, bestie β€” do not sleep here, and let that lock go ASAP 🫢

Returns 0 if we successfully locked the hwspinlock, -EBUSY if the hwspinlock was already taken, and -EINVAL if hwlock is invalid. Periodt. πŸ’…

🌈 SEE ALSO 🌈

Kernel file ./include/linux/hwspinlock.h β€” plus the whole hwspinlock friend group:


mwah πŸ’‹ this page lives under ./include/linux, dated October 2026, and it’s all about hwspin_trylock_irqsave(9). slay and stay locked β€” or at least try to ✨

πŸ“¦ where this page comes from