]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/base/attribute_container.c
[SCSI] attribute_container: update to use the group interface
[linux-2.6-omap-h63xx.git] / drivers / base / attribute_container.c
index 7370d7cf59888050d374d7a48a03185a06f0df7c..5bf25c6f966cd920753eff462507c1a773d448e9 100644 (file)
@@ -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]);
 }