Skip to content

Commit

Permalink
[SCSI] sysfs: fix the sysfs_add_file_to_group interfaces
Browse files Browse the repository at this point in the history
I can't see a reason why these shouldn't work on every group.  However,
they only seem to work on named groups.  This patch allows the group
functions to work on anonymous groups (those with NULL names).

Acked-by: Tejun Heo <htejun@gmail.com>
Acked-by: Kay Sievers <kay.sievers@vrfy.org>
Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
  • Loading branch information
James Bottomley authored and James Bottomley committed Jan 23, 2008
1 parent d0ad3bc commit 11f24fb
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions fs/sysfs/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -568,7 +568,11 @@ int sysfs_add_file_to_group(struct kobject *kobj,
struct sysfs_dirent *dir_sd;
int error;

dir_sd = sysfs_get_dirent(kobj->sd, group);
if (group)
dir_sd = sysfs_get_dirent(kobj->sd, group);
else
dir_sd = sysfs_get(kobj->sd);

if (!dir_sd)
return -ENOENT;

Expand Down Expand Up @@ -656,7 +660,10 @@ void sysfs_remove_file_from_group(struct kobject *kobj,
{
struct sysfs_dirent *dir_sd;

dir_sd = sysfs_get_dirent(kobj->sd, group);
if (group)
dir_sd = sysfs_get_dirent(kobj->sd, group);
else
dir_sd = sysfs_get(kobj->sd);
if (dir_sd) {
sysfs_hash_and_remove(dir_sd, attr->name);
sysfs_put(dir_sd);
Expand Down

0 comments on commit 11f24fb

Please sign in to comment.