class_create(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– class_create(9) πŸ’–

okay so this is a page straight out of the Kernel API Manual and honestly? it's a little baby page but it's got main character energy. the whole thing lives in ./drivers/base and it's all about making one very specific thing: a struct class. let's get into it bestie ✨


🌸 NAME 🌸

class_create β€” create a struct class structure

like. that's it. that's the whole job. she makes a class. iconic behaviour tbh πŸ‘‘


πŸŽ€ SYNOPSIS πŸŽ€

struct class * class_create (const char *name );

one function, one argument, returns a pointer to a struct class. short and sweet, we love a low-effort queen πŸ’…


πŸ¦‹ ARGUMENTS πŸ¦‹

  • name β€” pointer to a string for the name of this class. yeah that's it, just hand her a name and she'll do the rest 🫢

✨ DESCRIPTION ✨

so here's the vibe: this is used to create a struct class pointer that can then be used in calls to device_create. that's the whole pipeline β€” you make the class here, then you go make devices with it. slay πŸ”₯

Returns struct class pointer on success, or ERR_PTR on error. so like, check your return value babes, ERR_PTR is not a real class and she will not act like one 😭

no cap, important note: the pointer created here is to be destroyed when finished by making a call to class_destroy. you do NOT get to just walk away from her. clean up after yourself. she's not a ghost, she's a resource πŸ’€

πŸ‘‘ SEE ALSO πŸ‘‘

Kernel file ./drivers/base/class.c and honestly the whole friend group:

go read all of them, they're all in ./drivers/base/class.c and they're all literally so good together 🌈


and that's the page!! this little gem is from ./drivers/base, dated October 2026, and it'll see you in the Kernel API Manual. mwah, go destroy your classes responsibly πŸ’œπŸ§š

πŸ“¦ where this page comes from