linux-stable/drivers/cpufreq
Xiongfeng Wang 92283c2728 cpufreq: Fix get_cpu_device() failure in add_cpu_dev_symlink()
commit 2c1b5a8466 upstream.

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: 2f0ba790df ("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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-12-08 09:03:21 +01:00
..
acpi-cpufreq.c cpufreq: ACPI: Set cpuinfo.max_freq directly if max boost is known 2021-03-04 11:38:22 +01:00
amd_freq_sensitivity.c
armada-8k-cpufreq.c cpufreq: ap806: Add missing MODULE_DEVICE_TABLE 2020-12-30 11:53:37 +01:00
armada-37xx-cpufreq.c cpufreq: armada-37xx: forbid cpufreq for 1.2 GHz variant 2021-08-26 08:35:41 -04:00
bmips-cpufreq.c
brcmstb-avs-cpufreq.c cpufreq: brcmstb-avs-cpufreq: Fix resource leaks in ->remove() 2021-03-04 11:37:24 +01:00
cppc_cpufreq.c
cpufreq-dt-platdev.c cpufreq: blocklist Qualcomm sm8150 in cpufreq-dt-platdev 2021-09-03 10:09:26 +02:00
cpufreq-dt.c
cpufreq-dt.h
cpufreq-nforce2.c
cpufreq.c cpufreq: Fix get_cpu_device() failure in add_cpu_dev_symlink() 2021-12-08 09:03:21 +01:00
cpufreq_conservative.c
cpufreq_governor.c
cpufreq_governor.h cpufreq: Introduce governor flags 2020-11-10 18:31:17 +01:00
cpufreq_governor_attr_set.c cpufreq: schedutil: Destroy mutex before kobject_put() frees the memory 2021-10-06 15:55:46 +02:00
cpufreq_ondemand.c
cpufreq_ondemand.h
cpufreq_performance.c cpufreq: Introduce CPUFREQ_GOV_STRICT_TARGET 2020-11-10 18:31:17 +01:00
cpufreq_powersave.c cpufreq: Introduce CPUFREQ_GOV_STRICT_TARGET 2020-11-10 18:31:17 +01:00
cpufreq_stats.c
cpufreq_userspace.c
davinci-cpufreq.c
e_powersaver.c cpufreq: e_powersaver: remove unreachable break 2020-10-27 18:42:54 +01:00
elanfreq.c
freq_table.c cpufreq: ACPI: Set cpuinfo.max_freq directly if max boost is known 2021-03-04 11:38:22 +01:00
gx-suspmod.c
highbank-cpufreq.c cpufreq: highbank: Add missing MODULE_DEVICE_TABLE 2020-12-30 11:53:38 +01:00
ia64-acpi-cpufreq.c
imx-cpufreq-dt.c
imx6q-cpufreq.c
intel_pstate.c cpufreq: intel_pstate: Override parameters if HWP forced by BIOS 2021-09-30 10:11:06 +02:00
Kconfig cpufreq: Avoid configuring old governors as default with intel_pstate 2020-10-27 18:45:34 +01:00
Kconfig.arm cpufreq: imx: fix NVMEM_IMX_OCOTP dependency 2020-12-30 11:53:39 +01:00
Kconfig.powerpc
Kconfig.x86
kirkwood-cpufreq.c
longhaul.c cpufreq: e_powersaver: remove unreachable break 2020-10-27 18:42:54 +01:00
longhaul.h
longrun.c
loongson1-cpufreq.c cpufreq: loongson1: Add missing MODULE_ALIAS 2020-12-30 11:53:38 +01:00
loongson2_cpufreq.c
Makefile
maple-cpufreq.c
mediatek-cpufreq.c cpufreq: mediatek: Add missing MODULE_DEVICE_TABLE 2020-12-30 11:53:38 +01:00
mvebu-cpufreq.c
omap-cpufreq.c
p4-clockmod.c
pasemi-cpufreq.c
pcc-cpufreq.c
pmac32-cpufreq.c
pmac64-cpufreq.c
powernow-k6.c
powernow-k7.c
powernow-k7.h
powernow-k8.c cpufreq: powernow-k8: pass policy rather than use cpufreq_cpu_get() 2021-01-17 14:17:00 +01:00
powernow-k8.h
powernv-cpufreq.c cpufreq: powernv: Fix init_chip_info initialization in numa=off 2021-09-18 13:40:36 +02:00
ppc_cbe_cpufreq.c
ppc_cbe_cpufreq.h
ppc_cbe_cpufreq_pervasive.c
ppc_cbe_cpufreq_pmi.c
pxa2xx-cpufreq.c
pxa3xx-cpufreq.c
qcom-cpufreq-hw.c cpufreq: qcom-hw: Fix return value check in qcom_cpufreq_hw_cpu_init() 2021-03-17 17:06:33 +01:00
qcom-cpufreq-nvmem.c cpufreq: qcom: Add missing MODULE_DEVICE_TABLE 2020-12-30 11:53:38 +01:00
qoriq-cpufreq.c
raspberrypi-cpufreq.c
s3c24xx-cpufreq-debugfs.c
s3c24xx-cpufreq.c
s3c64xx-cpufreq.c
s3c2410-cpufreq.c
s3c2412-cpufreq.c
s3c2416-cpufreq.c
s3c2440-cpufreq.c
s5pv210-cpufreq.c
sa1100-cpufreq.c
sa1110-cpufreq.c
sc520_freq.c
scmi-cpufreq.c cpufreq: scmi: Fix build for !CONFIG_COMMON_CLK 2020-11-23 10:15:56 +05:30
scpi-cpufreq.c cpufreq: scpi: Add missing MODULE_ALIAS 2020-12-30 11:53:38 +01:00
sfi-cpufreq.c
sh-cpufreq.c
sparc-us2e-cpufreq.c
sparc-us3-cpufreq.c
spear-cpufreq.c
speedstep-centrino.c
speedstep-ich.c
speedstep-lib.c cpufreq: speedstep: remove unneeded semicolon 2020-10-28 18:04:07 +01:00
speedstep-lib.h
speedstep-smi.c
sti-cpufreq.c cpufreq: st: Add missing MODULE_DEVICE_TABLE 2020-12-30 11:53:38 +01:00
sun50i-cpufreq-nvmem.c cpufreq: sun50i: Add missing MODULE_DEVICE_TABLE 2020-12-30 11:53:38 +01:00
tango-cpufreq.c
tegra20-cpufreq.c
tegra124-cpufreq.c
tegra186-cpufreq.c cpufreq: tegra186: Fix get frequency callback 2020-11-17 10:04:21 +05:30
tegra194-cpufreq.c
ti-cpufreq.c
vexpress-spc-cpufreq.c cpufreq: vexpress-spc: Add missing MODULE_ALIAS 2020-12-30 11:53:38 +01:00