diff options
Diffstat (limited to 'drivers/base')
-rw-r--r-- | drivers/base/class.c | 42 |
1 files changed, 0 insertions, 42 deletions
diff --git a/drivers/base/class.c b/drivers/base/class.c index 1417e5cd4c6f..d5968128be2b 100644 --- a/drivers/base/class.c +++ b/drivers/base/class.c | |||
@@ -840,48 +840,6 @@ void class_device_destroy(struct class *cls, dev_t devt) | |||
840 | class_device_unregister(class_dev); | 840 | class_device_unregister(class_dev); |
841 | } | 841 | } |
842 | 842 | ||
843 | int class_device_rename(struct class_device *class_dev, char *new_name) | ||
844 | { | ||
845 | int error = 0; | ||
846 | char *old_class_name = NULL, *new_class_name = NULL; | ||
847 | |||
848 | class_dev = class_device_get(class_dev); | ||
849 | if (!class_dev) | ||
850 | return -EINVAL; | ||
851 | |||
852 | pr_debug("CLASS: renaming '%s' to '%s'\n", class_dev->class_id, | ||
853 | new_name); | ||
854 | |||
855 | #ifdef CONFIG_SYSFS_DEPRECATED | ||
856 | if (class_dev->dev) | ||
857 | old_class_name = make_class_name(class_dev->class->name, | ||
858 | &class_dev->kobj); | ||
859 | #endif | ||
860 | |||
861 | strlcpy(class_dev->class_id, new_name, KOBJ_NAME_LEN); | ||
862 | |||
863 | error = kobject_rename(&class_dev->kobj, new_name); | ||
864 | |||
865 | #ifdef CONFIG_SYSFS_DEPRECATED | ||
866 | if (class_dev->dev) { | ||
867 | new_class_name = make_class_name(class_dev->class->name, | ||
868 | &class_dev->kobj); | ||
869 | if (new_class_name) | ||
870 | sysfs_create_link(&class_dev->dev->kobj, | ||
871 | &class_dev->kobj, new_class_name); | ||
872 | if (old_class_name) | ||
873 | sysfs_remove_link(&class_dev->dev->kobj, | ||
874 | old_class_name); | ||
875 | } | ||
876 | #endif | ||
877 | class_device_put(class_dev); | ||
878 | |||
879 | kfree(old_class_name); | ||
880 | kfree(new_class_name); | ||
881 | |||
882 | return error; | ||
883 | } | ||
884 | |||
885 | struct class_device * class_device_get(struct class_device *class_dev) | 843 | struct class_device * class_device_get(struct class_device *class_dev) |
886 | { | 844 | { |
887 | if (class_dev) | 845 | if (class_dev) |