Subject: Allow nesting classes Driver core: allow classes have children. Signed-off-by: Dmitry Torokhov --- drivers/base/class.c | 5 ++++- include/linux/device.h | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) Index: work/drivers/base/class.c =================================================================== --- work.orig/drivers/base/class.c +++ work/drivers/base/class.c @@ -146,7 +146,10 @@ int class_register(struct class * cls) if (error) return error; - subsys_set_kset(cls, class_subsys); + if (cls->parent) + subsys_set_kset(cls, cls->parent->subsys); + else + subsys_set_kset(cls, class_subsys); error = subsystem_register(&cls->subsys); if (!error) { Index: work/include/linux/device.h =================================================================== --- work.orig/include/linux/device.h +++ work/include/linux/device.h @@ -157,6 +157,7 @@ struct class { struct module * owner; struct subsystem subsys; + struct class * parent; struct list_head children; struct list_head interfaces; struct semaphore sem; /* locks both the children and interfaces lists */