Skip to contentSkip to conversation

Creating sysfs class for all my misc devices

DISCUSSION Jerry Stralko 1 participant 1 message Jun 22, 2014

lore
Share & tools
lore
#0 lore raw

I'm running into a road block trying to create a sysfs class for all my misc devices I've created. I currently have a few (3-5) misc devices that I want to group together in a class.

I've registered my misc devices, but I'm unsure how to associate them with my new class I created. I want all my misc devices to be associated with /sys/class/logger class.

I've created the class via:

        logger_class = class_create(THIS_MODULE, "logger");
        ret = PTR_ERR(logger_class);
        if (IS_ERR(logger_class))
                goto out;

But after the call to misc_register i'm not sure how to proceed. Is
this even possible or I'm I totally off on this. Or can a device only be registered to at most one class and since its a misc device its already associated with the misc class?

I've searched the linux source tree and haven't found anything.

Any help or pointers on this would be greatly appreciated.

Thanks,