* [PATCH] cpufreq: Clear real_cpus mask from remove_cpu_dev_symlink()
@ 2022-05-11 9:06 Viresh Kumar
2022-05-11 17:24 ` Rafael J. Wysocki
0 siblings, 1 reply; 2+ messages in thread
From: Viresh Kumar @ 2022-05-11 9:06 UTC (permalink / raw)
To: Rafael Wysocki, Rafael J. Wysocki, Viresh Kumar
Cc: linux-pm, Vincent Guittot, linux-kernel
add_cpu_dev_symlink() is responsible for setting the CPUs in the
real_cpus mask, the reverse of which should be done from
remove_cpu_dev_symlink() to make it look clean and avoid any breakage
later on.
Move the call to clear the mask to remove_cpu_dev_symlink().
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
drivers/cpufreq/cpufreq.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index fbaa8e6c7d23..c8bf6c68597c 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -1020,11 +1020,12 @@ static void add_cpu_dev_symlink(struct cpufreq_policy *policy, unsigned int cpu,
dev_err(dev, "cpufreq symlink creation failed\n");
}
-static void remove_cpu_dev_symlink(struct cpufreq_policy *policy,
+static void remove_cpu_dev_symlink(struct cpufreq_policy *policy, int cpu,
struct device *dev)
{
dev_dbg(dev, "%s: Removing symlink\n", __func__);
sysfs_remove_link(&dev->kobj, "cpufreq");
+ cpumask_clear_cpu(cpu, policy->real_cpus);
}
static int cpufreq_add_dev_interface(struct cpufreq_policy *policy)
@@ -1532,7 +1533,7 @@ static int cpufreq_online(unsigned int cpu)
out_destroy_policy:
for_each_cpu(j, policy->real_cpus)
- remove_cpu_dev_symlink(policy, get_cpu_device(j));
+ remove_cpu_dev_symlink(policy, j, get_cpu_device(j));
up_write(&policy->rwsem);
@@ -1657,8 +1658,7 @@ static void cpufreq_remove_dev(struct device *dev, struct subsys_interface *sif)
if (cpu_online(cpu))
cpufreq_offline(cpu);
- cpumask_clear_cpu(cpu, policy->real_cpus);
- remove_cpu_dev_symlink(policy, dev);
+ remove_cpu_dev_symlink(policy, cpu, dev);
if (cpumask_empty(policy->real_cpus)) {
/* We did light-weight exit earlier, do full tear down now */
--
2.31.1.272.g89b43f80a514
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] cpufreq: Clear real_cpus mask from remove_cpu_dev_symlink()
2022-05-11 9:06 [PATCH] cpufreq: Clear real_cpus mask from remove_cpu_dev_symlink() Viresh Kumar
@ 2022-05-11 17:24 ` Rafael J. Wysocki
0 siblings, 0 replies; 2+ messages in thread
From: Rafael J. Wysocki @ 2022-05-11 17:24 UTC (permalink / raw)
To: Viresh Kumar
Cc: Rafael Wysocki, Rafael J. Wysocki, Linux PM, Vincent Guittot,
Linux Kernel Mailing List
On Wed, May 11, 2022 at 11:06 AM Viresh Kumar <viresh.kumar@linaro.org> wrote:
>
> add_cpu_dev_symlink() is responsible for setting the CPUs in the
> real_cpus mask, the reverse of which should be done from
> remove_cpu_dev_symlink() to make it look clean and avoid any breakage
> later on.
>
> Move the call to clear the mask to remove_cpu_dev_symlink().
>
> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
> ---
> drivers/cpufreq/cpufreq.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
> index fbaa8e6c7d23..c8bf6c68597c 100644
> --- a/drivers/cpufreq/cpufreq.c
> +++ b/drivers/cpufreq/cpufreq.c
> @@ -1020,11 +1020,12 @@ static void add_cpu_dev_symlink(struct cpufreq_policy *policy, unsigned int cpu,
> dev_err(dev, "cpufreq symlink creation failed\n");
> }
>
> -static void remove_cpu_dev_symlink(struct cpufreq_policy *policy,
> +static void remove_cpu_dev_symlink(struct cpufreq_policy *policy, int cpu,
> struct device *dev)
> {
> dev_dbg(dev, "%s: Removing symlink\n", __func__);
> sysfs_remove_link(&dev->kobj, "cpufreq");
> + cpumask_clear_cpu(cpu, policy->real_cpus);
> }
>
> static int cpufreq_add_dev_interface(struct cpufreq_policy *policy)
> @@ -1532,7 +1533,7 @@ static int cpufreq_online(unsigned int cpu)
>
> out_destroy_policy:
> for_each_cpu(j, policy->real_cpus)
> - remove_cpu_dev_symlink(policy, get_cpu_device(j));
> + remove_cpu_dev_symlink(policy, j, get_cpu_device(j));
>
> up_write(&policy->rwsem);
>
> @@ -1657,8 +1658,7 @@ static void cpufreq_remove_dev(struct device *dev, struct subsys_interface *sif)
> if (cpu_online(cpu))
> cpufreq_offline(cpu);
>
> - cpumask_clear_cpu(cpu, policy->real_cpus);
> - remove_cpu_dev_symlink(policy, dev);
> + remove_cpu_dev_symlink(policy, cpu, dev);
>
> if (cpumask_empty(policy->real_cpus)) {
> /* We did light-weight exit earlier, do full tear down now */
> --
Applied as 5.19 material, thanks!
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-05-11 17:24 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-11 9:06 [PATCH] cpufreq: Clear real_cpus mask from remove_cpu_dev_symlink() Viresh Kumar
2022-05-11 17:24 ` Rafael J. Wysocki
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.