devm_power_supply_register(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ devm_power_supply_register(9) ✨

okay so bestie, welcome to the Kernel API Manual πŸ’… this one's called devm_power_supply_register and it's literally about registering a managed power supply. yes, the "devm" is doing a lot of heavy lifting here and we love her for it 🫢


🌸 NAME 🌸

devm_power_supply_register β€” register managed power supply ✨


πŸŽ€ SYNOPSIS πŸŽ€

struct power_supply * devm_power_supply_register (struct device *parent
, const struct power_supply_desc *desc , const struct
power_supply_config *cfg );

πŸ’– ARGUMENTS πŸ’–

  • parent β€” the device that's gonna be the parent of the power supply's device. usually it's the device whose probe function is calling this, iykyk πŸ¦‹
  • desc β€” the description of the power supply. heads up: this has to stay valid through the whole entire lifetime of this power supply. no cap, the whole thing 😭
  • cfg β€” run-time specific configuration, and it's accessed during registering. it may be NULL, so like, no pressure πŸŽ€

🌈 RETURN 🌈

you get back a pointer to a newly allocated power_supply on success πŸ’– or ERR_PTR otherwise πŸ’€

and the best part? the returned power_supply pointer gets automatically unregistered on driver detach ✨ literally the devm of it all, main character energy, obsessed πŸ‘‘


πŸ¦‹ SEE ALSO πŸ¦‹

kernel file ./drivers/power/supply/power_supply_core.c β€” go read it, it's giving source of truth πŸ“–


that's the whole vibe bestie πŸ§šπŸ’œ and before you go: this lil masterpiece lives at ./drivers/power/supply, it's dated October 2026, and it's part of the Kernel API Manual β€” periodt πŸ’…πŸŒΈ

πŸ“¦ where this page comes from