diff options
Diffstat (limited to 'drivers/base/sys.c')
-rw-r--r-- | drivers/base/sys.c | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/drivers/base/sys.c b/drivers/base/sys.c index 29eadc656bd1..47fc6eb6473f 100644 --- a/drivers/base/sys.c +++ b/drivers/base/sys.c | |||
@@ -224,20 +224,15 @@ int sysdev_register(struct sys_device * sysdev) | |||
224 | if (!cls) | 224 | if (!cls) |
225 | return -EINVAL; | 225 | return -EINVAL; |
226 | 226 | ||
227 | pr_debug("Registering sys device '%s'\n", kobject_name(&sysdev->kobj)); | ||
228 | |||
227 | /* Make sure the kset is set */ | 229 | /* Make sure the kset is set */ |
228 | sysdev->kobj.kset = &cls->kset; | 230 | sysdev->kobj.kset = &cls->kset; |
229 | 231 | ||
230 | /* But make sure we point to the right type for sysfs translation */ | ||
231 | sysdev->kobj.ktype = &ktype_sysdev; | ||
232 | error = kobject_set_name(&sysdev->kobj, "%s%d", | ||
233 | kobject_name(&cls->kset.kobj), sysdev->id); | ||
234 | if (error) | ||
235 | return error; | ||
236 | |||
237 | pr_debug("Registering sys device '%s'\n", kobject_name(&sysdev->kobj)); | ||
238 | |||
239 | /* Register the object */ | 232 | /* Register the object */ |
240 | error = kobject_register(&sysdev->kobj); | 233 | error = kobject_init_and_add(&sysdev->kobj, &ktype_sysdev, NULL, |
234 | "%s%d", kobject_name(&cls->kset.kobj), | ||
235 | sysdev->id); | ||
241 | 236 | ||
242 | if (!error) { | 237 | if (!error) { |
243 | struct sysdev_driver * drv; | 238 | struct sysdev_driver * drv; |
@@ -254,6 +249,7 @@ int sysdev_register(struct sys_device * sysdev) | |||
254 | } | 249 | } |
255 | mutex_unlock(&sysdev_drivers_lock); | 250 | mutex_unlock(&sysdev_drivers_lock); |
256 | } | 251 | } |
252 | kobject_uevent(&sysdev->kobj, KOBJ_ADD); | ||
257 | return error; | 253 | return error; |
258 | } | 254 | } |
259 | 255 | ||