power_supply_register(9)
π 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 beNULL. 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 π
power_supply_get_by_name(9)power_supply_get_system_batteries(9)power_supply_put_system_batteries(9)power_supply_put(9)power_supply_get_by_reference(9)devm_power_supply_get_by_reference(9)power_supply_temp2resist_simple(9)power_supply_vbat2ri(9)power_supply_ocv2cap_simple(9)power_supply_get_property_direct(9)power_supply_set_property_direct(9)devm_power_supply_register(9)power_supply_unregister(9)
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
- 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