power_supply_get_by_name(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ power_supply_get_by_name β€” Kernel API Manual ✨

okay so bestie, welcome to the kernel API manual entry for power_supply_get_by_name(9) and honestly? it's giving "tiny function, big responsibility" πŸ’… like it's literally one call but the refcounting lore goes DEEP. buckle up πŸŽ€


🌸 NAME 🌸

power_supply_get_by_name β€” search for a power supply and returns its ref 🫢

like yes, that's the whole vibe. you give it a name, it goes looking, and if it finds your girl it hands you back a reference. iconic behavior honestly ✨


πŸ¦‹ SYNOPSIS πŸ¦‹

struct power_supply * power_supply_get_by_name (const char *name );

that's it. that's the whole signature. no cap, that's the entire synopsis 😌


πŸ’– ARGUMENTS πŸ’–

  • name β€” the power supply name to fetch 🎯 literally just the name of the power supply you're trying to find, nothing more, nothing mysterious. you say the name, it goes and gets her. iykyk πŸ’«

🧚 DESCRIPTION 🧚

okay so here's the tea β˜• β€” if the power supply was found, this function increases the reference count for the internal power supply's device πŸ‘‘ like it's picking her up and putting her in your arms, but with bookkeeping involved.

and because nothing in kernel land is free (😭), the user should call power_supply_put after usage. periodt. like fr fr, don't just walk away holding the reference forever, that's not the move πŸ™ˆ

bestie pls don't forget the power_supply_put β€” the ref count went up, so it's gotta come back down. it's giving "borrow my hoodie and actually return it" energy πŸ’€

⭐ RETURN ⭐

  • On success: returns a reference to a power supply with matching name equals to name πŸŽ€ slay, you found her
  • Otherwise: NULL πŸ˜” the search came up empty, she's not here

πŸ”₯ SEE ALSO πŸ”₯

the whole friend group 🫢 go say hi:


and that's the page!! πŸ’œ this lil icon lives over in ./drivers/power/supply and the manual itself is dated October 2026 πŸ—“οΈβœ¨ so yeah, freshly stamped, main character energy, go forth and reference-count responsibly bestie πŸŽ€πŸ¦‹πŸ’–

πŸ“¦ where this page comes from