Commit 2c1b5a8
cpufreq: Fix get_cpu_device() failure in add_cpu_dev_symlink()
When I hot added a CPU, I found 'cpufreq' directory was not created
below /sys/devices/system/cpu/cpuX/.
It is because get_cpu_device() failed in add_cpu_dev_symlink().
cpufreq_add_dev() is the .add_dev callback of a CPU subsys interface.
It will be called when the CPU device registered into the system.
The call chain is as follows:
register_cpu()
->device_register()
->device_add()
->bus_probe_device()
->cpufreq_add_dev()
But only after the CPU device has been registered, we can get the
CPU device by get_cpu_device(), otherwise it will return NULL.
Since we already have the CPU device in cpufreq_add_dev(), pass
it to add_cpu_dev_symlink().
I noticed that the 'kobj' of the CPU device has been added into
the system before cpufreq_add_dev().
Fixes: 2f0ba79 ("cpufreq: Fix creation of symbolic links to policy directories")
Signed-off-by: Xiongfeng Wang <wangxiongfeng2@huawei.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Cc: All applicable <stable@vger.kernel.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>1 parent d58071a commit 2c1b5a8
1 file changed
Lines changed: 4 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1004 | 1004 | | |
1005 | 1005 | | |
1006 | 1006 | | |
1007 | | - | |
| 1007 | + | |
| 1008 | + | |
1008 | 1009 | | |
1009 | | - | |
1010 | | - | |
1011 | 1010 | | |
1012 | 1011 | | |
1013 | 1012 | | |
| |||
1391 | 1390 | | |
1392 | 1391 | | |
1393 | 1392 | | |
1394 | | - | |
| 1393 | + | |
1395 | 1394 | | |
1396 | 1395 | | |
1397 | 1396 | | |
| |||
1565 | 1564 | | |
1566 | 1565 | | |
1567 | 1566 | | |
1568 | | - | |
| 1567 | + | |
1569 | 1568 | | |
1570 | 1569 | | |
1571 | 1570 | | |
| |||
0 commit comments