devm_power_supply_register(9)
β¨ 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 beNULL, 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 π
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)power_supply_register(9)power_supply_unregister(9)
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
- 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