Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1413591

Re: [PATCH V3 8/9] cpufreq: Keep policy->freq_table sorted in ascending order

From Steve Muckle <steve.muckle@linaro.org>
Newsgroups linux.kernel
Subject Re: [PATCH V3 8/9] cpufreq: Keep policy->freq_table sorted in ascending order
Date 2016-06-04 01:50 +0200
Message-ID <rG70J-1fx-7@gated-at.bofh.it> (permalink)
References <rFXup-3Iu-3@gated-at.bofh.it> <rFXup-3Iu-9@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Fri, Jun 03, 2016 at 07:05:14PM +0530, Viresh Kumar wrote:
...
> @@ -468,20 +469,15 @@ unsigned int acpi_cpufreq_fast_switch(struct cpufreq_policy *policy,
>  	struct acpi_cpufreq_data *data = policy->driver_data;
>  	struct acpi_processor_performance *perf;
>  	struct cpufreq_frequency_table *entry;
> -	unsigned int next_perf_state, next_freq, freq;
> +	unsigned int next_perf_state, next_freq, index;
>  
>  	/*
>  	 * Find the closest frequency above target_freq.
> -	 *
> -	 * The table is sorted in the reverse order with respect to the
> -	 * frequency and all of the entries are valid (see the initialization).
>  	 */
> -	entry = policy->freq_table;
> -	do {
> -		entry++;
> -		freq = entry->frequency;
> -	} while (freq >= target_freq && freq != CPUFREQ_TABLE_END);
> -	entry--;
> +	index = cpufreq_frequency_table_target(policy, target_freq,
> +					       CPUFREQ_RELATION_L);

Can we call cpufreq_find_index_l directly here? Seems like we could
phase out cpufreq_frequency_table_target() for the most part and call
the helpers directly. It would avoid some code bloat, an unnecessary
switch statement and an error check for an invalid frequency table which
seems unnecessary for every frequency table lookup.

thanks,
Steve

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH V3 8/9] cpufreq: Keep policy->freq_table sorted in ascending order Viresh Kumar <viresh.kumar@linaro.org> - 2016-06-03 15:40 +0200
  Re: [PATCH V3 8/9] cpufreq: Keep policy->freq_table sorted in  ascending order Steve Muckle <steve.muckle@linaro.org> - 2016-06-04 01:50 +0200
    Re: [PATCH V3 8/9] cpufreq: Keep policy->freq_table sorted in  ascending order Viresh Kumar <viresh.kumar@linaro.org> - 2016-06-06 06:00 +0200
      Re: [PATCH V3 8/9] cpufreq: Keep policy->freq_table sorted in ascending order "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2016-06-06 14:10 +0200
        Re: [PATCH V3 8/9] cpufreq: Keep policy->freq_table sorted in  ascending order Viresh Kumar <viresh.kumar@linaro.org> - 2016-06-06 14:40 +0200
          Re: [PATCH V3 8/9] cpufreq: Keep policy->freq_table sorted in  ascending order "Rafael J. Wysocki" <rafael@kernel.org> - 2016-06-06 15:00 +0200
            Re: [PATCH V3 8/9] cpufreq: Keep policy->freq_table sorted in  ascending order Viresh Kumar <viresh.kumar@linaro.org> - 2016-06-06 18:30 +0200
              Re: [PATCH V3 8/9] cpufreq: Keep policy->freq_table sorted in  ascending order "Rafael J. Wysocki" <rafael@kernel.org> - 2016-06-07 00:00 +0200
                Re: [PATCH V3 8/9] cpufreq: Keep policy->freq_table sorted in  ascending order Viresh Kumar <viresh.kumar@linaro.org> - 2016-06-07 06:30 +0200
                Re: [PATCH V3 8/9] cpufreq: Keep policy->freq_table sorted in ascending order "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2016-06-08 02:40 +0200
                Re: [PATCH V3 8/9] cpufreq: Keep policy->freq_table sorted in  ascending order Viresh Kumar <viresh.kumar@linaro.org> - 2016-06-08 05:50 +0200

csiph-web