DEVCLASS_GET_SOFTC(9)

✨ DEVCLASS_GET_SOFTC ✨

okay bestie, welcome to section 9 of the kernel dev manual β€” yes it's the Kernel Developer's Manual, and yes we're about to make unit numbers make sense πŸ’…


🌸 NAME 🌸

devclass_get_softc β€” turning a unit number into a driver's private lil structure, no cap


πŸŽ€ SYNOPSIS πŸŽ€

#include <sys/param.h>
#include <sys/bus.h>

void *
devclass_get_softc(devclass_t dc, int unit);

πŸ¦‹ DESCRIPTION πŸ¦‹

So here's the vibe: this function goes and fetches the driver private instance variables for the device that has the unit number you hand it, and then it gives them right back to you. That's it. That's the whole thing. iconic, honestly.

You pass in the devclass (dc) and the unit number (unit), and out comes the softc. iykyk 🫢


πŸ’– RETURN VALUES πŸ’–

  • If the device exists β†’ you get its driver-private variables back. slay.
  • If the device doesn't exist β†’ you get NULL. that's the whole deal. 🫠

πŸ”₯ SEE ALSO πŸ”₯


πŸ‘‘ AUTHORS πŸ‘‘

This manual page was written by Doug Rabson. we love a legend πŸ’œ


and that's a wrap, bestie β€” this page came straight outta the Debian edition of the Kernel Developer's Manual, dated June 16, 1998, filed under DEVCLASS_GET_SOFTC(9). go forth and softc responsibly βœ¨πŸ’–

πŸ“¦ where this page comes from