devm_regulat...ble_optional(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ devm_regulator_get_enable_optional β€” the Kernel API Manual glow-up ✨

Okay bestie, so this is a page from the Kernel API Manual and honestly? It's short but it's mighty. It's all about grabbing a regulator and turning it on, and then letting the kernel handle the cleanup for you. Devres girlies stay winning πŸ’…


🌸 NAME 🌸

devm_regulator_get_enable_optional β€” resource managed regulator get and enable. Yeah, that's a whole mouthful, but the vibe is "get it, turn it on, forget about it, the kernel cleans up." 🫢

✨ SYNOPSIS ✨

int devm_regulator_get_enable_optional (struct device *dev , const char *id );

πŸŽ€ ARGUMENTS πŸŽ€

  • dev β€” the device to supply. Like, this is the device that's gonna receive the regulator, it's the main character of this call πŸ‘‘
  • id β€” the supply name or regulator ID. Whichever one you need to identify the thing you're grabbing πŸ¦‹

πŸ’– DESCRIPTION πŸ’–

So here's the tea: this gets and enables a regulator for the entire duration of the device's life-time. Periodt. ✨

The way that regulator_disable and regulator_put are automatically called on driver detach is literally the best part β€” you don't have to do the cleanup yourself, the kernel's got you, no cap πŸ™ˆπŸ’…

If you want the full lore, go check out regulator_get_optional and regulator_enable for more information. Go get educated, bestie πŸ“šπŸ’œ

πŸ’€ SEE ALSO πŸ’€

Kernel file ./drivers/regulator/devres.c and honestly the whole friend group:


okay that's the whole page, you ate that πŸ’…βœ¨

Sign-off vibes: this little baddie lives in ./drivers/regulator and it's dated October 2026. Catch you in the devres files, bestie πŸŽ€πŸ¦‹πŸ’–

πŸ“¦ where this page comes from