devm_regulator_register(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– 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:


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