power_suppl...em_batteries(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

🌸 power_suppl...em_batteries(9) 🌸

okay bestie so you're in the Kernel API Manual and the function we're talking about is literally power_supply_put_system_batteries β€” say it with me, it's a mouthful, i know 😭 this is the cleanup half of the system-battery saga, the "ok we're done here, go home" twin πŸŽ€


✨ NAME ✨

power_supply_put_system_batteries β€” the cleanup baddie that frees all the resources allocated by power_supply_get_system_batteries(). it's giving responsible queen energy πŸ’… you grabbed the references, now you put them back, periodt.


πŸ¦‹ SYNOPSIS πŸ¦‹

void power_supply_put_system_batteries (struct power_supply **psys , int count );
returning void β€” no cap, this one tells you nothing. it just does the thing and dips πŸ™ˆ

πŸ’– ARGUMENTS πŸ’–

  • psys β€” array of power supply references to release and free. yes bestie, both 😌 you hand it the array, it releases the refs and frees them. don't come back looking for them.
  • count β€” number of elements in the array. literally just how many things are in psys, so it knows when to stop swiping 🫢

🌈 SEE ALSO 🌈

  • Kernel file: ./drivers/power/supply/power_supply_core.c β€” the source, the origin story, the mothership πŸ‘‘

and the whole friend group, fr fr:


lowkey the most important link in that chain is power_supply_get_system_batteries(9) β€” that's the one that made the mess this function cleans up. they're a package deal, iykyk πŸ’€

and that's the whole page, bestie πŸ’œ no leaks, no dangling refs, we stan a clean teardown ⭐

sign-off szn: this little gem lives over in ./drivers/power/supply and it's dated October 2026 β€” iconic, timeless, slay πŸŽ€βœ¨

πŸ“¦ where this page comes from