hwspin_unlock_irqrestore(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… hwspin_unlock_irqrestore β€” Kernel API Manual, bestie edition ✨

okay so you're looking at hwspin_unlock_irqrestore(9) from the Kernel API Manual and honestly? she's the cleanup queen πŸ‘‘ β€” the one you call when you've already grabbed your lock and you need to put everything back exactly how you found it. no cap.


🌸 NAME 🌸

hwspin_unlock_irqrestore β€” unlock hwspinlock, restore irq state πŸ’–


✨ SYNOPSIS ✨

void hwspin_unlock_irqrestore (struct hwspinlock *hwlock , unsigned long
*flags );

like, that's the whole signature. two args. she's lowkey elegant πŸŽ€


πŸ¦‹ ARGUMENTS πŸ¦‹

  • hwlock β€” a previously-acquired hwspinlock which we want to unlock πŸ”“ this is the one you already grabbed, bestie, we're letting her go
  • flags β€” previous caller's interrupt state to restore 🫢 the interrupt state from whoever called us, handed back so we can put it right back where it belongs

πŸ’œ DESCRIPTION πŸ’œ

so what does she actually do? three things, and she does them all in one go, main character energy fr fr:

This function will unlock a specific hwspinlock, enable preemption and restore the previous state of the local interrupts. πŸŽ€ It should be used to undo, e.g., hwspin_trylock_irqsave.

think of it as the undo button for hwspin_trylock_irqsave β€” you locked, you saved the irq state, and now you're reversing out of it. it's giving symmetry. it's giving closure. it's giving responsible kernel developer πŸ’…

⚠️ okay real talk though β€” hwlock must be already locked before calling this function: it is a bug to call unlock on a hwlock that is already unlocked. not a vibe. not a slay. that's a bug, periodt. πŸ’€ if you're out here unlocking something that was never locked, the kernel is gonna have opinions and none of them are cute.

🌈 SEE ALSO 🌈

Kernel file ./include/linux/hwspinlock.h πŸ“ β€” and the whole friend group, because she does not exist in a vacuum, iykyk:


🌸 cute sign-off time 🌸 β€” this lil page lives under ./include/linux, dated October 2026, and it's literally called hwspin_unlock_irqrestore(9). go lock responsibly, bestie. mwah πŸ«ΆπŸ’–βœ¨

πŸ“¦ where this page comes from