Kobject: change drivers/cpufreq/cpufreq.c to use kobject_init_and_add
Stop using kobject_register, as this way we can control the sending of the uevent properly, after everything is properly initialized. Cc: Dominik Brodowski <linux@brodo.de> Cc: Ashok Raj <ashok.raj@intel.com> Cc: Jacob Shin <jacob.shin@amd.com> Cc: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
Родитель
d6d292c451
Коммит
038c5b3e41
|
@ -828,11 +828,8 @@ static int cpufreq_add_dev (struct sys_device * sys_dev)
|
||||||
memcpy(&new_policy, policy, sizeof(struct cpufreq_policy));
|
memcpy(&new_policy, policy, sizeof(struct cpufreq_policy));
|
||||||
|
|
||||||
/* prepare interface data */
|
/* prepare interface data */
|
||||||
policy->kobj.parent = &sys_dev->kobj;
|
ret = kobject_init_and_add(&policy->kobj, &ktype_cpufreq, &sys_dev->kobj,
|
||||||
policy->kobj.ktype = &ktype_cpufreq;
|
"cpufreq");
|
||||||
kobject_set_name(&policy->kobj, "cpufreq");
|
|
||||||
|
|
||||||
ret = kobject_register(&policy->kobj);
|
|
||||||
if (ret) {
|
if (ret) {
|
||||||
unlock_policy_rwsem_write(cpu);
|
unlock_policy_rwsem_write(cpu);
|
||||||
goto err_out_driver_exit;
|
goto err_out_driver_exit;
|
||||||
|
@ -902,6 +899,7 @@ static int cpufreq_add_dev (struct sys_device * sys_dev)
|
||||||
goto err_out_unregister;
|
goto err_out_unregister;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
kobject_uevent(&policy->kobj, KOBJ_ADD);
|
||||||
module_put(cpufreq_driver->owner);
|
module_put(cpufreq_driver->owner);
|
||||||
dprintk("initialization complete\n");
|
dprintk("initialization complete\n");
|
||||||
cpufreq_debug_enable_ratelimit();
|
cpufreq_debug_enable_ratelimit();
|
||||||
|
|
Загрузка…
Ссылка в новой задаче