Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 77097
b: refs/heads/master
c: fd11097
h: refs/heads/master
i:
  77095: faeb050
v: v3
  • Loading branch information
James Bottomley authored and James Bottomley committed Jan 23, 2008
1 parent 0870833 commit 9267d28
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 11f24fbdf511cf588c3a18e3208ee02d85db0020
refs/heads/master: fd1109711d7f76126e7cef947999f139b198dc15
14 changes: 12 additions & 2 deletions trunk/drivers/base/attribute_container.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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]);
}
Expand Down
1 change: 1 addition & 0 deletions trunk/include/linux/attribute_container.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 9267d28

Please sign in to comment.