diff --git a/[refs] b/[refs] index d28709a9b68d..d7702d4f9090 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 11f24fbdf511cf588c3a18e3208ee02d85db0020 +refs/heads/master: fd1109711d7f76126e7cef947999f139b198dc15 diff --git a/trunk/drivers/base/attribute_container.c b/trunk/drivers/base/attribute_container.c index 7370d7cf5988..5bf25c6f966c 100644 --- a/trunk/drivers/base/attribute_container.c +++ b/trunk/drivers/base/attribute_container.c @@ -320,9 +320,14 @@ attribute_container_add_attrs(struct class_device *classdev) struct class_device_attribute **attrs = cont->attrs; int i, error; - if (!attrs) + BUG_ON(attrs && cont->grp); + + if (!attrs && !cont->grp) return 0; + if (cont->grp) + return sysfs_create_group(&classdev->kobj, cont->grp); + for (i = 0; attrs[i]; i++) { error = class_device_create_file(classdev, attrs[i]); if (error) @@ -378,9 +383,14 @@ attribute_container_remove_attrs(struct class_device *classdev) struct class_device_attribute **attrs = cont->attrs; int i; - if (!attrs) + if (!attrs && !cont->grp) return; + if (cont->grp) { + sysfs_remove_group(&classdev->kobj, cont->grp); + return ; + } + for (i = 0; attrs[i]; i++) class_device_remove_file(classdev, attrs[i]); } diff --git a/trunk/include/linux/attribute_container.h b/trunk/include/linux/attribute_container.h index 8ff274933948..f5582332af04 100644 --- a/trunk/include/linux/attribute_container.h +++ b/trunk/include/linux/attribute_container.h @@ -17,6 +17,7 @@ struct attribute_container { struct list_head node; struct klist containers; struct class *class; + struct attribute_group *grp; struct class_device_attribute **attrs; int (*match)(struct attribute_container *, struct device *); #define ATTRIBUTE_CONTAINER_NO_CLASSDEVS 0x01