ktypes vs. devices classes (struct class)

Greg KH greg at kroah.com
Sat Sep 30 02:30:31 EDT 2023

On Sat, Sep 30, 2023 at 02:12:41AM +0200, Richard wrote:
> Hi all,
> Why do we have ktypes (struct kobj_type) AND device classes (struct class)?

Because they are two totally different things.

> Don't they serve the same purpose (more or less) and it would be simpler,
> clearer and more KISS to only have one? Is this a historically grown thing
> or by design?

Look closer.  Tell me what "struct class" is for vs. what "struct
kobj_type" is for and see if they both could be used for the same thing?

When we implemented them, we didn't think so but maybe something has
changed to now allow this?  If so, great, please send us patches to do


greg k-h

More information about the Kernelnewbies mailing list