hwspin_trylock_irq(9)
π hwspin_trylock_irq β the kernel API manual, bestie edition β¨
okay so real talk, this page is from the kernel API manual and it's all about hwspin_trylock_irq(9) β no cap, that's the whole vibe π
β¨ NAME β¨
hwspin_trylock_irq β bestie's whole job is try to lock an hwspinlock, disable interrupts. that's it. that's the gig π
πΈ SYNOPSIS πΈ
int hwspin_trylock_irq (struct hwspinlock *hwlock );
it's giving "one function, one argument, one int coming back at you" π¦
π ARGUMENTS π
hwlockβ an hwspinlock which we want to trylock. yes girl, *try*lock, the name literally told you π this is the lock you're shooting your shot at.
π DESCRIPTION π
so here's the tea β β this function attempts to lock the underlying hwspinlock, and it will immediately fail if the hwspinlock is already locked. no waiting, no queuing, no "give me a sec", it's a hard no and it moves on. periodt.
upon a successful return from this function, preemption and local interrupts are disabled, so the caller must not sleep π΄π« β like genuinely do not, that's not a suggestion β and you're advised to release the hwspinlock as soon as possible. in and out, quick little visit, main character energy but make it brief β‘
returns 0 if we successfully locked the hwspinlock, -EBUSY if the hwspinlock was already taken (somebody else got there first π), and -EINVAL if hwlock is invalid. three outcomes, all iconic, all documented π
π¦ SEE ALSO π¦
kernel file ./include/linux/hwspinlock.h β go read it, iykyk π
the whole friend group π:
hwspin_trylock_irqsave(9)hwspin_trylock_raw(9)hwspin_trylock_in_atomic(9)hwspin_trylock(9)hwspin_lock_timeout_irqsave(9)hwspin_lock_timeout_irq(9)hwspin_lock_timeout_raw(9)hwspin_lock_timeout_in_atomic(9)hwspin_lock_timeout(9)hwspin_unlock_irqrestore(9)hwspin_unlock_irq(9)hwspin_unlock_raw(9)hwspin_unlock_in_atomic(9)hwspin_unlock(9)
β¨ and that's a wrap, bestie β¨ this little gem lives in ./include/linux, stamped October 2026, and it answers to the name hwspin_trylock_irq(9) π«Ά go forth and trylock responsibly π
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms