sysfs: clean up sysfs_get_dirent()
The pre-existing sysfs interfaces which take explicit namespace argument are weird in that they place the optional @ns in front of @name which is contrary to the established convention. For example, we end up forcing vast majority of sysfs_get_dirent() users to do sysfs_get_dirent(parent, NULL, name), which is silly and error-prone especially as @ns and @name may be interchanged without causing compilation warning. This renames sysfs_get_dirent() to sysfs_get_dirent_ns() and swap the positions of @name and @ns, and sysfs_get_dirent() is now a wrapper around sysfs_get_dirent_ns(). This makes confusions a lot less likely. There are other interfaces which take @ns before @name. They'll be updated by following patches. This patch doesn't introduce any functional changes. v2: EXPORT_SYMBOL_GPL() wasn't updated leading to undefined symbol error on module builds. Reported by build test robot. Fixed. Signed-off-by: Tejun Heo <tj@kernel.org> Cc: Eric W. Biederman <ebiederm@xmission.com> Cc: Kay Sievers <kay@vrfy.org> Cc: Fengguang Wu <fengguang.wu@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
cb26a31157
commit
388975ccca
@@ -207,7 +207,7 @@ void sysfs_remove_group(struct kobject *kobj,
|
||||
struct sysfs_dirent *sd;
|
||||
|
||||
if (grp->name) {
|
||||
sd = sysfs_get_dirent(dir_sd, NULL, grp->name);
|
||||
sd = sysfs_get_dirent(dir_sd, grp->name);
|
||||
if (!sd) {
|
||||
WARN(!sd, KERN_WARNING
|
||||
"sysfs group %p not found for kobject '%s'\n",
|
||||
@@ -262,7 +262,7 @@ int sysfs_merge_group(struct kobject *kobj,
|
||||
struct attribute *const *attr;
|
||||
int i;
|
||||
|
||||
dir_sd = sysfs_get_dirent(kobj->sd, NULL, grp->name);
|
||||
dir_sd = sysfs_get_dirent(kobj->sd, grp->name);
|
||||
if (!dir_sd)
|
||||
return -ENOENT;
|
||||
|
||||
@@ -289,7 +289,7 @@ void sysfs_unmerge_group(struct kobject *kobj,
|
||||
struct sysfs_dirent *dir_sd;
|
||||
struct attribute *const *attr;
|
||||
|
||||
dir_sd = sysfs_get_dirent(kobj->sd, NULL, grp->name);
|
||||
dir_sd = sysfs_get_dirent(kobj->sd, grp->name);
|
||||
if (dir_sd) {
|
||||
for (attr = grp->attrs; *attr; ++attr)
|
||||
sysfs_hash_and_remove(dir_sd, NULL, (*attr)->name);
|
||||
@@ -311,7 +311,7 @@ int sysfs_add_link_to_group(struct kobject *kobj, const char *group_name,
|
||||
struct sysfs_dirent *dir_sd;
|
||||
int error = 0;
|
||||
|
||||
dir_sd = sysfs_get_dirent(kobj->sd, NULL, group_name);
|
||||
dir_sd = sysfs_get_dirent(kobj->sd, group_name);
|
||||
if (!dir_sd)
|
||||
return -ENOENT;
|
||||
|
||||
@@ -333,7 +333,7 @@ void sysfs_remove_link_from_group(struct kobject *kobj, const char *group_name,
|
||||
{
|
||||
struct sysfs_dirent *dir_sd;
|
||||
|
||||
dir_sd = sysfs_get_dirent(kobj->sd, NULL, group_name);
|
||||
dir_sd = sysfs_get_dirent(kobj->sd, group_name);
|
||||
if (dir_sd) {
|
||||
sysfs_hash_and_remove(dir_sd, NULL, link_name);
|
||||
sysfs_put(dir_sd);
|
||||
|
Reference in New Issue
Block a user