aboutsummaryrefslogtreecommitdiffstats
path: root/c00.patch
diff options
Diffstat (limited to 'c00.patch')
-rw-r--r--c00.patch61
1 files changed, 61 insertions, 0 deletions
diff --git a/c00.patch b/c00.patch
new file mode 100644
index 00000000000000..116d73d3265cf1
--- /dev/null
+++ b/c00.patch
@@ -0,0 +1,61 @@
+---
+ drivers/base/class.c | 15 +++++++++++++++
+ include/linux/device.h | 2 ++
+ 2 files changed, 17 insertions(+)
+
+--- a/drivers/base/class.c
++++ b/drivers/base/class.c
+@@ -163,6 +163,18 @@ static void klist_class_dev_put(struct k
+ put_device(dev);
+ }
+
++static int class_add_groups(struct class *cls,
++ const struct attribute_group **groups)
++{
++ return sysfs_create_groups(&cls->p->subsys.kobj, groups);
++}
++
++static void class_remove_groups(struct class *cls,
++ const struct attribute_group **groups)
++{
++ return sysfs_remove_groups(&cls->p->subsys.kobj, groups);
++}
++
+ int __class_register(struct class *cls, struct lock_class_key *key)
+ {
+ struct subsys_private *cp;
+@@ -203,6 +215,8 @@ int __class_register(struct class *cls,
+ kfree(cp);
+ return error;
+ }
++ error = class_add_groups(class_get(cls), cls->class_groups);
++ class_put(cls);
+ error = add_class_attrs(class_get(cls));
+ class_put(cls);
+ return error;
+@@ -213,6 +227,7 @@ void class_unregister(struct class *cls)
+ {
+ pr_debug("device class '%s': unregistering\n", cls->name);
+ remove_class_attrs(cls);
++ class_remove_groups(cls, cls->class_groups);
+ kset_unregister(&cls->p->subsys);
+ }
+
+--- a/include/linux/device.h
++++ b/include/linux/device.h
+@@ -360,6 +360,7 @@ int subsys_virtual_register(struct bus_t
+ * @name: Name of the class.
+ * @owner: The module owner.
+ * @class_attrs: Default attributes of this class.
++ * @class_groups: Default attributes of this class.
+ * @dev_groups: Default attributes of the devices that belong to the class.
+ * @dev_kobj: The kobject that represents this class and links it into the hierarchy.
+ * @dev_uevent: Called when a device is added, removed from this class, or a
+@@ -388,6 +389,7 @@ struct class {
+ struct module *owner;
+
+ struct class_attribute *class_attrs;
++ const struct attribute_group **class_groups;
+ const struct attribute_group **dev_groups;
+ struct kobject *dev_kobj;
+