class_dev_iter_next(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ class_dev_iter_next(9) ✨

okay so bestie, welcome to the Kernel API Manual πŸ’– this one's a lil function that walks your device iterator forward one step at a time. it's giving "next, please!" energy and honestly? iconic.


🌸 NAME 🌸

class_dev_iter_next β€” iterate to the next device πŸ¦‹


✨ SYNOPSIS ✨

struct device * class_dev_iter_next (struct class_dev_iter *iter );

that's it. that's the whole vibe. no cap πŸ’…


πŸŽ€ ARGUMENTS πŸŽ€

  • iter β€” the class iterator you wanna proceed forward, bestie. like, scoot it along to the next one 🫢

πŸ’œ DESCRIPTION πŸ’œ

So what does it do? It proceeds iter to the next device and returns it. Simple, cute, slay. πŸ”₯

If iteration is complete, it returns NULL. That's your "we're done here, nothing left to see" moment 😭 β€” not an error, just the end of the line, fr fr.

Now here's the part you actually need to remember, and I'm saying it with my whole chest: the returned device is referenced and it won't be released until the iterator is proceeded to the next device or exited. So it's holding onto that device for you the whole time πŸ‘‘. The caller is free to do literally whatever it wants with the device β€” including calling back into class code. yes, even that. go off πŸ’…βœ¨

🧚 no notes, just don't forget that the reference hangs around until the iterator moves on or gets exited. that's the whole plot twist.

🌈 SEE ALSO 🌈

Kernel file ./drivers/base/class.c β€” and the whole friend group:


and that's the page, bestie πŸŽ€ this lil gem lives in ./drivers/base and the version notes are dated October 2026, all filed under the name class_dev_iter_next(9). mwah πŸ’‹ go iterate something cute ✨🌸

πŸ“¦ where this page comes from