hwspin_lock_timeout_raw(9)
π hwspin_lock_timeout_raw(9) π
okay so this page is from the Kernel API Manual and it's all about hwspin_lock_timeout_raw β like, the whole page, bestie. buckle up π
β¨ NAME β¨
hwspin_lock_timeout_raw β lock an hwspinlock, but with a timeout limit so you're not stuck waiting forever π
πΈ SYNOPSIS πΈ
int hwspin_lock_timeout_raw (struct hwspinlock *hwlock , unsigned int to );
that's the whole vibe. takes a lock pointer and a timeout number, gives you back an int. π«Ά
π¦ ARGUMENTS π¦
hwlockβ the hwspinlock that's about to get locked. this is the main character of the operation ngl πtoβ the timeout value, measured in msecs. that's your patience budget, bestie β³
π DESCRIPTION π
so what this function does is lock the underlying hwlock. simple enough.
but here's the tea: if the hwlock is already taken, this function will busy loop, just sitting there waiting for it to be released β like refreshing the group chat β but it gives up once timeout msecs have elapsed. no cap, it literally spins and then bails β¨
β οΈ Caution: the user must protect the routine of getting the hardware lock with amutexorspinlockto avoid dead-lock. doing that is what lets the user do some time-consuming or sleepable operations under the hardware lock. don't skip this part, i'm begging π
Returns 0 when the hwlock was successfully taken, and an appropriate error code otherwise β most notably an -ETIMEDOUT if the hwlock is still busy after timeout msecs. and the function will never sleep. not even a little nap. zero sleep. periodt π
π SEE ALSO π
Kernel file ./include/linux/hwspinlock.h β and honestly the whole hwspinlock friend group shows up here, iykyk:
hwspin_trylock_irqsave(9)hwspin_trylock_irq(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_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 the page!! π it lives in ./include/linux, dated October 2026 β so like, future iconic. go lock your hardware, bestie, 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