Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 11f24fbd authored by James Bottomley's avatar James Bottomley
Browse files

[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: default avatarTejun Heo <htejun@gmail.com>
Acked-by: default avatarKay Sievers <kay.sievers@vrfy.org>
Acked-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@HansenPartnership.com>
parent d0ad3bc9
Loading
Loading
Loading
Loading
+9 −2
Original line number Diff line number Diff line
@@ -568,7 +568,11 @@ int sysfs_add_file_to_group(struct kobject *kobj,
	struct sysfs_dirent *dir_sd;
	int error;

	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;

	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);