dpm_for_each_dev(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… dpm_for_each_dev(9) πŸ’…

okay so bestie, welcome to the Kernel API Manual ✨ this one's a lil cutie from the device power management corner of the kernel, and honestly? it's giving "simple but iconic." let's get into it 🫢


✨ NAME ✨

dpm_for_each_dev β€” the device iterator. that's it, that's the vibe πŸ¦‹ it walks the list and hits you with a callback for every single device.


🌸 SYNOPSIS 🌸

void dpm_for_each_dev (void *data , void (*fn)(struct device *, void *)
);

no cap, that's the whole signature. two args, zero drama πŸ‘‘


πŸŽ€ ARGUMENTS πŸŽ€

  • data β€” literally just the data you wanna hand off to the callback. it gets passed straight through, no questions asked πŸ’–
  • fn β€” the function that gets called for each device. your main character callback, fr fr 🌟

πŸ¦‹ DESCRIPTION πŸ¦‹

so here's the tea β˜• β€” dpm_for_each_dev iterates over the devices in dpm_list, and for each and every device it calls fn, passing along data. that's the entire plot. no plot twists, no hidden lore, just a clean lil loop through the list πŸ’…βœ¨

like, it's a for-each. it does the for-each thing. and it ate. periodt πŸ“


πŸ’œ SEE ALSO πŸ’œ

bestie there are SO many siblings in this family, buckle up 🌈 first the kernel file: ./drivers/base/power/main.c

go read them all, iykyk πŸ“šπŸ’–


lowkey a reminder: this page only tells you what the function does β€” iterate dpm_list, call fn per device with data. don't go reading extra behaviour into it, bestie πŸ™ˆ

and that's a wrap, gorgeous 🌸 this gem comes from ./drivers/base/power, dated October 2026 β€” go off, you absolute icon πŸ‘‘πŸ’…β­

πŸ“¦ where this page comes from