summaryrefslogtreecommitdiff
path: root/drivers/base/attribute_container.c
diff options
context:
space:
mode:
authorJames Bottomley <James.Bottomley@HansenPartnership.com>2008-01-03 03:48:47 +0300
committerJames Bottomley <James.Bottomley@HansenPartnership.com>2008-01-23 20:29:17 +0300
commitfd1109711d7f76126e7cef947999f139b198dc15 (patch)
treee108e3b02fa50e2bcb8456bbc5a4a0c90391c9e1 /drivers/base/attribute_container.c
parent11f24fbdf511cf588c3a18e3208ee02d85db0020 (diff)
downloadlinux-fd1109711d7f76126e7cef947999f139b198dc15.tar.xz
[SCSI] attribute_container: update to use the group interface
This patch is the beginning of moving the attribute_containers to use attribute groups exclusively. The attr element is now deprecated and will eventually be removed (along with all the hand rolled code for doing exactly what attribute groups do) when all the consumers are converted to attribute groups. Acked-by: Greg Kroah-Hartman <gregkh@suse.de> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'drivers/base/attribute_container.c')
-rw-r--r--drivers/base/attribute_container.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/drivers/base/attribute_container.c b/drivers/base/attribute_container.c
index 7370d7cf5988..5bf25c6f966c 100644
--- a/drivers/base/attribute_container.c
+++ b/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]);
}