]> git.baikalelectronics.ru Git - kernel.git/commit
cpufreq: Fix creation of symbolic links to policy directories
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Mon, 27 Mar 2017 17:33:09 +0000 (19:33 +0200)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Mon, 27 Mar 2017 17:33:09 +0000 (19:33 +0200)
commitc7eebc4319735185947d60e485cca9d42600995b
tree161cef43a1b7043076e91651b302dd0804d5bdf2
parent7c0f10fa27a176187d45407dfb495d8359c67f74
cpufreq: Fix creation of symbolic links to policy directories

The cpufreq core only tries to create symbolic links from CPU
directories in sysfs to policy directories in cpufreq_add_dev(),
either when a given CPU is registered or when the cpufreq driver
is registered, whichever happens first.  That is not sufficient,
however, because cpufreq_add_dev() may be called for an offline CPU
whose policy object has not been created yet and, quite obviously,
the symbolic cannot be added in that case.

Fix that by making cpufreq_online() attempt to add symbolic links to
policy objects for the CPUs in the related_cpus mask of every new
policy object created by it.

The cpufreq_driver_lock locking around the for_each_cpu() loop
in cpufreq_online() is dropped, because it is not necessary and the
code is somewhat simpler without it.  Moreover, failures to create
a symbolic link will not be regarded as hard errors any more and
the CPUs without those links will not be taken offline automatically,
but that should not be problematic in practice.

Reported-and-tested-by: Prashanth Prakash <pprakash@codeaurora.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Cc: 4.9+ <stable@vger.kernel.org> # 4.9+
drivers/cpufreq/cpufreq.c