From: Bartosz Golaszewski <bartosz.golaszewski@xxxxxxxxxx> Export the address of the /sys/class kobject to users that need to chain off of it by means other than calling register_class(). This will be used by the GPIO subsystem to provide a backward compatibility mount-point for the GPIO sysfs class once it's disabled. Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@xxxxxxxxxx> --- drivers/base/class.c | 6 ++++++ include/linux/device/class.h | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/drivers/base/class.c b/drivers/base/class.c index cb5359235c70..68474aff53df 100644 --- a/drivers/base/class.c +++ b/drivers/base/class.c @@ -23,6 +23,9 @@ /* /sys/class */ static struct kset *class_kset; +struct kobject *class_kobj; +EXPORT_SYMBOL_GPL(class_kobj); + #define to_class_attr(_attr) container_of(_attr, struct class_attribute, attr) /** @@ -668,5 +671,8 @@ int __init classes_init(void) class_kset = kset_create_and_add("class", NULL, NULL); if (!class_kset) return -ENOMEM; + + class_kobj = &class_kset->kobj; + return 0; } diff --git a/include/linux/device/class.h b/include/linux/device/class.h index 518c9c83d64b..898f7948293d 100644 --- a/include/linux/device/class.h +++ b/include/linux/device/class.h @@ -69,6 +69,12 @@ struct class { const struct dev_pm_ops *pm; }; +/* + * Global /sys/class kobject for creating sub-groups by means other than + * class_register(). + */ +extern struct kobject *class_kobj; + struct class_dev_iter { struct klist_iter ki; const struct device_type *type; -- 2.43.0