sata_link_debounce(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

okay bestie, so there's this little function called sata_link_debounce and honestly? it's giving "quietly keeping your SATA link from having a whole meltdown." let's get into it 🫢


✨ NAME ✨

sata_link_debounce β€” debounce SATA phy status. that's it, that's the vibe πŸ’…


πŸ¦‹ SYNOPSIS πŸ¦‹

int sata_link_debounce (struct ata_link *link , const unsigned int
*params , unsigned long deadline );

πŸŽ€ ARGUMENTS πŸŽ€

  • link β€” the ATA link you're debouncing the SATA phy status for. main character of this whole operation tbh.
  • params β€” the timing parameters, and they come in a little trio: { interval, duration, timeout }, all in msec. like the holy trinity but make it milliseconds ⭐
  • deadline β€” the deadline in jiffies for the operation. yes, jiffies. no, i will not explain that here, go read another manpage πŸ’€

🌸 DESCRIPTION 🌸

so like, the whole goal here is to make sure the SStatus of link actually reaches a stable state. and how do we know it's stable? by holding the same value where DET is not 1 for duration, polling every interval, all before timeout hits. that's the vibe check ✨

and here's the tea on timeout: it constrains the beginning of the stable state. not the whole thing, just the start. periodt.

now, real talk β€” because DET gets stuck at 1 on some controllers after hot unplugging (iconic bug behavior, honestly πŸ’€), this function just waits until timeout, then returns 0 if DET is stable at 1. so like, it's not a failure, it's just... the controller being dramatic and the function going "okay bestie, we move."

also, timeout is further limited by deadline. whichever one is sooner? that's the one we use. the earlier one wins, no cap πŸ†

LOCKING: Kernel thread context (may sleep). so like, it CAN sleep β€” don't you dare call it from somewhere that can't πŸ›‘πŸ˜€

πŸ”₯ RETURN πŸ”₯

  • 0 on success β€” slay πŸ’–
  • -errno on failure β€” not slay 😭

πŸ‘‘ SEE ALSO πŸ‘‘

Kernel file ./drivers/ata/libata-sata.c β€” plus this whole friend group right here:


and that's a wrap, bestie 🧚 this whole page lives in ./drivers/ata, dated October 2026, and it landed here courtesy of the Kernel API Manual. go debounce something. responsibly. πŸ’œ

πŸ“¦ where this page comes from