From: James Bottomley Date: Thu, 3 Jan 2008 00:44:05 +0000 (-0600) Subject: [SCSI] sysfs: fix the sysfs_add_file_to_group interfaces X-Git-Tag: v2.6.25-rc1~1230^2~71 X-Git-Url: http://www.pilppa.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=11f24fbdf511cf588c3a18e3208ee02d85db0020;p=linux-2.6-omap-h63xx.git [SCSI] sysfs: fix the sysfs_add_file_to_group interfaces 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 Acked-by: Kay Sievers Acked-by: Greg Kroah-Hartman Signed-off-by: James Bottomley --- diff --git a/fs/sysfs/file.c b/fs/sysfs/file.c index 4045bdcc4b3..b834f1709f9 100644 --- a/fs/sysfs/file.c +++ b/fs/sysfs/file.c @@ -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; @@ -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);