summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2013-09-11 22:29:06 -0400
committerMaciej Wereski <m.wereski@partner.samsung.com>2015-03-23 18:33:33 +0100
commitfd66422449deac388d69f43ff7787989b9f87b6a (patch)
treed58b2b6eea47ede77a40414ce701f608ff11ea98 /drivers
parent4953c06795537f8b73aec91aa7cf328790d3a780 (diff)
downloadlinux-3.10-fd66422449deac388d69f43ff7787989b9f87b6a.tar.gz
linux-3.10-fd66422449deac388d69f43ff7787989b9f87b6a.tar.bz2
linux-3.10-fd66422449deac388d69f43ff7787989b9f87b6a.zip
sysfs: remove ktype->namespace() invocations in symlink code
There's no reason for sysfs to be calling ktype->namespace(). It is backwards, obfuscates what's going on and unnecessarily tangles two separate layers. There are two places where symlink code calls ktype->namespace(). * sysfs_do_create_link_sd() calls it to find out the namespace tag of the target directory. Unless symlinking races with cross-namespace renaming, this equals @target_sd->s_ns. * sysfs_rename_link() uses it to find out the new namespace to rename to and the new namespace can be different from the existing one. The function is renamed to sysfs_rename_link_ns() with an explicit @ns argument and the ktype->namespace() invocation is shifted to the device layer. While this patch replaces ktype->namespace() invocation with the recorded result in @target_sd, this shouldn't result in any behvior difference. Signed-off-by: Tejun Heo <tj@kernel.org> Cc: Eric W. Biederman <ebiederm@xmission.com> Cc: Kay Sievers <kay@vrfy.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/base/core.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/base/core.c b/drivers/base/core.c
index 00a3be583c0..52850a2e8a2 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -1687,6 +1687,7 @@ EXPORT_SYMBOL_GPL(device_destroy);
*/
int device_rename(struct device *dev, const char *new_name)
{
+ struct kobject *kobj = &dev->kobj;
char *old_device_name = NULL;
int error;
@@ -1704,13 +1705,14 @@ int device_rename(struct device *dev, const char *new_name)
}
if (dev->class) {
- error = sysfs_rename_link(&dev->class->p->subsys.kobj,
- &dev->kobj, old_device_name, new_name);
+ error = sysfs_rename_link_ns(&dev->class->p->subsys.kobj,
+ kobj, old_device_name,
+ new_name, kobject_namespace(kobj));
if (error)
goto out;
}
- error = kobject_rename(&dev->kobj, new_name);
+ error = kobject_rename(kobj, new_name);
if (error)
goto out;