power_suppl...by_reference(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ power_supply_get_by_reference(9) ✨

okay bestie so we're in the Kernel API Manual today (yes, the Kernel API Manual, we're fancy) and the page name is literally truncated to power_suppl...by_reference(9) because the kernel is a drama queen who cannot fit her own function names πŸ’… anyway β€” welcome to the group chat, let's learn how to grab a power supply by reference 🫢


🌸 NAME 🌸

power_supply_get_by_reference β€” searches for a power supply and returns its ref, no cap πŸ”₯


πŸŽ€ SYNOPSIS πŸŽ€

struct power_supply * power_supply_get_by_reference (struct
       fwnode_handle *fwnode , const char *property );

like, she takes two things and returns a pointer to a struct power_supply, that's the whole vibe πŸ’–


πŸ¦‹ ARGUMENTS πŸ¦‹

  • fwnode β€” pointer to the fwnode holding the phandle property. iykyk, this is where the magic lives ✨
  • property β€” the name of the property holding a power supply name. yes bestie, a name inside a name, it's giving inception πŸŒ€

πŸ’œ DESCRIPTION πŸ’œ

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 holding onto that thing so it doesn't get yanked away from under you, lowkey iconic protective energy πŸ‘‘

⚠️ bestie listen to me. the user should call power_supply_put after usage. this is not optional, this is a should with main character energy β€” you grabbed a reference, you give it back 😭

⭐ RETURN ⭐

on success, returns a reference to a power supply with matching name equal to the value under property 🌈

otherwise? NULL or ERR_PTR. fr fr, that's it πŸ’€


🧚 SEE ALSO 🧚

that's a whole friend group right there, periodt πŸ‘‘


and that's the page!! she lives in ./drivers/power/supply and dated October 2026, so mark your calendars bestie πŸŽ€πŸ’–βœ¨ bye ugh ily πŸ’œ

πŸ“¦ where this page comes from