cpufreq: Introduce cpufreq_table_validate_and_show()
Subsystems (7)
Viresh Kumar
maintainercover cpufreq: Introduce cpufreq_table_validate_and_show()
This is actually part of a bigger patchset which will change declaration of cpufreq_driver->target() to include index instead of target_freq and relation and hence cpufreq drivers wouldn't require to cpufreq_frequency_table_target() anymore.
Almost every cpufreq driver is required to validate its frequency table with:cpufreq_frequency_table_cpuinfo() and then expose it to cpufreq core with:cpufreq_frequency_table_get_attr().
This patch creates another helper routine cpufreq_table_validate_and_show() that will do both these steps in a single call and will return 0 for success, error otherwise.
This also fixes potential bugs in cpufreq drivers where people have called cpufreq_frequency_table_get_attr() before calling cpufreq_frequency_table_cpuinfo(), as the later may fail.
Viresh Kumar (35):
cpufreq: Add new helper cpufreq_table_validate_and_show()
cpufreq: pxa: call cpufreq_frequency_table_get_attr()
cpufreq: s3cx4xx: call cpufreq_frequency_table_get_attr()
cpufreq: sparc: call cpufreq_frequency_table_get_attr()
cpufreq: acpi-cpufreq: use cpufreq_table_validate_and_show()
cpufreq: arm_big_little: use cpufreq_table_validate_and_show()
cpufreq: blackfin: use cpufreq_table_validate_and_show()
cpufreq: cpufreq-cpu0: use cpufreq_table_validate_and_show()
cpufreq: cris: use cpufreq_table_validate_and_show()
cpufreq: davinci: use cpufreq_table_validate_and_show()
cpufreq: dbx500: use cpufreq_table_validate_and_show()
cpufreq: e_powersaver: use cpufreq_table_validate_and_show()
cpufreq: elanfreq: use cpufreq_table_validate_and_show()
cpufreq: exynos: use cpufreq_table_validate_and_show()
cpufreq: ia64-acpi: use cpufreq_table_validate_and_show()
cpufreq: imx6q: use cpufreq_table_validate_and_show()
cpufreq: kirkwood: use cpufreq_table_validate_and_show()
cpufreq: longhaul: use cpufreq_table_validate_and_show()
cpufreq: loongson2: use cpufreq_table_validate_and_show()
cpufreq: maple: use cpufreq_table_validate_and_show()
cpufreq: omap: use cpufreq_table_validate_and_show()
cpufreq: p4-clockmod: use cpufreq_table_validate_and_show()
cpufreq: pasemi: use cpufreq_table_validate_and_show()
cpufreq: pmac: use cpufreq_table_validate_and_show()
cpufreq: powernow: use cpufreq_table_validate_and_show()
cpufreq: ppc: use cpufreq_table_validate_and_show()
cpufreq: pxa: use cpufreq_table_validate_and_show()
cpufreq: s3cx4xx: use cpufreq_table_validate_and_show()
cpufreq: s5pv210: use cpufreq_table_validate_and_show()
cpufreq: sc520: use cpufreq_table_validate_and_show()
cpufreq: sh: use cpufreq_table_validate_and_show()
cpufreq: sparc: use cpufreq_table_validate_and_show()
cpufreq: spear: use cpufreq_table_validate_and_show()
cpufreq: speedstep: use cpufreq_table_validate_and_show()
cpufreq: tegra: use cpufreq_table_validate_and_show()
drivers/cpufreq/acpi-cpufreq.c | 4 +--- drivers/cpufreq/arm_big_little.c | 4 +--- drivers/cpufreq/blackfin-cpufreq.c | 3 +-- drivers/cpufreq/cpufreq-cpu0.c | 4 +--- drivers/cpufreq/cris-artpec3-cpufreq.c | 10 +--------- drivers/cpufreq/cris-etraxfs-cpufreq.c | 10 +--------- drivers/cpufreq/davinci-cpufreq.c | 6 ++---- drivers/cpufreq/dbx500-cpufreq.c | 6 ++---- drivers/cpufreq/e_powersaver.c | 3 +-- drivers/cpufreq/elanfreq.c | 8 +------- drivers/cpufreq/exynos-cpufreq.c | 4 +--- drivers/cpufreq/exynos5440-cpufreq.c | 4 +--- drivers/cpufreq/freq_table.c | 12 ++++++++++++ drivers/cpufreq/ia64-acpi-cpufreq.c | 4 +--- drivers/cpufreq/imx6q-cpufreq.c | 3 +-- drivers/cpufreq/kirkwood-cpufreq.c | 10 +--------- drivers/cpufreq/longhaul.c | 8 +------- drivers/cpufreq/loongson2_cpufreq.c | 5 +---- drivers/cpufreq/maple-cpufreq.c | 4 +--- drivers/cpufreq/omap-cpufreq.c | 4 +--- drivers/cpufreq/p4-clockmod.c | 3 +-- drivers/cpufreq/pasemi-cpufreq.c | 4 +--- drivers/cpufreq/pmac32-cpufreq.c | 3 +-- drivers/cpufreq/pmac64-cpufreq.c | 4 +--- drivers/cpufreq/powernow-k6.c | 9 +-------- drivers/cpufreq/powernow-k7.c | 4 +--- drivers/cpufreq/powernow-k8.c | 4 +--- drivers/cpufreq/ppc-corenet-cpufreq.c | 3 +-- drivers/cpufreq/ppc_cbe_cpufreq.c | 4 +--- drivers/cpufreq/pxa2xx-cpufreq.c | 8 +++++--- drivers/cpufreq/pxa3xx-cpufreq.c | 2 +- drivers/cpufreq/s3c2416-cpufreq.c | 4 +--- drivers/cpufreq/s3c24xx-cpufreq.c | 2 +- drivers/cpufreq/s3c64xx-cpufreq.c | 2 +- drivers/cpufreq/s5pv210-cpufreq.c | 4 +--- drivers/cpufreq/sc520_freq.c | 9 +-------- drivers/cpufreq/sh-cpufreq.c | 6 +++--- drivers/cpufreq/sparc-us2e-cpufreq.c | 2 +- drivers/cpufreq/sparc-us3-cpufreq.c | 2 +- drivers/cpufreq/spear-cpufreq.c | 5 ++--- drivers/cpufreq/speedstep-centrino.c | 10 +--------- drivers/cpufreq/speedstep-ich.c | 9 +-------- drivers/cpufreq/speedstep-smi.c | 8 +------- drivers/cpufreq/tegra-cpufreq.c | 4 +--- include/linux/cpufreq.h | 2 ++ 45 files changed, 66 insertions(+), 167 deletions(-)
Signature · 1 line
1.7.12.rc2.18.g61b472e
Viresh Kumar
maintainerPATCH 1/35 cpufreq: Add new helper cpufreq_table_validate_and_show()
Almost every cpufreq driver is required to validate its frequency table with:cpufreq_frequency_table_cpuinfo() and then expose it to cpufreq core with:cpufreq_frequency_table_get_attr().
This patch creates another helper routine cpufreq_table_validate_and_show() that will do both these steps in a single call and will return 0 for success, error otherwise.
This also fixes potential bugs in cpufreq drivers where people have called cpufreq_frequency_table_get_attr() before calling cpufreq_frequency_table_cpuinfo(), as the later may fail.
--- drivers/cpufreq/freq_table.c | 12 ++++++++++++ include/linux/cpufreq.h | 2 ++ 2 files changed, 14 insertions(+)
drivers/cpufreq/freq_table.c +12 -0
@@ -219,6 +219,18 @@ void cpufreq_frequency_table_put_attr(unsigned int cpu) }EXPORT_SYMBOL_GPL (cpufreq_frequency_table_put_attr); +int cpufreq_table_validate_and_show (struct cpufreq_policy *policy, +struct cpufreq_frequency_table *table) +{ +int ret =cpufreq_frequency_table_cpuinfo (policy, table); + +if (!ret) +cpufreq_frequency_table_get_attr (table, policy->cpu); + +return ret; +} +EXPORT_SYMBOL_GPL (cpufreq_table_validate_and_show); +void cpufreq_frequency_table_update_policy_cpu (struct cpufreq_policy *policy) { pr_debug("Updating show_table for new_cpu %u from last_cpu %u\n",
include/linux/cpufreq.h +2 -0
@@ -411,5 +411,7 @@ extern struct freq_attr cpufreq_freq_attr_scaling_available_freqs;void cpufreq_frequency_table_get_attr (struct cpufreq_frequency_table *table,unsigned int cpu);void cpufreq_frequency_table_put_attr (unsigned int cpu); +int cpufreq_table_validate_and_show (struct cpufreq_policy *policy, +struct cpufreq_frequency_table *table);#endif /* _LINUX_CPUFREQ_H */
Signature · 1 line
1.7.12.rc2.18.g61b472e
Viresh Kumar
maintainerPATCH 2/35 cpufreq: pxa: call cpufreq_frequency_table_get_attr()
In reply to Viresh KumarThis exposes frequency table of driver to cpufreq core and is required for core to guess what the index for a target frequency is, when it calls cpufreq_frequency_table_target(). And so this driver needs to expose it.
--- drivers/cpufreq/pxa2xx-cpufreq.c | 6 +++++- drivers/cpufreq/pxa3xx-cpufreq.c | 8 ++++++-- 2 files changed, 11 insertions(+), 3 deletions(-)
drivers/cpufreq/pxa2xx-cpufreq.c +5 -1
@@ -453,10 +453,14 @@ static int pxa_cpufreq_init(struct cpufreq_policy *policy)find_freq_tables (&pxa255_freq_table, &pxa255_freqs);pr_info ("PXA255 cpufreq using %s frequency table\n" , pxa255_turbo_table ?"turbo" :"run" ); +cpufreq_frequency_table_cpuinfo (policy, pxa255_freq_table); +cpufreq_frequency_table_get_attr (pxa255_freq_table, policy->cpu); } -else if (cpu_is_pxa27x ()) +else if (cpu_is_pxa27x ()) {cpufreq_frequency_table_cpuinfo (policy, pxa27x_freq_table); +cpufreq_frequency_table_get_attr (pxa27x_freq_table, policy->cpu); + }printk (KERN_INFO "PXA CPU frequency change support initialized\n" );
drivers/cpufreq/pxa3xx-cpufreq.c +6 -2
@@ -91,7 +91,7 @@ static int setup_freqs_table(struct cpufreq_policy *policy, struct pxa3xx_freq_info *freqs, int num) {struct cpufreq_frequency_table *table; -int i; +int i, ret; table =kzalloc ((num +1 ) *sizeof (*table),GFP_KERNEL );if (table ==NULL )
@@ -108,7 +108,11 @@ static int setup_freqs_table(struct cpufreq_policy *policy, pxa3xx_freqs_num = num; pxa3xx_freqs_table = table; -return cpufreq_frequency_table_cpuinfo (policy, table); + ret =cpufreq_frequency_table_cpuinfo (policy, table); +if (!ret) +cpufreq_frequency_table_get_attr (table, policy->cpu); + +return ret; }static void __update_core_freq (struct pxa3xx_freq_info *info)
Signature · 1 line
1.7.12.rc2.18.g61b472e
Viresh Kumar
maintainerPATCH 3/35 cpufreq: s3cx4xx: call cpufreq_frequency_table_get_attr()
In reply to Viresh KumarThis exposes frequency table of driver to cpufreq core and is required for core to guess what the index for a target frequency is, when it calls cpufreq_frequency_table_target(). And so this driver needs to expose it.
--- drivers/cpufreq/s3c24xx-cpufreq.c | 4 +++- drivers/cpufreq/s3c64xx-cpufreq.c | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-)
drivers/cpufreq/s3c24xx-cpufreq.c +3 -1
@@ -386,8 +386,10 @@ static int s3c_cpufreq_init(struct cpufreq_policy *policy)/* feed the latency information from the cpu driver */ policy->cpuinfo.transition_latency = cpu_cur.info->latency; -if (ftab) +if (ftab) {cpufreq_frequency_table_cpuinfo (policy, ftab); +cpufreq_frequency_table_get_attr (ftab, policy->cpu); + }return 0 ; }
drivers/cpufreq/s3c64xx-cpufreq.c +3 -0
@@ -257,6 +257,9 @@ static int s3c64xx_cpufreq_driver_init(struct cpufreq_policy *policy) ret);regulator_put (vddarm);clk_put (armclk); + }else { +cpufreq_frequency_table_get_attr (s3c64xx_freq_table, + policy->cpu); }return ret;
Signature · 1 line
1.7.12.rc2.18.g61b472e
Viresh Kumar
maintainerPATCH 4/35 cpufreq: sparc: call cpufreq_frequency_table_get_attr()
In reply to Viresh KumarThis exposes frequency table of driver to cpufreq core and is required for core to guess what the index for a target frequency is, when it calls cpufreq_frequency_table_target(). And so this driver needs to expose it.
--- drivers/cpufreq/sparc-us2e-cpufreq.c | 6 +++++- drivers/cpufreq/sparc-us3-cpufreq.c | 7 ++++++- 2 files changed, 11 insertions(+), 2 deletions(-)
drivers/cpufreq/sparc-us2e-cpufreq.c +5 -1
@@ -307,6 +307,7 @@ static int __init us2e_freq_cpu_init(struct cpufreq_policy *policy)unsigned long clock_tick =sparc64_get_clock_tick (cpu) /1000 ;struct cpufreq_frequency_table *table = &us2e_freq_table[cpu].table[0 ]; +int ret; table[0 ].driver_data =0 ; table[0 ].frequency = clock_tick /1 ;
@@ -324,7 +325,10 @@ static int __init us2e_freq_cpu_init(struct cpufreq_policy *policy) policy->cpuinfo.transition_latency =0 ; policy->cur = clock_tick; -return cpufreq_frequency_table_cpuinfo (policy, table); + ret =cpufreq_frequency_table_cpuinfo (policy, table); +if (!ret) +cpufreq_frequency_table_get_attr (table, policy->cpu); +return ret; }static int us2e_freq_cpu_exit (struct cpufreq_policy *policy)
drivers/cpufreq/sparc-us3-cpufreq.c +6 -1
@@ -168,6 +168,7 @@ static int __init us3_freq_cpu_init(struct cpufreq_policy *policy)unsigned long clock_tick =sparc64_get_clock_tick (cpu) /1000 ;struct cpufreq_frequency_table *table = &us3_freq_table[cpu].table[0 ]; +int ret; table[0 ].driver_data =0 ; table[0 ].frequency = clock_tick /1 ;
@@ -181,7 +182,11 @@ static int __init us3_freq_cpu_init(struct cpufreq_policy *policy) policy->cpuinfo.transition_latency =0 ; policy->cur = clock_tick; -return cpufreq_frequency_table_cpuinfo (policy, table); + ret =cpufreq_frequency_table_cpuinfo (policy, table); +if (!ret) +cpufreq_frequency_table_get_attr (table, policy->cpu); + +return ret; }static int us3_freq_cpu_exit (struct cpufreq_policy *policy)
Signature · 1 line
1.7.12.rc2.18.g61b472e
Viresh Kumar
maintainerPATCH 5/35 cpufreq: acpi-cpufreq: use cpufreq_table_validate_and_show()
In reply to Viresh KumarLets use cpufreq_table_validate_and_show() instead of calling cpufreq_frequency_table_cpuinfo() and cpufreq_frequency_table_get_attr().
--- drivers/cpufreq/acpi-cpufreq.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/cpufreq/acpi-cpufreq.c +1 -3
@@ -837,7 +837,7 @@ static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy) data->freq_table[valid_states].frequency =CPUFREQ_TABLE_END ; perf->state =0 ; - result =cpufreq_frequency_table_cpuinfo (policy, data->freq_table); + result =cpufreq_table_validate_and_show (policy, data->freq_table);if (result) goto err_freqfree;
@@ -868,8 +868,6 @@ static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy) (u32 ) perf->states[i].power, (u32) perf->states[i].transition_latency); -cpufreq_frequency_table_get_attr (data->freq_table, policy->cpu); -/* * the first call to ->target() should result in us actually * writing something to the appropriate registers.
Signature · 1 line
1.7.12.rc2.18.g61b472e
Viresh Kumar
maintainerPATCH 6/35 cpufreq: arm_big_little: use cpufreq_table_validate_and_show()
In reply to Viresh KumarLets use cpufreq_table_validate_and_show() instead of calling cpufreq_frequency_table_cpuinfo() and cpufreq_frequency_table_get_attr().
--- drivers/cpufreq/arm_big_little.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/cpufreq/arm_big_little.c +1 -3
@@ -165,7 +165,7 @@ static int bL_cpufreq_init(struct cpufreq_policy *policy)if (ret)return ret; - ret =cpufreq_frequency_table_cpuinfo (policy, freq_table[cur_cluster]); + ret =cpufreq_table_validate_and_show (policy, freq_table[cur_cluster]);if (ret) {dev_err (cpu_dev,"CPU %d, cluster: %d invalid freq table\n" , policy->cpu, cur_cluster);
@@ -173,8 +173,6 @@ static int bL_cpufreq_init(struct cpufreq_policy *policy)return ret; } -cpufreq_frequency_table_get_attr (freq_table[cur_cluster], policy->cpu); -if (arm_bL_ops->get_transition_latency) policy->cpuinfo.transition_latency = arm_bL_ops->get_transition_latency (cpu_dev);
Signature · 1 line
1.7.12.rc2.18.g61b472e
Viresh Kumar
maintainerPATCH 7/35 cpufreq: blackfin: use cpufreq_table_validate_and_show()
In reply to Viresh KumarLets use cpufreq_table_validate_and_show() instead of calling cpufreq_frequency_table_cpuinfo() and cpufreq_frequency_table_get_attr().
--- drivers/cpufreq/blackfin-cpufreq.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/cpufreq/blackfin-cpufreq.c +1 -2
@@ -210,8 +210,7 @@ static int __bfin_cpu_init(struct cpufreq_policy *policy) policy->cpuinfo.transition_latency =50000 ;/* 50us assumed */ policy->cur = cclk; -cpufreq_frequency_table_get_attr (bfin_freq_table, policy->cpu); -return cpufreq_frequency_table_cpuinfo (policy, bfin_freq_table); +return cpufreq_table_validate_and_show (policy, bfin_freq_table); }static struct freq_attr *bfin_freq_attr[] = {
Signature · 1 line
1.7.12.rc2.18.g61b472e
Viresh Kumar
maintainerPATCH 8/35 cpufreq: cpufreq-cpu0: use cpufreq_table_validate_and_show()
In reply to Viresh KumarLets use cpufreq_table_validate_and_show() instead of calling cpufreq_frequency_table_cpuinfo() and cpufreq_frequency_table_get_attr().
--- drivers/cpufreq/cpufreq-cpu0.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/cpufreq/cpufreq-cpu0.c +1 -3
@@ -128,7 +128,7 @@ static int cpu0_cpufreq_init(struct cpufreq_policy *policy) {int ret; - ret =cpufreq_frequency_table_cpuinfo (policy, freq_table); + ret =cpufreq_table_validate_and_show (policy, freq_table);if (ret) {pr_err ("invalid frequency table: %d\n" , ret);return ret;
@@ -144,8 +144,6 @@ static int cpu0_cpufreq_init(struct cpufreq_policy *policy)*/ cpumask_setall (policy->cpus); -cpufreq_frequency_table_get_attr (freq_table, policy->cpu); -return 0 ; }
Signature · 1 line
1.7.12.rc2.18.g61b472e
Viresh Kumar
maintainerPATCH 9/35 cpufreq: cris: use cpufreq_table_validate_and_show()
In reply to Viresh KumarLets use cpufreq_table_validate_and_show() instead of calling cpufreq_frequency_table_cpuinfo() and cpufreq_frequency_table_get_attr().
--- drivers/cpufreq/cris-artpec3-cpufreq.c | 10 +--------- drivers/cpufreq/cris-etraxfs-cpufreq.c | 10 +--------- 2 files changed, 2 insertions(+), 18 deletions(-)
drivers/cpufreq/cris-artpec3-cpufreq.c +1 -9
@@ -76,19 +76,11 @@ static int cris_freq_target(struct cpufreq_policy *policy,static int cris_freq_cpu_init (struct cpufreq_policy *policy) { -int result; -/* cpuinfo and default policy values */ policy->cpuinfo.transition_latency =1000000 ;/* 1ms */ policy->cur =cris_freq_get_cpu_frequency (0 ); - result =cpufreq_frequency_table_cpuinfo (policy, cris_freq_table); -if (result) -return (result); - -cpufreq_frequency_table_get_attr (cris_freq_table, policy->cpu); - -return 0 ; +return cpufreq_table_validate_and_show (policy, cris_freq_table); }
drivers/cpufreq/cris-etraxfs-cpufreq.c +1 -9
@@ -75,19 +75,11 @@ static int cris_freq_target(struct cpufreq_policy *policy,static int cris_freq_cpu_init (struct cpufreq_policy *policy) { -int result; -/* cpuinfo and default policy values */ policy->cpuinfo.transition_latency =1000000 ;/* 1ms */ policy->cur =cris_freq_get_cpu_frequency (0 ); - result =cpufreq_frequency_table_cpuinfo (policy, cris_freq_table); -if (result) -return (result); - -cpufreq_frequency_table_get_attr (cris_freq_table, policy->cpu); - -return 0 ; +return cpufreq_table_validate_and_show (policy, cris_freq_table); }static int cris_freq_cpu_exit (struct cpufreq_policy *policy)
Signature · 1 line
1.7.12.rc2.18.g61b472e
Viresh Kumar
maintainerPATCH 10/35 cpufreq: davinci: use cpufreq_table_validate_and_show()
In reply to Viresh KumarLets use cpufreq_table_validate_and_show() instead of calling cpufreq_frequency_table_cpuinfo() and cpufreq_frequency_table_get_attr().
--- drivers/cpufreq/davinci-cpufreq.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/cpufreq/davinci-cpufreq.c +2 -4
@@ -140,15 +140,13 @@ static int davinci_cpu_init(struct cpufreq_policy *policy) policy->cur =davinci_getspeed (0 ); - result =cpufreq_frequency_table_cpuinfo (policy, freq_table); + result =cpufreq_table_validate_and_show (policy, freq_table);if (result) { -pr_err ("%s: cpufreq_frequency_table_cpuinfo() failed" , +pr_err ("%s: cpufreq_table_validate_and_show() failed" , __func__);return result; } -cpufreq_frequency_table_get_attr (freq_table, policy->cpu); -/* * Time measurement across the target() function yields ~1500-1800us * time taken with no drivers on notification list.
Signature · 1 line
1.7.12.rc2.18.g61b472e
Viresh Kumar
maintainerPATCH 11/35 cpufreq: dbx500: use cpufreq_table_validate_and_show()
In reply to Viresh KumarLets use cpufreq_table_validate_and_show() instead of calling cpufreq_frequency_table_cpuinfo() and cpufreq_frequency_table_get_attr().
--- drivers/cpufreq/dbx500-cpufreq.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/cpufreq/dbx500-cpufreq.c +2 -4
@@ -87,10 +87,8 @@ static int dbx500_cpufreq_init(struct cpufreq_policy *policy)int res;/* get policy fields based on the table */ - res =cpufreq_frequency_table_cpuinfo (policy, freq_table); -if (!res) -cpufreq_frequency_table_get_attr (freq_table, policy->cpu); -else { + res =cpufreq_table_validate_and_show (policy, freq_table); +if (res)pr_err ("dbx500-cpufreq: Failed to read policy table\n" );return res; }
Signature · 1 line
1.7.12.rc2.18.g61b472e
Viresh Kumar
maintainerPATCH 12/35 cpufreq: e_powersaver: use cpufreq_table_validate_and_show()
In reply to Viresh KumarLets use cpufreq_table_validate_and_show() instead of calling cpufreq_frequency_table_cpuinfo() and cpufreq_frequency_table_get_attr().
--- drivers/cpufreq/e_powersaver.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/cpufreq/e_powersaver.c +1 -2
@@ -403,13 +403,12 @@ static int eps_cpu_init(struct cpufreq_policy *policy) policy->cpuinfo.transition_latency =140000 ;/* 844mV -> 700mV in ns */ policy->cur = fsb * current_multiplier; - ret =cpufreq_frequency_table_cpuinfo (policy, ¢aur->freq_table[0 ]); + ret =cpufreq_table_validate_and_show (policy, ¢aur->freq_table[0 ]);if (ret) {kfree (centaur);return ret; } -cpufreq_frequency_table_get_attr (¢aur->freq_table[0 ], policy->cpu);return 0 ; }
Signature · 1 line
1.7.12.rc2.18.g61b472e
Viresh Kumar
maintainerPATCH 13/35 cpufreq: elanfreq: use cpufreq_table_validate_and_show()
In reply to Viresh KumarLets use cpufreq_table_validate_and_show() instead of calling cpufreq_frequency_table_cpuinfo() and cpufreq_frequency_table_get_attr().
--- drivers/cpufreq/elanfreq.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-)
drivers/cpufreq/elanfreq.c +1 -7
@@ -202,7 +202,6 @@ static int elanfreq_cpu_init(struct cpufreq_policy *policy) {struct cpuinfo_x86 *c = &cpu_data (0 );unsigned int i; -int result;/* capability check */ if ((c->x86_vendor != X86_VENDOR_AMD) ||
@@ -223,12 +222,7 @@ static int elanfreq_cpu_init(struct cpufreq_policy *policy) policy->cpuinfo.transition_latency =CPUFREQ_ETERNAL ; policy->cur =elanfreq_get_cpu_frequency (0 ); - result =cpufreq_frequency_table_cpuinfo (policy, elanfreq_table); -if (result) -return result; - -cpufreq_frequency_table_get_attr (elanfreq_table, policy->cpu); -return 0 ; +return cpufreq_table_validate_and_show (policy, elanfreq_table); }
Signature · 1 line
1.7.12.rc2.18.g61b472e
Viresh Kumar
maintainerPATCH 14/35 cpufreq: exynos: use cpufreq_table_validate_and_show()
In reply to Viresh KumarLets use cpufreq_table_validate_and_show() instead of calling cpufreq_frequency_table_cpuinfo() and cpufreq_frequency_table_get_attr().
--- drivers/cpufreq/exynos-cpufreq.c | 4 +--- drivers/cpufreq/exynos5440-cpufreq.c | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-)
drivers/cpufreq/exynos-cpufreq.c +1 -3
@@ -249,14 +249,12 @@ static int exynos_cpufreq_cpu_init(struct cpufreq_policy *policy) { policy->cur = policy->min = policy->max =exynos_getspeed (policy->cpu); -cpufreq_frequency_table_get_attr (exynos_info->freq_table, policy->cpu); -/* set the transition latency value */ policy->cpuinfo.transition_latency =100000 ;cpumask_setall (policy->cpus); -return cpufreq_frequency_table_cpuinfo (policy, exynos_info->freq_table); +return cpufreq_table_validate_and_show (policy, exynos_info->freq_table); }static int exynos_cpufreq_cpu_exit (struct cpufreq_policy *policy)
drivers/cpufreq/exynos5440-cpufreq.c +1 -3
@@ -323,7 +323,7 @@ static int exynos_cpufreq_cpu_init(struct cpufreq_policy *policy) {int ret; - ret =cpufreq_frequency_table_cpuinfo (policy, dvfs_info->freq_table); + ret =cpufreq_table_validate_and_show (policy, dvfs_info->freq_table);if (ret) {dev_err (dvfs_info->dev,"Invalid frequency table: %d\n" , ret);return ret;
@@ -333,8 +333,6 @@ static int exynos_cpufreq_cpu_init(struct cpufreq_policy *policy) policy->cpuinfo.transition_latency = dvfs_info->latency;cpumask_setall (policy->cpus); -cpufreq_frequency_table_get_attr (dvfs_info->freq_table, policy->cpu); -return 0 ; }
Signature · 1 line
1.7.12.rc2.18.g61b472e
Viresh Kumar
maintainerPATCH 15/35 cpufreq: ia64-acpi: use cpufreq_table_validate_and_show()
In reply to Viresh KumarLets use cpufreq_table_validate_and_show() instead of calling cpufreq_frequency_table_cpuinfo() and cpufreq_frequency_table_get_attr().
--- drivers/cpufreq/ia64-acpi-cpufreq.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/cpufreq/ia64-acpi-cpufreq.c +1 -3
@@ -335,7 +335,7 @@ acpi_cpufreq_cpu_init ( } } - result =cpufreq_frequency_table_cpuinfo (policy, data->freq_table); + result =cpufreq_table_validate_and_show (policy, data->freq_table);if (result) { goto err_freqfree; }
@@ -356,8 +356,6 @@ acpi_cpufreq_cpu_init ( (u32 ) data->acpi_data.states[i].status, (u32) data->acpi_data.states[i].control); -cpufreq_frequency_table_get_attr (data->freq_table, policy->cpu); -/* the first call to ->target() should result in us actually * writing something to the appropriate registers. */ data->resume =1 ;
Signature · 1 line
1.7.12.rc2.18.g61b472e
Viresh Kumar
maintainerPATCH 16/35 cpufreq: imx6q: use cpufreq_table_validate_and_show()
In reply to Viresh KumarLets use cpufreq_table_validate_and_show() instead of calling cpufreq_frequency_table_cpuinfo() and cpufreq_frequency_table_get_attr().
--- drivers/cpufreq/imx6q-cpufreq.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/cpufreq/imx6q-cpufreq.c +1 -2
@@ -177,7 +177,7 @@ static int imx6q_cpufreq_init(struct cpufreq_policy *policy) {int ret; - ret =cpufreq_frequency_table_cpuinfo (policy, freq_table); + ret =cpufreq_table_validate_and_show (policy, freq_table);if (ret) {dev_err (cpu_dev,"invalid frequency table: %d\n" , ret);return ret;
@@ -186,7 +186,6 @@ static int imx6q_cpufreq_init(struct cpufreq_policy *policy) policy->cpuinfo.transition_latency = transition_latency; policy->cur =clk_get_rate (arm_clk) /1000 ;cpumask_setall (policy->cpus); -cpufreq_frequency_table_get_attr (freq_table, policy->cpu);return 0 ; }
Signature · 1 line
1.7.12.rc2.18.g61b472e
Viresh Kumar
maintainerPATCH 17/35 cpufreq: kirkwood: use cpufreq_table_validate_and_show()
In reply to Viresh KumarLets use cpufreq_table_validate_and_show() instead of calling cpufreq_frequency_table_cpuinfo() and cpufreq_frequency_table_get_attr().
--- drivers/cpufreq/kirkwood-cpufreq.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-)
drivers/cpufreq/kirkwood-cpufreq.c +1 -9
@@ -125,19 +125,11 @@ static int kirkwood_cpufreq_target(struct cpufreq_policy *policy,/* Module init and exit code */ static int kirkwood_cpufreq_cpu_init (struct cpufreq_policy *policy) { -int result; -/* cpuinfo and default policy values */ policy->cpuinfo.transition_latency =5000 ;/* 5uS */ policy->cur =kirkwood_cpufreq_get_cpu_frequency (0 ); - result =cpufreq_frequency_table_cpuinfo (policy, kirkwood_freq_table); -if (result) -return result; - -cpufreq_frequency_table_get_attr (kirkwood_freq_table, policy->cpu); - -return 0 ; +return cpufreq_table_validate_and_show (policy, kirkwood_freq_table); }static int kirkwood_cpufreq_cpu_exit (struct cpufreq_policy *policy)
Signature · 1 line
1.7.12.rc2.18.g61b472e
Viresh Kumar
maintainerPATCH 18/35 cpufreq: longhaul: use cpufreq_table_validate_and_show()
In reply to Viresh KumarLets use cpufreq_table_validate_and_show() instead of calling cpufreq_frequency_table_cpuinfo() and cpufreq_frequency_table_get_attr().
--- drivers/cpufreq/longhaul.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-)
drivers/cpufreq/longhaul.c +1 -7
@@ -921,13 +921,7 @@ static int longhaul_cpu_init(struct cpufreq_policy *policy) policy->cpuinfo.transition_latency =200000 ;/* nsec */ policy->cur =calc_speed (longhaul_get_cpu_mult ()); - ret =cpufreq_frequency_table_cpuinfo (policy, longhaul_table); -if (ret) -return ret; - -cpufreq_frequency_table_get_attr (longhaul_table, policy->cpu); - -return 0 ; +return cpufreq_table_validate_and_show (policy, longhaul_table); }static int longhaul_cpu_exit (struct cpufreq_policy *policy)
Signature · 1 line
1.7.12.rc2.18.g61b472e
Viresh Kumar
maintainerPATCH 19/35 cpufreq: loongson2: use cpufreq_table_validate_and_show()
In reply to Viresh KumarLets use cpufreq_table_validate_and_show() instead of calling cpufreq_frequency_table_cpuinfo() and cpufreq_frequency_table_get_attr().
--- drivers/cpufreq/loongson2_cpufreq.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/cpufreq/loongson2_cpufreq.c +1 -4
@@ -133,10 +133,7 @@ static int loongson2_cpufreq_cpu_init(struct cpufreq_policy *policy) policy->cur =loongson2_cpufreq_get (policy->cpu); -cpufreq_frequency_table_get_attr (&loongson2_clockmod_table[0 ], - policy->cpu); - -return cpufreq_frequency_table_cpuinfo (policy, +return cpufreq_table_validate_and_show (policy, &loongson2_clockmod_table[0 ]); }
Signature · 1 line
1.7.12.rc2.18.g61b472e
Viresh Kumar
maintainerPATCH 20/35 cpufreq: maple: use cpufreq_table_validate_and_show()
In reply to Viresh KumarLets use cpufreq_table_validate_and_show() instead of calling cpufreq_frequency_table_cpuinfo() and cpufreq_frequency_table_get_attr().
--- drivers/cpufreq/maple-cpufreq.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/cpufreq/maple-cpufreq.c +1 -3
@@ -181,10 +181,8 @@ static int maple_cpufreq_cpu_init(struct cpufreq_policy *policy)* cpufreq core if in the secondary policy we tell it that * it actually must be one policy together with all others. */ cpumask_setall (policy->cpus); -cpufreq_frequency_table_get_attr (maple_cpu_freqs, policy->cpu); -return cpufreq_frequency_table_cpuinfo (policy, - maple_cpu_freqs); +return cpufreq_table_validate_and_show (policy, maple_cpu_freqs); }
Signature · 1 line
1.7.12.rc2.18.g61b472e
Viresh Kumar
maintainerPATCH 21/35 cpufreq: omap: use cpufreq_table_validate_and_show()
In reply to Viresh KumarLets use cpufreq_table_validate_and_show() instead of calling cpufreq_frequency_table_cpuinfo() and cpufreq_frequency_table_get_attr().
--- drivers/cpufreq/omap-cpufreq.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/cpufreq/omap-cpufreq.c +1 -3
@@ -191,12 +191,10 @@ static int omap_cpu_init(struct cpufreq_policy *policy)atomic_inc_return (&freq_table_users); - result =cpufreq_frequency_table_cpuinfo (policy, freq_table); + result =cpufreq_table_validate_and_show (policy, freq_table);if (result) goto fail_table; -cpufreq_frequency_table_get_attr (freq_table, policy->cpu); - policy->cur =omap_getspeed (policy->cpu);/*
Signature · 1 line
1.7.12.rc2.18.g61b472e
Viresh Kumar
maintainerPATCH 22/35 cpufreq: p4-clockmod: use cpufreq_table_validate_and_show()
In reply to Viresh KumarLets use cpufreq_table_validate_and_show() instead of calling cpufreq_frequency_table_cpuinfo() and cpufreq_frequency_table_get_attr().
--- drivers/cpufreq/p4-clockmod.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/cpufreq/p4-clockmod.c +1 -2
@@ -230,7 +230,6 @@ static int cpufreq_p4_cpu_init(struct cpufreq_policy *policy)else p4clockmod_table[i].frequency = (stock_freq * i)/8 ; } -cpufreq_frequency_table_get_attr (p4clockmod_table, policy->cpu);/* cpuinfo and default policy values */
@@ -239,7 +238,7 @@ static int cpufreq_p4_cpu_init(struct cpufreq_policy *policy) policy->cpuinfo.transition_latency =10000001 ; policy->cur = stock_freq; -return cpufreq_frequency_table_cpuinfo (policy, &p4clockmod_table[0 ]); +return cpufreq_table_validate_and_show (policy, &p4clockmod_table[0 ]); }
Signature · 1 line
1.7.12.rc2.18.g61b472e
Viresh Kumar
maintainerPATCH 23/35 cpufreq: pasemi: use cpufreq_table_validate_and_show()
In reply to Viresh KumarLets use cpufreq_table_validate_and_show() instead of calling cpufreq_frequency_table_cpuinfo() and cpufreq_frequency_table_get_attr().
--- drivers/cpufreq/pasemi-cpufreq.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/cpufreq/pasemi-cpufreq.c +1 -3
@@ -219,12 +219,10 @@ static int pas_cpufreq_cpu_init(struct cpufreq_policy *policy) ppc_proc_freq = policy->cur *1000ul ; -cpufreq_frequency_table_get_attr (pas_freqs, policy->cpu); -/* this ensures that policy->cpuinfo_min and policy->cpuinfo_max * are set correctly */ -return cpufreq_frequency_table_cpuinfo (policy, pas_freqs); +return cpufreq_table_validate_and_show (policy, pas_freqs); out_unmap_sdcpwr:iounmap (sdcpwr_mapbase);
Signature · 1 line
1.7.12.rc2.18.g61b472e
Viresh Kumar
maintainerPATCH 24/35 cpufreq: pmac: use cpufreq_table_validate_and_show()
In reply to Viresh KumarLets use cpufreq_table_validate_and_show() instead of calling cpufreq_frequency_table_cpuinfo() and cpufreq_frequency_table_get_attr().
--- drivers/cpufreq/pmac32-cpufreq.c | 3 +-- drivers/cpufreq/pmac64-cpufreq.c | 4 +--- 2 files changed, 2 insertions(+), 5 deletions(-)
drivers/cpufreq/pmac32-cpufreq.c +1 -2
@@ -407,8 +407,7 @@ static int pmac_cpufreq_cpu_init(struct cpufreq_policy *policy) policy->cpuinfo.transition_latency = transition_latency; policy->cur = cur_freq; -cpufreq_frequency_table_get_attr (pmac_cpu_freqs, policy->cpu); -return cpufreq_frequency_table_cpuinfo (policy, pmac_cpu_freqs); +return cpufreq_table_validate_and_show (policy, pmac_cpu_freqs); }static u32 read_gpio (struct device_node *np)
drivers/cpufreq/pmac64-cpufreq.c +1 -3
@@ -362,10 +362,8 @@ static int g5_cpufreq_cpu_init(struct cpufreq_policy *policy)* cpufreq core if in the secondary policy we tell it that * it actually must be one policy together with all others. */ cpumask_copy (policy->cpus, cpu_online_mask); -cpufreq_frequency_table_get_attr (g5_cpu_freqs, policy->cpu); -return cpufreq_frequency_table_cpuinfo (policy, - g5_cpu_freqs); +return cpufreq_table_validate_and_show (policy, g5_cpu_freqs); }
Signature · 1 line
1.7.12.rc2.18.g61b472e
Viresh Kumar
maintainerPATCH 25/35 cpufreq: powernow: use cpufreq_table_validate_and_show()
In reply to Viresh KumarLets use cpufreq_table_validate_and_show() instead of calling cpufreq_frequency_table_cpuinfo() and cpufreq_frequency_table_get_attr().
--- drivers/cpufreq/powernow-k6.c | 9 +-------- drivers/cpufreq/powernow-k7.c | 4 +--- drivers/cpufreq/powernow-k8.c | 4 +--- 3 files changed, 3 insertions(+), 14 deletions(-)
drivers/cpufreq/powernow-k6.c +1 -8
@@ -145,7 +145,6 @@ static int powernow_k6_target(struct cpufreq_policy *policy,static int powernow_k6_cpu_init (struct cpufreq_policy *policy) {unsigned int i, f; -int result;if (policy->cpu !=0 )return -ENODEV ;
@@ -167,13 +166,7 @@ static int powernow_k6_cpu_init(struct cpufreq_policy *policy) policy->cpuinfo.transition_latency =200000 ; policy->cur = busfreq * max_multiplier; - result =cpufreq_frequency_table_cpuinfo (policy, clock_ratio); -if (result) -return result; - -cpufreq_frequency_table_get_attr (clock_ratio, policy->cpu); - -return 0 ; +return cpufreq_table_validate_and_show (policy, clock_ratio); }
drivers/cpufreq/powernow-k7.c +1 -3
@@ -680,9 +680,7 @@ static int powernow_cpu_init(struct cpufreq_policy *policy) policy->cur =powernow_get (0 ); -cpufreq_frequency_table_get_attr (powernow_table, policy->cpu); - -return cpufreq_frequency_table_cpuinfo (policy, powernow_table); +return cpufreq_table_validate_and_show (policy, powernow_table); }static int powernow_cpu_exit (struct cpufreq_policy *policy)
drivers/cpufreq/powernow-k8.c +1 -3
@@ -1156,7 +1156,7 @@ static int powernowk8_cpu_init(struct cpufreq_policy *pol)pr_debug ("policy current frequency %d kHz\n" , pol->cur);/* min/max the cpu is capable of */ -if (cpufreq_frequency_table_cpuinfo (pol, data->powernow_table)) { +if (cpufreq_table_validate_and_show (pol, data->powernow_table)) { printk(KERN_ERR FW_BUG PFX "invalid powernow_table\n");powernow_k8_cpu_exit_acpi (data);kfree (data->powernow_table);
@@ -1164,8 +1164,6 @@ static int powernowk8_cpu_init(struct cpufreq_policy *pol)return -EINVAL ; } -cpufreq_frequency_table_get_attr (data->powernow_table, pol->cpu); -pr_debug ("cpu_init done, current fid 0x%x, vid 0x%x\n" , data->currfid, data->currvid);
Signature · 1 line
1.7.12.rc2.18.g61b472e
Viresh Kumar
maintainerPATCH 26/35 cpufreq: ppc: use cpufreq_table_validate_and_show()
In reply to Viresh KumarLets use cpufreq_table_validate_and_show() instead of calling cpufreq_frequency_table_cpuinfo() and cpufreq_frequency_table_get_attr().
--- drivers/cpufreq/ppc-corenet-cpufreq.c | 3 +-- drivers/cpufreq/ppc_cbe_cpufreq.c | 4 +--- 2 files changed, 2 insertions(+), 5 deletions(-)
drivers/cpufreq/ppc-corenet-cpufreq.c +1 -2
@@ -202,7 +202,7 @@ static int corenet_cpufreq_cpu_init(struct cpufreq_policy *policy) table[i].frequency =CPUFREQ_TABLE_END ;/* set the min and max frequency properly */ - ret =cpufreq_frequency_table_cpuinfo (policy, table); + ret =cpufreq_table_validate_and_show (policy, table);if (ret) {pr_err ("invalid frequency table: %d\n" , ret); goto err_nomem1;
@@ -219,7 +219,6 @@ static int corenet_cpufreq_cpu_init(struct cpufreq_policy *policy) policy->cpuinfo.transition_latency =CPUFREQ_ETERNAL ; policy->cur =corenet_cpufreq_get_speed (policy->cpu); -cpufreq_frequency_table_get_attr (table, cpu);of_node_put (np);return 0 ;
drivers/cpufreq/ppc_cbe_cpufreq.c +1 -3
@@ -123,11 +123,9 @@ static int cbe_cpufreq_cpu_init(struct cpufreq_policy *policy)cpumask_copy (policy->cpus,cpu_sibling_mask (policy->cpu));#endif -cpufreq_frequency_table_get_attr (cbe_freqs, policy->cpu); -/* this ensures that policy->cpuinfo_min * and policy->cpuinfo_max are set correctly */ -return cpufreq_frequency_table_cpuinfo (policy, cbe_freqs); +return cpufreq_table_validate_and_show (policy, cbe_freqs); }static int cbe_cpufreq_cpu_exit (struct cpufreq_policy *policy)
Signature · 1 line
1.7.12.rc2.18.g61b472e
Viresh Kumar
maintainerPATCH 27/35 cpufreq: pxa: use cpufreq_table_validate_and_show()
In reply to Viresh KumarLets use cpufreq_table_validate_and_show() instead of calling cpufreq_frequency_table_cpuinfo() and cpufreq_frequency_table_get_attr().
--- drivers/cpufreq/pxa2xx-cpufreq.c | 6 ++---- drivers/cpufreq/pxa3xx-cpufreq.c | 8 ++------ 2 files changed, 4 insertions(+), 10 deletions(-)
drivers/cpufreq/pxa2xx-cpufreq.c +2 -4
@@ -454,12 +454,10 @@ static int pxa_cpufreq_init(struct cpufreq_policy *policy)pr_info ("PXA255 cpufreq using %s frequency table\n" , pxa255_turbo_table ?"turbo" :"run" ); -cpufreq_frequency_table_cpuinfo (policy, pxa255_freq_table); -cpufreq_frequency_table_get_attr (pxa255_freq_table, policy->cpu); +cpufreq_table_validate_and_show (policy, pxa255_freq_table); }else if (cpu_is_pxa27x ()) { -cpufreq_frequency_table_cpuinfo (policy, pxa27x_freq_table); -cpufreq_frequency_table_get_attr (pxa27x_freq_table, policy->cpu); +cpufreq_table_validate_and_show (policy, pxa27x_freq_table); }printk (KERN_INFO "PXA CPU frequency change support initialized\n" );
drivers/cpufreq/pxa3xx-cpufreq.c +2 -6
@@ -91,7 +91,7 @@ static int setup_freqs_table(struct cpufreq_policy *policy, struct pxa3xx_freq_info *freqs, int num) {struct cpufreq_frequency_table *table; -int i, ret; +int i; table =kzalloc ((num +1 ) *sizeof (*table),GFP_KERNEL );if (table ==NULL )
@@ -108,11 +108,7 @@ static int setup_freqs_table(struct cpufreq_policy *policy, pxa3xx_freqs_num = num; pxa3xx_freqs_table = table; - ret =cpufreq_frequency_table_cpuinfo (policy, table); -if (!ret) -cpufreq_frequency_table_get_attr (table, policy->cpu); - -return ret; +return cpufreq_table_validate_and_show (policy, table); }static void __update_core_freq (struct pxa3xx_freq_info *info)
Signature · 1 line
1.7.12.rc2.18.g61b472e
Viresh Kumar
maintainerPATCH 28/35 cpufreq: s3cx4xx: use cpufreq_table_validate_and_show()
In reply to Viresh KumarLets use cpufreq_table_validate_and_show() instead of calling cpufreq_frequency_table_cpuinfo() and cpufreq_frequency_table_get_attr().
--- drivers/cpufreq/s3c2416-cpufreq.c | 4 +--- drivers/cpufreq/s3c24xx-cpufreq.c | 6 ++---- drivers/cpufreq/s3c64xx-cpufreq.c | 5 +---- 3 files changed, 4 insertions(+), 11 deletions(-)
drivers/cpufreq/s3c2416-cpufreq.c +1 -3
@@ -494,12 +494,10 @@ static int __init s3c2416_cpufreq_driver_init(struct cpufreq_policy *policy) policy->cpuinfo.transition_latency = (500 *1000 ) + s3c_freq->regulator_latency; - ret =cpufreq_frequency_table_cpuinfo (policy, s3c_freq->freq_table); + ret =cpufreq_table_validate_and_show (policy, s3c_freq->freq_table);if (ret) goto err_freq_table; -cpufreq_frequency_table_get_attr (s3c_freq->freq_table,0 ); -register_reboot_notifier (&s3c2416_cpufreq_reboot_notifier);return 0 ;
drivers/cpufreq/s3c24xx-cpufreq.c +2 -4
@@ -386,10 +386,8 @@ static int s3c_cpufreq_init(struct cpufreq_policy *policy)/* feed the latency information from the cpu driver */ policy->cpuinfo.transition_latency = cpu_cur.info->latency; -if (ftab) { -cpufreq_frequency_table_cpuinfo (policy, ftab); -cpufreq_frequency_table_get_attr (ftab, policy->cpu); - } +if (ftab) +return cpufreq_table_validate_and_show (policy, ftab);return 0 ; }
drivers/cpufreq/s3c64xx-cpufreq.c +1 -4
@@ -251,15 +251,12 @@ static int s3c64xx_cpufreq_driver_init(struct cpufreq_policy *policy)*/ policy->cpuinfo.transition_latency = (500 *1000 ) + regulator_latency; - ret =cpufreq_frequency_table_cpuinfo (policy, s3c64xx_freq_table); + ret =cpufreq_table_validate_and_show (policy, s3c64xx_freq_table);if (ret !=0 ) {pr_err ("Failed to configure frequency table: %d\n" , ret);regulator_put (vddarm);clk_put (armclk); - }else { -cpufreq_frequency_table_get_attr (s3c64xx_freq_table, - policy->cpu); }return ret;
Signature · 1 line
1.7.12.rc2.18.g61b472e
Viresh Kumar
maintainerPATCH 29/35 cpufreq: s5pv210: use cpufreq_table_validate_and_show()
In reply to Viresh KumarLets use cpufreq_table_validate_and_show() instead of calling cpufreq_frequency_table_cpuinfo() and cpufreq_frequency_table_get_attr().
--- drivers/cpufreq/s5pv210-cpufreq.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/cpufreq/s5pv210-cpufreq.c +1 -3
@@ -553,11 +553,9 @@ static int __init s5pv210_cpu_init(struct cpufreq_policy *policy) policy->cur = policy->min = policy->max =s5pv210_getspeed (0 ); -cpufreq_frequency_table_get_attr (s5pv210_freq_table, policy->cpu); - policy->cpuinfo.transition_latency =40000 ; -return cpufreq_frequency_table_cpuinfo (policy, s5pv210_freq_table); +return cpufreq_table_validate_and_show (policy, s5pv210_freq_table); out_dmc1:clk_put (dmc0_clk);
Signature · 1 line
1.7.12.rc2.18.g61b472e
Viresh Kumar
maintainerPATCH 30/35 cpufreq: sc520: use cpufreq_table_validate_and_show()
In reply to Viresh KumarLets use cpufreq_table_validate_and_show() instead of calling cpufreq_frequency_table_cpuinfo() and cpufreq_frequency_table_get_attr().
--- drivers/cpufreq/sc520_freq.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-)
drivers/cpufreq/sc520_freq.c +1 -8
@@ -106,7 +106,6 @@ static int sc520_freq_target(struct cpufreq_policy *policy,static int sc520_freq_cpu_init (struct cpufreq_policy *policy) {struct cpuinfo_x86 *c = &cpu_data (0 ); -int result;/* capability check */ if (c->x86_vendor != X86_VENDOR_AMD ||
@@ -117,13 +116,7 @@ static int sc520_freq_cpu_init(struct cpufreq_policy *policy) policy->cpuinfo.transition_latency =1000000 ;/* 1ms */ policy->cur =sc520_freq_get_cpu_frequency (0 ); - result =cpufreq_frequency_table_cpuinfo (policy, sc520_freq_table); -if (result) -return result; - -cpufreq_frequency_table_get_attr (sc520_freq_table, policy->cpu); - -return 0 ; +return cpufreq_table_validate_and_show (policy, sc520_freq_table); }
Signature · 1 line
1.7.12.rc2.18.g61b472e
Viresh Kumar
maintainerPATCH 31/35 cpufreq: sh: use cpufreq_table_validate_and_show()
In reply to Viresh KumarLets use cpufreq_table_validate_and_show() instead of calling cpufreq_frequency_table_cpuinfo() and cpufreq_frequency_table_get_attr().
--- drivers/cpufreq/sh-cpufreq.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/cpufreq/sh-cpufreq.c +3 -3
@@ -120,9 +120,9 @@ static int sh_cpufreq_cpu_init(struct cpufreq_policy *policy)if (freq_table) {int result; - result =cpufreq_frequency_table_cpuinfo (policy, freq_table); -if (!result) -cpufreq_frequency_table_get_attr (freq_table, cpu); + result =cpufreq_table_validate_and_show (policy, freq_table); +if (result) +return result; }else {dev_notice (dev,"no frequency table found, falling back " "to rate rounding.\n" );
Signature · 1 line
1.7.12.rc2.18.g61b472e
Viresh Kumar
maintainerPATCH 32/35 cpufreq: sparc: use cpufreq_table_validate_and_show()
In reply to Viresh KumarLets use cpufreq_table_validate_and_show() instead of calling cpufreq_frequency_table_cpuinfo() and cpufreq_frequency_table_get_attr().
--- drivers/cpufreq/sparc-us2e-cpufreq.c | 6 +----- drivers/cpufreq/sparc-us3-cpufreq.c | 7 +------ 2 files changed, 2 insertions(+), 11 deletions(-)
drivers/cpufreq/sparc-us2e-cpufreq.c +1 -5
@@ -307,7 +307,6 @@ static int __init us2e_freq_cpu_init(struct cpufreq_policy *policy)unsigned long clock_tick =sparc64_get_clock_tick (cpu) /1000 ;struct cpufreq_frequency_table *table = &us2e_freq_table[cpu].table[0 ]; -int ret; table[0 ].driver_data =0 ; table[0 ].frequency = clock_tick /1 ;
@@ -325,10 +324,7 @@ static int __init us2e_freq_cpu_init(struct cpufreq_policy *policy) policy->cpuinfo.transition_latency =0 ; policy->cur = clock_tick; - ret =cpufreq_frequency_table_cpuinfo (policy, table); -if (!ret) -cpufreq_frequency_table_get_attr (table, policy->cpu); -return ret; +return cpufreq_table_validate_and_show (policy, table); }static int us2e_freq_cpu_exit (struct cpufreq_policy *policy)
drivers/cpufreq/sparc-us3-cpufreq.c +1 -6
@@ -168,7 +168,6 @@ static int __init us3_freq_cpu_init(struct cpufreq_policy *policy)unsigned long clock_tick =sparc64_get_clock_tick (cpu) /1000 ;struct cpufreq_frequency_table *table = &us3_freq_table[cpu].table[0 ]; -int ret; table[0 ].driver_data =0 ; table[0 ].frequency = clock_tick /1 ;
@@ -182,11 +181,7 @@ static int __init us3_freq_cpu_init(struct cpufreq_policy *policy) policy->cpuinfo.transition_latency =0 ; policy->cur = clock_tick; - ret =cpufreq_frequency_table_cpuinfo (policy, table); -if (!ret) -cpufreq_frequency_table_get_attr (table, policy->cpu); - -return ret; +return cpufreq_table_validate_and_show (policy, table); }static int us3_freq_cpu_exit (struct cpufreq_policy *policy)
Signature · 1 line
1.7.12.rc2.18.g61b472e
Viresh Kumar
maintainerPATCH 33/35 cpufreq: spear: use cpufreq_table_validate_and_show()
In reply to Viresh KumarLets use cpufreq_table_validate_and_show() instead of calling cpufreq_frequency_table_cpuinfo() and cpufreq_frequency_table_get_attr().
--- drivers/cpufreq/spear-cpufreq.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/cpufreq/spear-cpufreq.c +2 -3
@@ -178,13 +178,12 @@ static int spear_cpufreq_init(struct cpufreq_policy *policy) {int ret; - ret =cpufreq_frequency_table_cpuinfo (policy, spear_cpufreq.freq_tbl); + ret =cpufreq_table_validate_and_show (policy, spear_cpufreq.freq_tbl);if (ret) { -pr_err ("cpufreq_frequency_table_cpuinfo() failed" ); +pr_err ("cpufreq_table_validate_and_show() failed" );return ret; } -cpufreq_frequency_table_get_attr (spear_cpufreq.freq_tbl, policy->cpu); policy->cpuinfo.transition_latency = spear_cpufreq.transition_latency; policy->cur =spear_cpufreq_get (0 );
Signature · 1 line
1.7.12.rc2.18.g61b472e
Viresh Kumar
maintainerPATCH 34/35 cpufreq: speedstep: use cpufreq_table_validate_and_show()
In reply to Viresh KumarLets use cpufreq_table_validate_and_show() instead of calling cpufreq_frequency_table_cpuinfo() and cpufreq_frequency_table_get_attr().
--- drivers/cpufreq/speedstep-centrino.c | 10 +--------- drivers/cpufreq/speedstep-ich.c | 9 +-------- drivers/cpufreq/speedstep-smi.c | 8 +------- 3 files changed, 3 insertions(+), 24 deletions(-)
drivers/cpufreq/speedstep-centrino.c +1 -9
@@ -345,7 +345,6 @@ static int centrino_cpu_init(struct cpufreq_policy *policy)struct cpuinfo_x86 *cpu = &cpu_data (policy->cpu);unsigned freq;unsigned l, h; -int ret;int i;/* Only Intel makes Enhanced Speedstep-capable CPUs */
@@ -402,15 +401,8 @@ static int centrino_cpu_init(struct cpufreq_policy *policy)pr_debug ("centrino_cpu_init: cur=%dkHz\n" , policy->cur); - ret =cpufreq_frequency_table_cpuinfo (policy, +return cpufreq_table_validate_and_show (policy,per_cpu (centrino_model, policy->cpu)->op_points); -if (ret) -return (ret); - -cpufreq_frequency_table_get_attr ( -per_cpu (centrino_model, policy->cpu)->op_points, policy->cpu); - -return 0 ; }static int centrino_cpu_exit (struct cpufreq_policy *policy)
drivers/cpufreq/speedstep-ich.c +1 -8
@@ -320,7 +320,6 @@ static void get_freqs_on_cpu(void *_get_freqs)static int speedstep_cpu_init (struct cpufreq_policy *policy) { -int result;unsigned int policy_cpu, speed;struct get_freqs gf;
@@ -349,13 +348,7 @@ static int speedstep_cpu_init(struct cpufreq_policy *policy)/* cpuinfo and default policy values */ policy->cur = speed; - result =cpufreq_frequency_table_cpuinfo (policy, speedstep_freqs); -if (result) -return result; - -cpufreq_frequency_table_get_attr (speedstep_freqs, policy->cpu); - -return 0 ; +return cpufreq_table_validate_and_show (policy, speedstep_freqs); }
drivers/cpufreq/speedstep-smi.c +1 -7
@@ -329,13 +329,7 @@ static int speedstep_cpu_init(struct cpufreq_policy *policy) policy->cpuinfo.transition_latency =CPUFREQ_ETERNAL ; policy->cur = speed; - result =cpufreq_frequency_table_cpuinfo (policy, speedstep_freqs); -if (result) -return result; - -cpufreq_frequency_table_get_attr (speedstep_freqs, policy->cpu); - -return 0 ; +return cpufreq_table_validate_and_show (policy, speedstep_freqs); }static int speedstep_cpu_exit (struct cpufreq_policy *policy)
Signature · 1 line
1.7.12.rc2.18.g61b472e
Viresh Kumar
maintainerPATCH 35/35 cpufreq: tegra: use cpufreq_table_validate_and_show()
In reply to Viresh KumarLets use cpufreq_table_validate_and_show() instead of calling cpufreq_frequency_table_cpuinfo() and cpufreq_frequency_table_get_attr().
--- drivers/cpufreq/tegra-cpufreq.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/cpufreq/tegra-cpufreq.c +1 -3
@@ -215,8 +215,7 @@ static int tegra_cpu_init(struct cpufreq_policy *policy)clk_prepare_enable (emc_clk);clk_prepare_enable (cpu_clk); -cpufreq_frequency_table_cpuinfo (policy, freq_table); -cpufreq_frequency_table_get_attr (freq_table, policy->cpu); +cpufreq_table_validate_and_show (policy, freq_table); policy->cur =tegra_getspeed (policy->cpu); target_cpu_speed[policy->cpu] = policy->cur;
@@ -233,7 +232,6 @@ static int tegra_cpu_init(struct cpufreq_policy *policy)static int tegra_cpu_exit (struct cpufreq_policy *policy) { -cpufreq_frequency_table_cpuinfo (policy, freq_table);clk_disable_unprepare (emc_clk);return 0 ; }
Signature · 1 line
1.7.12.rc2.18.g61b472e
Quoted 92 lines · Viresh Kumar
This is actually part of a bigger patchset which will change declaration of
cpufreq_driver->target()to include index instead oftarget_freqand relation and hence cpufreq drivers wouldn't require tocpufreq_frequency_table_target()anymore.Almost every cpufreq driver is required to validate its frequency table with:
cpufreq_frequency_table_cpuinfo()and then expose it to cpufreq core with:cpufreq_frequency_table_get_attr().This patch creates another helper routine
cpufreq_table_validate_and_show()that will do both these steps in a single call and will return 0 for success, error otherwise.This also fixes potential bugs in cpufreq drivers where people have called
cpufreq_frequency_table_get_attr()before callingcpufreq_frequency_table_cpuinfo(), as the later may fail.Viresh Kumar (35):
cpufreq: Add new helpercpufreq_table_validate_and_show()
cpufreq: pxa: callcpufreq_frequency_table_get_attr()
cpufreq: s3cx4xx: callcpufreq_frequency_table_get_attr()
cpufreq: sparc: callcpufreq_frequency_table_get_attr()
cpufreq: acpi-cpufreq: usecpufreq_table_validate_and_show()
cpufreq:arm_big_little: usecpufreq_table_validate_and_show()
cpufreq: blackfin: usecpufreq_table_validate_and_show()
cpufreq: cpufreq-cpu0: usecpufreq_table_validate_and_show()
cpufreq: cris: usecpufreq_table_validate_and_show()
cpufreq: davinci: usecpufreq_table_validate_and_show()
cpufreq: dbx500: usecpufreq_table_validate_and_show()
cpufreq:e_powersaver: usecpufreq_table_validate_and_show()
cpufreq: elanfreq: usecpufreq_table_validate_and_show()
cpufreq: exynos: usecpufreq_table_validate_and_show()
cpufreq: ia64-acpi: usecpufreq_table_validate_and_show()
cpufreq: imx6q: usecpufreq_table_validate_and_show()
cpufreq: kirkwood: usecpufreq_table_validate_and_show()
cpufreq: longhaul: usecpufreq_table_validate_and_show()
cpufreq: loongson2: usecpufreq_table_validate_and_show()
cpufreq: maple: usecpufreq_table_validate_and_show()
cpufreq: omap: usecpufreq_table_validate_and_show()
cpufreq: p4-clockmod: usecpufreq_table_validate_and_show()
cpufreq: pasemi: usecpufreq_table_validate_and_show()
cpufreq: pmac: usecpufreq_table_validate_and_show()
cpufreq: powernow: usecpufreq_table_validate_and_show()
cpufreq: ppc: usecpufreq_table_validate_and_show()
cpufreq: pxa: usecpufreq_table_validate_and_show()
cpufreq: s3cx4xx: usecpufreq_table_validate_and_show()
cpufreq: s5pv210: usecpufreq_table_validate_and_show()
cpufreq: sc520: usecpufreq_table_validate_and_show()
cpufreq: sh: usecpufreq_table_validate_and_show()
cpufreq: sparc: usecpufreq_table_validate_and_show()
cpufreq: spear: usecpufreq_table_validate_and_show()
cpufreq: speedstep: usecpufreq_table_validate_and_show()
cpufreq: tegra: usecpufreq_table_validate_and_show()drivers/cpufreq/acpi-cpufreq.c | 4 +--- drivers/cpufreq/arm_big_little.c | 4 +--- drivers/cpufreq/blackfin-cpufreq.c | 3 +-- drivers/cpufreq/cpufreq-cpu0.c | 4 +--- drivers/cpufreq/cris-artpec3-cpufreq.c | 10 +--------- drivers/cpufreq/cris-etraxfs-cpufreq.c | 10 +--------- drivers/cpufreq/davinci-cpufreq.c | 6 ++---- drivers/cpufreq/dbx500-cpufreq.c | 6 ++---- drivers/cpufreq/e_powersaver.c | 3 +-- drivers/cpufreq/elanfreq.c | 8 +------- drivers/cpufreq/exynos-cpufreq.c | 4 +--- drivers/cpufreq/exynos5440-cpufreq.c | 4 +--- drivers/cpufreq/freq_table.c | 12 ++++++++++++ drivers/cpufreq/ia64-acpi-cpufreq.c | 4 +--- drivers/cpufreq/imx6q-cpufreq.c | 3 +-- drivers/cpufreq/kirkwood-cpufreq.c | 10 +--------- drivers/cpufreq/longhaul.c | 8 +------- drivers/cpufreq/loongson2_cpufreq.c | 5 +---- drivers/cpufreq/maple-cpufreq.c | 4 +--- drivers/cpufreq/omap-cpufreq.c | 4 +--- drivers/cpufreq/p4-clockmod.c | 3 +-- drivers/cpufreq/pasemi-cpufreq.c | 4 +--- drivers/cpufreq/pmac32-cpufreq.c | 3 +-- drivers/cpufreq/pmac64-cpufreq.c | 4 +--- drivers/cpufreq/powernow-k6.c | 9 +-------- drivers/cpufreq/powernow-k7.c | 4 +--- drivers/cpufreq/powernow-k8.c | 4 +--- drivers/cpufreq/ppc-corenet-cpufreq.c | 3 +-- drivers/cpufreq/ppc_cbe_cpufreq.c | 4 +--- drivers/cpufreq/pxa2xx-cpufreq.c | 8 +++++--- drivers/cpufreq/pxa3xx-cpufreq.c | 2 +- drivers/cpufreq/s3c2416-cpufreq.c | 4 +--- drivers/cpufreq/s3c24xx-cpufreq.c | 2 +- drivers/cpufreq/s3c64xx-cpufreq.c | 2 +- drivers/cpufreq/s5pv210-cpufreq.c | 4 +--- drivers/cpufreq/sc520_freq.c | 9 +-------- drivers/cpufreq/sh-cpufreq.c | 6 +++--- drivers/cpufreq/sparc-us2e-cpufreq.c | 2 +-
Quoted 8 lines
drivers/cpufreq/sparc-us3-cpufreq.c | 2 +- drivers/cpufreq/spear-cpufreq.c | 5 ++--- drivers/cpufreq/speedstep-centrino.c | 10 +--------- drivers/cpufreq/speedstep-ich.c | 9 +-------- drivers/cpufreq/speedstep-smi.c | 8 +------- drivers/cpufreq/tegra-cpufreq.c | 4 +--- include/linux/cpufreq.h | 2 ++ 45 files changed, 66 insertions(+), 167 deletions(-)
I'm not going to take this for 3.12, sorry. Please resend in the 3.12-rc1 / 3.12-rc2 time frame.
Thanks,
Rafael
Signature · 2 lines
I speak only for myself. Rafael J. Wysocki, Intel Open Source Technology Center.
Viresh Kumar
maintainerQuoted 2 lines · Rafael J. Wysocki
I'm not going to take this for 3.12, sorry. Please resend in the 3.12-rc1 / 3.12-rc2 time frame.
Okay.. By that time I will accumulate all reviews/Acks for it and the next patchset that I will send.
Quoted 6 lines · Viresh Kumar
Quoted 2 lines · Rafael J. Wysocki
I'm not going to take this for 3.12, sorry. Please resend in the 3.12-rc1 / 3.12-rc2 time frame.
Okay.. By that time I will accumulate all reviews/Acks for it and the next patchset that I will send.
OK
Re: [PATCH 17/35] cpufreq: kirkwood: use cpufreq_table_validate_and_show()
In reply to Viresh KumarQuoted 36 lines · Viresh Kumar
Lets use
cpufreq_table_validate_and_show()instead of callingcpufreq_frequency_table_cpuinfo()andcpufreq_frequency_table_get_attr().Cc Andrew Lunn <[email protected]>Signed-off-by Viresh Kumar <[email protected]>--- drivers/cpufreq/kirkwood-cpufreq.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-)drivers/cpufreq/kirkwood-cpufreq.c +1
-9@@ -125,19 +125,11 @@ static int kirkwood_cpufreq_target(struct cpufreq_policy *policy,/* Module init and exit code */ static int kirkwood_cpufreq_cpu_init (struct cpufreq_policy *policy) { -int result; -/* cpuinfo and default policy values */ policy->cpuinfo.transition_latency =5000 ;/* 5uS */ policy->cur =kirkwood_cpufreq_get_cpu_frequency (0 ); - result =cpufreq_frequency_table_cpuinfo (policy, kirkwood_freq_table); -if (result) -return result; - -cpufreq_frequency_table_get_attr (kirkwood_freq_table, policy->cpu); - -return 0 ; +return cpufreq_table_validate_and_show (policy, kirkwood_freq_table); }static int kirkwood_cpufreq_cpu_exit (struct cpufreq_policy *policy)Signature · 1 line
1.7.12.rc2.18.g61b472e
Thanks
Andrew
Re: [PATCH 21/35] cpufreq: omap: use cpufreq_table_validate_and_show()
In reply to Viresh KumarQuoted 6 lines · Viresh Kumar
Lets use
cpufreq_table_validate_and_show()instead of callingcpufreq_frequency_table_cpuinfo()andcpufreq_frequency_table_get_attr().Cc Santosh Shilimkar <[email protected]>Signed-off-by Viresh Kumar <[email protected]>---
Re: [PATCH 35/35] cpufreq: tegra: use cpufreq_table_validate_and_show()
In reply to Viresh KumarQuoted 2 lines · Viresh Kumar
Lets use
cpufreq_table_validate_and_show()instead of callingcpufreq_frequency_table_cpuinfo()andcpufreq_frequency_table_get_attr().
Assuming the new function simply does what the two removed lines do, this looks fine to me.
Review
Quoted 3 lines
static int
tegra_cpu_exit(struct cpufreq_policy *policy){(quoted diff) +0
-1- cpufreq_frequency_table_cpuinfo(policy, freq_table);
This doesn't seem to be mentioned in the commit description. I assume this is simply dead/useless code removal?
Viresh Kumar
maintainerRe: [PATCH 35/35] cpufreq: tegra: use cpufreq_table_validate_and_show()
Quoted 6 lines · Stephen Warren
Quoted 2 lines · Viresh Kumar
Lets use
cpufreq_table_validate_and_show()instead of callingcpufreq_frequency_table_cpuinfo()andcpufreq_frequency_table_get_attr().Assuming the new function simply does what the two removed lines do, this looks fine to me.
http://lkml.org/lkml/2013/8/8/266
Quoted 6 lines
Quoted 3 lines
static int
tegra_cpu_exit(struct cpufreq_policy *policy){
-cpufreq_frequency_table_cpuinfo(policy, freq_table);This doesn't seem to be mentioned in the commit description. I assume this is simply dead/useless code removal?
Its useless and the correct routine isn't called at all :) .. I will add that additional patch and send it to you and will get this change out of this commit.
Viresh Kumar
maintainerRe: [PATCH 35/35] cpufreq: tegra: use cpufreq_table_validate_and_show()
Quoted 3 lines · Viresh Kumar
Its useless and the correct routine isn't called at all :) .. I will add that additional patch and send it to you and will get this change out of this commit.
The two commits look like this now attached too in case you want to test:
commit 9abdc9127b9f7f1e00c75694d15345843a60ff99
Author: Viresh Kumar <[email protected]> Date: Thu Aug 8 16:40:32 2013 +0530
cpufreq: tegra: use cpufreq_table_validate_and_show()
Lets use cpufreq_table_validate_and_show() instead of calling cpufreq_frequency_table_cpuinfo() and cpufreq_frequency_table_get_attr().
--- drivers/cpufreq/tegra-cpufreq.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/cpufreq/tegra-cpufreq.c +1 -2
@@ -215,8 +215,7 @@ static int tegra_cpu_init(struct cpufreq_policy *policy)clk_prepare_enable (emc_clk);clk_prepare_enable (cpu_clk); -cpufreq_frequency_table_cpuinfo (policy, freq_table); -cpufreq_frequency_table_get_attr (freq_table, policy->cpu); +cpufreq_table_validate_and_show (policy, freq_table); policy->cur =tegra_getspeed (policy->cpu); target_cpu_speed[policy->cpu] = policy->cur;
commit f1bb1cab6130501251eee616280b88c0b49d96d7
Author: Viresh Kumar <[email protected]> Date: Fri Aug 9 09:29:19 2013 +0530
cpufreq: tegra: fix implementation of ->exit()
->exit() of drivers should call cpufreq_frequency_table_put_attr()if they have
called cpufreq_frequency_table_get_attr() earlier in init() and they aren't required to validate their cpufreq table in exit by calling cpufreq_frequency_table_cpuinfo(). Tegra's driver wasn't calling cpufreq_frequency_table_put_attr() and was calling cpufreq_frequency_table_cpuinfo() in exit.
Fix both these issues in it.
--- drivers/cpufreq/tegra-cpufreq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/cpufreq/tegra-cpufreq.c +1 -1
@@ -232,7 +232,7 @@ static int tegra_cpu_init(struct cpufreq_policy *policy)static int tegra_cpu_exit (struct cpufreq_policy *policy) { -cpufreq_frequency_table_cpuinfo (policy, freq_table); +cpufreq_frequency_table_put_attr (policy->cpu);clk_disable_unprepare (emc_clk);return 0 ; }
From 8adda0413f007dd3d4ab6dac934c074c205ada8d Mon Sep 17 00:00:00 2001
Message-Id: <8adda0413f007dd3d4ab6dac934c074c205ada8d.1376021055.git.viresh.kumar@linaro.org>
From: Viresh Kumar <[email protected]>
Date: Thu, 8 Aug 2013 16:22:04 +0530
Subject: [PATCH 01/36] cpufreq: Add new helper
cpufreq_table_validate_and_show()
Almost every cpufreq driver is required to validate its frequency table with:cpufreq_frequency_table_cpuinfo() and then expose it to cpufreq core with:cpufreq_frequency_table_get_attr().
This patch creates another helper routine cpufreq_table_validate_and_show() that will do both these steps in a single call and will return 0 for success, error otherwise.
This also fixes potential bugs in cpufreq drivers where people have called cpufreq_frequency_table_get_attr() before calling cpufreq_frequency_table_cpuinfo(), as the later may fail.
--- drivers/cpufreq/freq_table.c | 12 ++++++++++++ include/linux/cpufreq.h | 2 ++ 2 files changed, 14 insertions(+)
drivers/cpufreq/freq_table.c +12 -0
@@ -219,6 +219,18 @@ void cpufreq_frequency_table_put_attr(unsigned int cpu) }EXPORT_SYMBOL_GPL (cpufreq_frequency_table_put_attr); +int cpufreq_table_validate_and_show (struct cpufreq_policy *policy, +struct cpufreq_frequency_table *table) +{ +int ret =cpufreq_frequency_table_cpuinfo (policy, table); + +if (!ret) +cpufreq_frequency_table_get_attr (table, policy->cpu); + +return ret; +} +EXPORT_SYMBOL_GPL (cpufreq_table_validate_and_show); +void cpufreq_frequency_table_update_policy_cpu (struct cpufreq_policy *policy) { pr_debug("Updating show_table for new_cpu %u from last_cpu %u\n",
include/linux/cpufreq.h +2 -0
@@ -411,5 +411,7 @@ extern struct freq_attr cpufreq_freq_attr_scaling_available_freqs;void cpufreq_frequency_table_get_attr (struct cpufreq_frequency_table *table,unsigned int cpu);void cpufreq_frequency_table_put_attr (unsigned int cpu); +int cpufreq_table_validate_and_show (struct cpufreq_policy *policy, +struct cpufreq_frequency_table *table);#endif /* _LINUX_CPUFREQ_H */
Signature · 1 line
1.7.12.rc2.18.g61b472e
From 9abdc9127b9f7f1e00c75694d15345843a60ff99 Mon Sep 17 00:00:00 2001
Message-Id: <9abdc9127b9f7f1e00c75694d15345843a60ff99.1376021055.git.viresh.kumar@linaro.org>
In-Reply-To: <8adda0413f007dd3d4ab6dac934c074c205ada8d.1376021055.git.viresh.kumar@linaro.org>
References: <8adda0413f007dd3d4ab6dac934c074c205ada8d.1376021055.git.viresh.kumar@linaro.org>
From: Viresh Kumar <[email protected]>
Date: Thu, 8 Aug 2013 16:40:32 +0530
Subject: [PATCH 35/36] cpufreq: tegra: use cpufreq_table_validate_and_show()
Lets use cpufreq_table_validate_and_show() instead of calling cpufreq_frequency_table_cpuinfo() and cpufreq_frequency_table_get_attr().
--- drivers/cpufreq/tegra-cpufreq.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/cpufreq/tegra-cpufreq.c +1 -2
@@ -215,8 +215,7 @@ static int tegra_cpu_init(struct cpufreq_policy *policy)clk_prepare_enable (emc_clk);clk_prepare_enable (cpu_clk); -cpufreq_frequency_table_cpuinfo (policy, freq_table); -cpufreq_frequency_table_get_attr (freq_table, policy->cpu); +cpufreq_table_validate_and_show (policy, freq_table); policy->cur =tegra_getspeed (policy->cpu); target_cpu_speed[policy->cpu] = policy->cur;
Signature · 1 line
1.7.12.rc2.18.g61b472e
From f1bb1cab6130501251eee616280b88c0b49d96d7 Mon Sep 17 00:00:00 2001
Message-Id: <f1bb1cab6130501251eee616280b88c0b49d96d7.1376021055.git.viresh.kumar@linaro.org>
In-Reply-To: <8adda0413f007dd3d4ab6dac934c074c205ada8d.1376021055.git.viresh.kumar@linaro.org>
References: <8adda0413f007dd3d4ab6dac934c074c205ada8d.1376021055.git.viresh.kumar@linaro.org>
From: Viresh Kumar <[email protected]>
Date: Fri, 9 Aug 2013 09:29:19 +0530
Subject: [PATCH 36/36] cpufreq: tegra: fix implementation of ->exit()
->exit() of drivers should call cpufreq_frequency_table_put_attr() if they have called cpufreq_frequency_table_get_attr() earlier in init() and they aren't required to validate their cpufreq table in exit by calling cpufreq_frequency_table_cpuinfo(). Tegra's driver wasn't calling cpufreq_frequency_table_put_attr() and was calling cpufreq_frequency_table_cpuinfo() in exit.
Fix both these issues in it.
--- drivers/cpufreq/tegra-cpufreq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/cpufreq/tegra-cpufreq.c +1 -1
@@ -232,7 +232,7 @@ static int tegra_cpu_init(struct cpufreq_policy *policy)static int tegra_cpu_exit (struct cpufreq_policy *policy) { -cpufreq_frequency_table_cpuinfo (policy, freq_table); +cpufreq_frequency_table_put_attr (policy->cpu);clk_disable_unprepare (emc_clk);return 0 ; }
Signature · 1 line
1.7.12.rc2.18.g61b472e
Re: [PATCH 35/35] cpufreq: tegra: use cpufreq_table_validate_and_show()
Quoted 7 lines · Viresh Kumar
Quoted 3 lines · Viresh Kumar
Its useless and the correct routine isn't called at all :) .. I will add that additional patch and send it to you and will get this change out of this commit.
The two commits look like this now attached too in case you want to test:
I'd be happy to test, but those changes cause build failures on top of next-20130809. Which other patches do I need to apply first?
Viresh Kumar
maintainerRe: [PATCH 35/35] cpufreq: tegra: use cpufreq_table_validate_and_show()
Quoted 11 lines · Stephen Warren
Quoted 7 lines · Viresh Kumar
Quoted 3 lines · Viresh Kumar
Its useless and the correct routine isn't called at all :) .. I will add that additional patch and send it to you and will get this change out of this commit.
The two commits look like this now attached too in case you want to test:
I'd be happy to test, but those changes cause build failures on top of next-20130809. Which other patches do I need to apply first?
None.. You applied all three attached patches? I have given it a try on my side now and it worked without any issues..
Just pushed out a branch for you as well:
https://git.linaro.org/gitweb?p=people/vireshk/linux.git;a=shortlog;h=refs/heads/tegra-test
Re: [PATCH 35/35] cpufreq: tegra: use cpufreq_table_validate_and_show()
Quoted 13 lines · Viresh Kumar
Quoted 11 lines · Stephen Warren
Quoted 7 lines · Viresh Kumar
Quoted 3 lines · Viresh Kumar
Its useless and the correct routine isn't called at all :) .. I will add that additional patch and send it to you and will get this change out of this commit.
The two commits look like this now attached too in case you want to test:
I'd be happy to test, but those changes cause build failures on top of next-20130809. Which other patches do I need to apply first?
Quoted 6 lines
None.. You applied all three attached patches? I have given it a try on my side now and it worked without any issues..
Just pushed out a branch for you as well:
https://git.linaro.org/gitweb?p=people/vireshk/linux.git;a=shortlog;h=refs/heads/tegra-test
Well, I don't see any issues running this, although the cpufreq sysfs files seem to have disappeared on Tegra, even without your changes, so I'm not sure how to really verify cpufreq.
Did the sysfs files go away, or do I need to investigate why/when the disappeared?
Viresh Kumar
maintainerRe: [PATCH 35/35] cpufreq: tegra: use cpufreq_table_validate_and_show()
Quoted 6 lines · Stephen Warren
Well, I don't see any issues running this, although the cpufreq sysfs files seem to have disappeared on Tegra, even without your changes, so I'm not sure how to really verify cpufreq.
Did the sysfs files go away, or do I need to investigate why/when the disappeared?
It wasn't enabled by default in your defconfig... So enable it first with your menuconfig.
Re: [PATCH 08/35] cpufreq: cpufreq-cpu0: use cpufreq_table_validate_and_show()
In reply to Viresh KumarQuoted 5 lines · Viresh Kumar
Lets use
cpufreq_table_validate_and_show()instead of callingcpufreq_frequency_table_cpuinfo()andcpufreq_frequency_table_get_attr().Cc Shawn Guo <[email protected]>Signed-off-by Viresh Kumar <[email protected]>
I'm not copied on the patch that introduces function cpufreq_table_validate_and_show(). So if it does the right/equivalent thing, for cpufreq-cpu0 and imx6q-cpufreq:
Viresh Kumar
maintainerRe: [PATCH 08/35] cpufreq: cpufreq-cpu0: use cpufreq_table_validate_and_show()
Quoted 10 lines · Shawn Guo
Quoted 5 lines · Viresh Kumar
Lets use
cpufreq_table_validate_and_show()instead of callingcpufreq_frequency_table_cpuinfo()andcpufreq_frequency_table_get_attr().Cc Shawn Guo <[email protected]>Signed-off-by Viresh Kumar <[email protected]>I'm not copied on the patch that introduces function
cpufreq_table_validate_and_show(). So if it does the right/equivalent thing, for cpufreq-cpu0 and imx6q-cpufreq:
You better check it :)
https://lkml.org/lkml/2013/8/8/266
I wasn't probably following the right way for sending mails as I was expecting people to look at these patches over list..
In the next series with 44 patch I tried to fix this issue. And so cc'd people on cover-letter and the important patch they must check.
Quoted 1 line
Acked-by Shawn Guo <[email protected]>
Thanks.
Re: [PATCH 35/35] cpufreq: tegra: use cpufreq_table_validate_and_show()
In reply to Viresh KumarQuoted 10 lines · Viresh Kumar
Quoted 6 lines · Stephen Warren
Well, I don't see any issues running this, although the cpufreq sysfs files seem to have disappeared on Tegra, even without your changes, so I'm not sure how to really verify cpufreq.
Did the sysfs files go away, or do I need to investigate why/when the disappeared?
It wasn't enabled by default in your defconfig... So enable it first with your menuconfig.
It's in defconfig OK; I think the driver simply isn't initializing since some of the clocks it requests don't exist. I'll have our clock driver author look into it. In the meantime, I assume that your change is likely fine.
Viresh Kumar
maintainerRe: [PATCH 35/35] cpufreq: tegra: use cpufreq_table_validate_and_show()
Quoted 4 lines · Stephen Warren
It's in defconfig OK; I think the driver simply isn't initializing since some of the clocks it requests don't exist. I'll have our clock driver author look into it. In the meantime, I assume that your change is likely fine.
I wasn't' talking about your driver but cpufreq_stats.. That is disabled by default with your defconfig.
Re: [PATCH 11/35] cpufreq: dbx500: use cpufreq_table_validate_and_show()
In reply to Viresh KumarQuoted 5 lines · Viresh Kumar
Lets use
cpufreq_table_validate_and_show()instead of callingcpufreq_frequency_table_cpuinfo()andcpufreq_frequency_table_get_attr().Cc Linus Walleij <[email protected]>Signed-off-by Viresh Kumar <[email protected]>
Yours,
Linus Walleij