Re: [PATCH] cpufreq: brcmstb-cpufreq: CPUfreq driver for older Broadcom STB SoCs
From: Viresh Kumar
Date: Thu Nov 17 2016 - 22:09:44 EST
On 17-11-16, 10:38, Markus Mayer wrote:
> No, because I am trying to find the lowest frequency that doesn't
> require safe mode and it's looping through the table from highest to
> lowest. So there could still be a lower frequency after the current
> one that doesn't require safe mode.
>
> What I can do, however, is something like this:
>
> static ssize_t show_brcmstb_safe_freq(struct cpufreq_policy *policy, char *buf)
> {
> struct cpufreq_frequency_table *entry;
> unsigned int safe_freq = 0;
>
> cpufreq_for_each_valid_entry(entry, policy->freq_table) {
> if (!(entry->driver_data & BRCMSTB_TBL_SAFE_MODE))
> safe_freq = entry->frequency;
> }
>
> return sprintf(buf, "%u\n", safe_freq);
> }
>
> This is using the existing data from the frequency table rather than
> re-generating it on the fly by calling freq_requires_safe_mode().
> All my allocations are managed (i.e. using devm* functions), so
> cleanup should be automatic. Do I still need one?
> It's using for a clock node (brcm,brcmstb-cpu-clk-div) which exists
> independently of this driver.
All these seem fine to me.
--
viresh