linux-stable/drivers/cpufreq
Xiongfeng Wang c649d47801 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:04:42 +01:00
..
acpi-cpufreq.c cpufreq: acpi: Remove acpi_cpufreq_cpu_ready() 2021-09-02 18:04:17 +02:00
amd_freq_sensitivity.c
armada-8k-cpufreq.c
armada-37xx-cpufreq.c cpufreq: armada-37xx: forbid cpufreq for 1.2 GHz variant 2021-08-09 09:31:22 +05:30
bmips-cpufreq.c
brcmstb-avs-cpufreq.c cpufreq: brcmstb-avs-cpufreq: Fix resource leaks in ->remove() 2021-01-18 12:23:43 +05:30
cppc_cpufreq.c cpufreq: CPPC: Add support for frequency invariance 2021-07-01 07:32:14 +05:30
cpufreq-dt-platdev.c cpufreq: blocklist more Qualcomm platforms in cpufreq-dt-platdev 2021-08-30 10:43:35 +05:30
cpufreq-dt.c cpufreq: dt: Use .register_em() to register with energy model 2021-08-12 09:54:07 +05:30
cpufreq-dt.h
cpufreq-nforce2.c
cpufreq.c cpufreq: Fix get_cpu_device() failure in add_cpu_dev_symlink() 2021-12-08 09:04:42 +01:00
cpufreq_conservative.c
cpufreq_governor.c
cpufreq_governor.h
cpufreq_governor_attr_set.c cpufreq: schedutil: Destroy mutex before kobject_put() frees the memory 2021-09-14 19:01:36 +02:00
cpufreq_ondemand.c cpufreq: Replace deprecated CPU-hotplug functions 2021-08-04 20:16:32 +02:00
cpufreq_ondemand.h
cpufreq_performance.c
cpufreq_powersave.c
cpufreq_stats.c cpufreq: stats: Clean up local variable in cpufreq_stats_create_table() 2021-06-07 13:47:57 +02:00
cpufreq_userspace.c
davinci-cpufreq.c cpufreq: Remove CPUFREQ_STICKY flag 2021-02-04 19:23:20 +01:00
e_powersaver.c
elanfreq.c
freq_table.c cpufreq: Fix scaling_{available,boost}_frequencies_show() comments 2021-03-26 17:43:48 +01:00
gx-suspmod.c
highbank-cpufreq.c cpufreq: highbank: Add missing MODULE_DEVICE_TABLE 2020-12-07 13:02:37 +05:30
ia64-acpi-cpufreq.c ia64: fix format string for ia64-acpi-cpu-freq 2021-03-19 17:26:20 +01:00
imx-cpufreq-dt.c
imx6q-cpufreq.c cpufreq: imx6q: Use .register_em() to register with energy model 2021-08-12 09:54:07 +05:30
intel_pstate.c cpufreq: intel_pstate: Add Ice Lake server to out-of-band IDs 2021-12-01 09:04:51 +01:00
Kconfig cpufreq: Kconfig: fix documentation links 2021-04-21 19:00:42 +02:00
Kconfig.arm cpufreq: mediatek-hw: Add support for CPUFREQ HW 2021-09-06 15:15:19 +05:30
Kconfig.powerpc
Kconfig.x86 cpufreq: sfi-cpufreq: Remove driver for deprecated firmware 2021-02-15 20:04:46 +01:00
kirkwood-cpufreq.c
longhaul.c cpufreq: Fix fall-through warning for Clang 2021-07-13 11:53:07 -05:00
longhaul.h
longrun.c
loongson1-cpufreq.c cpufreq: Remove CPUFREQ_STICKY flag 2021-02-04 19:23:20 +01:00
loongson2_cpufreq.c cpufreq: loongson2: Remove unused linux/sched.h headers 2021-06-07 17:43:52 +02:00
Makefile cpufreq: mediatek-hw: Add support for CPUFREQ HW 2021-09-06 15:15:19 +05:30
maple-cpufreq.c
mediatek-cpufreq-hw.c cpufreq: mediatek-hw: Add support for CPUFREQ HW 2021-09-06 15:15:19 +05:30
mediatek-cpufreq.c cpufreq: mediatek: Use .register_em() to register with energy model 2021-08-12 09:54:07 +05:30
mvebu-cpufreq.c
omap-cpufreq.c cpufreq: omap: Use .register_em() to register with energy model 2021-08-12 09:54:07 +05:30
p4-clockmod.c
pasemi-cpufreq.c
pcc-cpufreq.c
pmac32-cpufreq.c cpufreq: Remove unused flag CPUFREQ_PM_NO_WARN 2021-02-04 19:25:47 +01:00
pmac64-cpufreq.c
powernow-k6.c
powernow-k7.c
powernow-k7.h
powernow-k8.c cpufreq: Replace deprecated CPU-hotplug functions 2021-08-04 20:16:32 +02:00
powernow-k8.h
powernv-cpufreq.c powerpc updates for 5.15 2021-09-03 11:22:50 -07: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: Set dvfs_possible_from_any_cpu cpufreq driver flag 2021-08-30 10:43:35 +05:30
qcom-cpufreq-nvmem.c Merge branch 'pm-cpufreq' 2020-12-15 15:24:52 +01:00
qoriq-cpufreq.c
raspberrypi-cpufreq.c
s3c24xx-cpufreq-debugfs.c
s3c24xx-cpufreq.c cpufreq: Remove CPUFREQ_STICKY flag 2021-02-04 19:23:20 +01:00
s3c64xx-cpufreq.c
s3c2410-cpufreq.c
s3c2412-cpufreq.c
s3c2416-cpufreq.c
s3c2440-cpufreq.c
s5pv210-cpufreq.c cpufreq: Rudimentary typos fix in the file s5pv210-cpufreq.c 2021-03-22 08:55:41 +05:30
sa1100-cpufreq.c cpufreq: Remove CPUFREQ_STICKY flag 2021-02-04 19:23:20 +01:00
sa1110-cpufreq.c cpufreq: Remove CPUFREQ_STICKY flag 2021-02-04 19:23:20 +01:00
sc520_freq.c cpufreq: sc520_freq: add 'fallthrough' to one case 2021-05-21 18:52:13 +02:00
scmi-cpufreq.c cpufreq: scmi: Use .register_em() to register with energy model 2021-08-30 10:43:00 +05:30
scpi-cpufreq.c cpufreq: scpi: Use .register_em() to register with energy model 2021-08-30 10:42:45 +05:30
sh-cpufreq.c cpufreq: sh: Remove sh_cpufreq_cpu_ready() 2021-09-02 18:04:17 +02:00
sparc-us2e-cpufreq.c
sparc-us3-cpufreq.c
spear-cpufreq.c cpufreq: Remove CPUFREQ_STICKY flag 2021-02-04 19:23:20 +01:00
speedstep-centrino.c
speedstep-ich.c
speedstep-lib.c
speedstep-lib.h
speedstep-smi.c
sti-cpufreq.c cpufreq: st: Add missing MODULE_DEVICE_TABLE 2020-12-07 13:02:37 +05:30
sun50i-cpufreq-nvmem.c cpufreq: sun50i: Add missing MODULE_DEVICE_TABLE 2020-12-07 13:02:37 +05:30
tegra20-cpufreq.c cpufreq: tegra20: Use resource-managed API 2021-01-18 12:02:53 +05:30
tegra124-cpufreq.c
tegra186-cpufreq.c cpufreq: Remove CPUFREQ_STICKY flag 2021-02-04 19:23:20 +01:00
tegra194-cpufreq.c cpufreq: Remove CPUFREQ_STICKY flag 2021-02-04 19:23:20 +01:00
ti-cpufreq.c
vexpress-spc-cpufreq.c cpufreq: vexpress: Drop unused variable 2021-09-16 11:29:27 -07:00