hwspin_trylock_irq(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… 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 πŸ’œ:


✨ 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