devm_regulator_register(9)
π devm_regulator_register(9) β the Kernel API Manual, bestie edition π
Okay so real talk: this is the devm_regulator_register(9) page from the Kernel API Manual, and it is genuinely such a useful little icon. If you're writing a regulator driver and you want the kernel to clean up after you like the absolute bestie it is, this is your moment. Periodt.
β¨ NAME β¨
devm_regulator_register β the resource-managed version of regulator_register(), aka the one that handles the cleanup so you don't have to π
π¦ SYNOPSIS π¦
struct regulator_dev * devm_regulator_register (struct device *dev ,
const struct regulator_desc *regulator_desc , const struct
regulator_config *config );
Like, yes, it's a whole function signature, but don't let it intimidate you β it's literally three arguments and a dream. π«Ά
π ARGUMENTS π
devβ the device to supply. This is the main character device that everything gets tied to. πregulator_descβ the regulator to register. Yep, that's the one you're bringing into existence. β¨configβ the runtime configuration for the regulator. All the vibes and settings it needs to function. π§
πΈ DESCRIPTION πΈ
So what does this actually do? It's called by regulator drivers to register a regulator. That's it. That's the job. π
It returns a valid pointer to struct regulator_dev on success β slay β or an ERR_PTR on error. Not me being dramatic about error handling, but like, check that pointer, bestie. π
And here's the iconic part: the regulator will automatically be released when the device is unbound. That's the resource-managed magic. The kernel is literally your cleanup crew, no cap. π₯
Lowkey the whole point of devm_ functions: you register it, the kernel unregisters it when the device goes away. You don't have to manually call the undo. It's giving responsible adult energy without the effort. π
π SEE ALSO π
Kernel file ./drivers/regulator/devres.c β go read the source, iykyk. Also, the whole friend group:
devm_regulator_get(9)devm_regulator_get_exclusive(9)devm_regulator_get_enable_optional(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_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)
And that's the whole page, bestie. No skips, no missing options, every reference present and accounted for. π«Ά
Cute little sign-off: this gem lives in ./drivers/regulator, it's dated October 2026, and its whole name is devm_regulator_register(9). Obsessed. πβ¨π
π¦ 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