mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 18:51:56 -04:00
[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 <[email protected]> Signed-off-by: James Bottomley <[email protected]>
This commit is contained in:
parent
11f24fbdf5
commit
fd1109711d
2 changed files with 13 additions and 2 deletions
|
|
@ -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]);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue