Re: [PATCH v2 1/2] cpufreq: Add exit_prepare callback to cpufreq_driver interface

From: Viresh Kumar
Date: Tue Mar 18 2014 - 01:43:46 EST


On Sat, Mar 15, 2014 at 7:34 AM, Rafael J. Wysocki <rjw@xxxxxxxxxxxxx> wrote:
> On Friday, March 14, 2014 02:03:56 PM dirk.brandewie@xxxxxxxxx wrote:

>> +++ b/drivers/cpufreq/cpufreq.c
>> @@ -1338,6 +1338,9 @@ static int __cpufreq_remove_dev_prepare(struct device *dev,
>> }
>> }
>>
>> + if (cpufreq_driver->stop)
>
> What about doing
>
> + if (cpufreq_driver->setpolicy && cpufreq_driver->stop)
>
> here instead? That would make it clear where the new callback belongs.

This is called after stopping governor and so might be useful for ->target()
drivers. So, wouldn't be a bad option if we keep it available for all..

@Dirk: I thought about the solution I mentioned in another mail. And it looks
like I will end up getting a similar solution. So, we will go with
your solution.

Just few changes for your solution..

You need to call ->stop() only for the last CPU of every policy and not for
every CPU, so you need something like this:

diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index 19d25a8..78d41c0 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -1371,6 +1371,8 @@ static int __cpufreq_remove_dev_prepare(struct
device *dev,
__func__, new_cpu, cpu);
}
}
+ } else if (cpufreq_driver->stop) {
+ cpufreq_driver->stop(policy);
}

return 0;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/