• Rafael J. Wysocki's avatar
    cpufreq: Fix creation of symbolic links to policy directories · e9a1ba29
    Rafael J. Wysocki authored
    
    [ Upstream commit 2f0ba790 ]
    
    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: default avatarPrashanth Prakash <pprakash@codeaurora.org>
    Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
    Signed-off-by: default avatarSasha Levin <alexander.levin@verizon.com>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    e9a1ba29
cpufreq.c 65.8 KB