power_supply_register(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– power_supply_register(9) β€” Kernel API Manual πŸ’–

okay bestie, gather round, because this is the kernel manual page for power_supply_register, and it's genuinely iconic. like, it literally registers a brand new power supply. that's the whole vibe. πŸ”‹βœ¨


✨ NAME ✨

power_supply_register β€” Register new power supply πŸ‘‘

like yes, that's it, that's the function. it puts a new power supply on the map. no cap.


🌸 SYNOPSIS 🌸

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

literally copy that exactly, don't @ me. πŸ’…


πŸŽ€ ARGUMENTS πŸŽ€

  • parent β€” the device that's gonna be the parent of the power supply's device. usually it's the device whose probe function calls this. so like, the parent device is giving main character energy and adopting a whole new power supply 🫢
  • desc β€” the description of the power supply. heads up: this has to stay valid through the whole lifetime of this power supply. the entire lifetime. no take-backs, no going out of scope, none of that 😭
  • cfg β€” run-time specific configuration that gets accessed during registering. and listen β€” this one may be NULL. it's optional, it's chill, it's lowkey flexible 🌈

⭐ RETURN ⭐

on success you get a pointer to a newly allocated power_supply. slay. πŸ’–

otherwise you get ERR_PTR. sad but true, it happens. πŸ’€

and when you're done with that returned power_supply pointer, use power_supply_unregister to release the resources β€” don't just ghost it, bestie, clean up after yourself. 🧹✨


πŸ¦‹ SEE ALSO πŸ¦‹

the kernel file this lives in, fr fr:

./drivers/power/supply/power_supply_core.c

and the whole friend group πŸ‘‡


okay that's the whole page, you ate that πŸ’… go register something iconic.

sign-off time: this little masterpiece lives in ./drivers/power/supply, dated October 2026, and it's brought to you by power_supply_register(9) β€” periodt. πŸŽ€πŸ”₯πŸ‘‘

πŸ“¦ where this page comes from