devm_regulat...ble_optional(9)
β¨ 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:
devm_regulator_get(9)devm_regulator_get_exclusive(9)devm_regulator_get_enable(9)devm_regulator_get_optional(9)devm_regulator_get_enable_read_voltage(9)devm_regulator_put(9)devm_regulator_bulk_get(9)devm_regulator_bulk_get_exclusive(9)devm_regulator_bulk_get_const(9)devm_regulator_bulk_put(9)devm_regulator_bulk_get_enable(9)devm_regulator_register(9)devm_regulator_register_supply_alias(9)devm_regulator_bulk_register_supply_alias(9)devm_regulator_register_notifier(9)devm_regulator_unregister_notifier(9)devm_regulator_irq_helper(9)devm_of_regulator_get(9)devm_of_regulator_get_optional(9)
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
- 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