subsys_dev_iter_next(9)
β¨ subsys_dev_iter_next(9) β¨
okay bestie, so this is a page straight out of the Kernel API Manual β like, the actual kernel docs, and we are literally reading them together rn. this one's about subsys_dev_iter_next, and it's giving "small function, big responsibilities" energy π
πΈ NAME πΈ
subsys_dev_iter_next β iterate to the next device
like... you take your iterator, you scoot it forward one device, that's the whole vibe β¨
π¦ SYNOPSIS π¦
struct device * subsys_dev_iter_next (struct subsys_dev_iter *iter );
π ARGUMENTS π
iterβ the subsys iterator you're proceeding. yes, that iterator. the one you already set up. we're just moving it along, bestie π«Ά
π DESCRIPTION π
So what does it do?? It proceeds iter to the next device and returns it. that's it, that's the function. main character behaviour honestly π
And if iteration is complete? It returns NULL. no device, no vibes, we're done here π«Ά
Now here's the part where you gotta pay attention, because it's lowkey important π
The returned device is referenced and won't be released till the iterator is proceeded to the next device or exited. so like... it's held for you. it's safe. it's not going anywhere while you're holding onto it. periodt β¨
And because of that, the caller is free to do whatever it wants to do with the device β including calling back into subsys code. literally whatever. no cap. you're covered ππ
π SEE ALSO π
okay so here's the whole friend group, the entire squad, the guest list π
β and heads up, this comes from the kernel file ./drivers/base/bus.c, which is where a bunch of these live:
bus_to_subsys(9)bus_for_each_dev(9)bus_find_device(9)bus_for_each_drv(9)bus_add_device(9)bus_probe_device(9)bus_remove_device(9)bus_add_driver(9)bus_remove_driver(9)bus_rescan_devices(9)device_reprobe(9)bus_register(9)bus_unregister(9)subsys_dev_iter_init(9)subsys_dev_iter_exit(9)subsys_system_register(9)subsys_virtual_register(9)driver_find(9)bus_get_dev_root(9)
iykyk β go read all of them, they're iconic π₯
and that's the page!! π this one's living in ./drivers/base and it's dated October 2026, so like... future-coded but also literally the kernel, slay π hope you understood it bestie, love u, go iterate responsibly π¦πΈ
π¦ 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