pwm_apply_might_sleep(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ pwm_apply_might_sleep πŸ’…

okay bestie, welcome to the Kernel API Manual page for pwm_apply_might_sleep β€” yes that name is a mouthful, no we're not changing it, it's iconic actually. 🌸

So basically this function atomically applies a new state to a PWM device β€” one clean swap, no weird half-applied in-between mess. πŸ¦‹

⚠️ real talk: this one cannot be used in atomic context. Like, at all. It's a sleep-y girlie and she needs her space. πŸ’€

✨ SYNOPSIS ✨

int pwm_apply_might_sleep (struct pwm_device *pwm , const struct
       pwm_state *state );

that's it. that's the whole vibe check. two args, one int back. πŸŽ€


πŸ’– ARGUMENTS πŸ’–

  • pwm β€” the PWM device itself. the main character. πŸ‘‘
  • state β€” the new state you want to apply to it. the glow-up you're giving it. ✨

🌈 RETURN 🌈

  • 0 on success πŸ₯³
  • or a negative errno 😭 (so like, check your return values, bestie, fr fr)

🧚 CONTEXT 🧚

May sleep. 😴

no cap, if you're in atomic context and you call this, that's not on her β€” she told you she sleeps. πŸ™ˆ

πŸ”₯ SEE ALSO πŸ”₯

Kernel file ./drivers/pwm/core.c β€” that's where all the magic lives, go read it iykyk πŸ“–

and then the whole squad, alphabetically-ish, all present and accounted for:

like, the entire friend group showed up to the function's birthday party πŸ«ΆπŸŽ‚


that's the whole page, bestie β€” go forth and apply your PWM states atomically, and remember: she may sleep πŸ˜΄πŸ’œ

huge thank you to the fine folks over at ./drivers/pwm β€” this one's dated October 2026, straight from the Kernel API Manual. mwah. πŸ’‹βœ¨

πŸ“¦ where this page comes from