CPUFreq Cleanup Series: Part I
Subsystems (8)
Viresh Kumar
maintainerv2 cover CPUFreq Cleanup Series: Part I
Hi Rafael,
This is resent of patches earlier sent as part of big patchset:
http://www.mail-archive.com/[email protected]/msg503397.html
These contain first set of patches that you can now include in bleeding-edge/linux-next branches of your repo. I have included all Acks/Tested by tags into the patches..
--
viresh
Hans-Christian Egtvedt (1):
cpufreq: at32ap: add frequency table
Viresh Kumar (43):
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: sa11x0: Expose frequency table
cpufreq: sa11x0: let cpufreq core initialize struct policy fields
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()
cpufreq: tegra: fix implementation of ->exit()
cpufreq: arm_big_little: call cpufreq_frequency_table_put_attr()
cpufreq: blackfin: call cpufreq_frequency_table_put_attr()
cpufreq: exynos: call cpufreq_frequency_table_put_attr()
cpufreq: loongson2: call cpufreq_frequency_table_put_attr()
cpufreq: omap: call cpufreq_frequency_table_put_attr()
arch/arm/mach-sa1100/generic.c | 45 +++++++++++++++---------------- arch/arm/mach-sa1100/generic.h | 1 + drivers/cpufreq/acpi-cpufreq.c | 4 +-- drivers/cpufreq/arm_big_little.c | 5 ++-- drivers/cpufreq/at32ap-cpufreq.c | 49 +++++++++++++++++++++++++++++++--- drivers/cpufreq/blackfin-cpufreq.c | 11 ++++++-- 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 | 9 +++++-- 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 | 6 ++--- drivers/cpufreq/maple-cpufreq.c | 4 +-- drivers/cpufreq/omap-cpufreq.c | 5 ++-- 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 | 15 ++++++++--- drivers/cpufreq/pxa3xx-cpufreq.c | 9 ++++++- 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/sa1100-cpufreq.c | 7 +++-- drivers/cpufreq/sa1110-cpufreq.c | 7 +++-- drivers/cpufreq/sc520_freq.c | 9 +------ drivers/cpufreq/sh-cpufreq.c | 6 ++--- drivers/cpufreq/sparc-us2e-cpufreq.c | 6 +++-- drivers/cpufreq/sparc-us3-cpufreq.c | 6 +++-- 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 | 5 ++-- include/linux/cpufreq.h | 2 ++ 50 files changed, 179 insertions(+), 202 deletions(-)
Signature · 1 line
1.7.12.rc2.18.g61b472e
Viresh Kumar
maintainerPATCH RESEND v2 1/44 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
@@ -410,5 +410,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 RESEND v2 2/44 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 | 13 ++++++++++++- drivers/cpufreq/pxa3xx-cpufreq.c | 15 +++++++++++++-- 2 files changed, 25 insertions(+), 3 deletions(-)
drivers/cpufreq/pxa2xx-cpufreq.c +12 -1
@@ -453,20 +453,31 @@ 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" );return 0 ; } +static int pxa_cpufreq_exit (struct cpufreq_policy *policy) +{ +cpufreq_frequency_table_put_attr (policy->cpu); +return 0 ; +} +static struct cpufreq_driver pxa_cpufreq_driver = { .verify = pxa_verify_policy, .target = pxa_set_target, .init = pxa_cpufreq_init, + .exit = pxa_cpufreq_exit, .get = pxa_cpufreq_get, .name ="PXA2xx" , };
drivers/cpufreq/pxa3xx-cpufreq.c +13 -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)
@@ -229,10 +233,17 @@ static int pxa3xx_cpufreq_init(struct cpufreq_policy *policy)return 0 ; } +static int pxa3xx_cpufreq_exit (struct cpufreq_policy *policy) +{ +cpufreq_frequency_table_put_attr (policy->cpu); +return 0 ; +} +static struct cpufreq_driver pxa3xx_cpufreq_driver = { .verify = pxa3xx_cpufreq_verify, .target = pxa3xx_cpufreq_set, .init = pxa3xx_cpufreq_init, + .exit = pxa3xx_cpufreq_exit, .get = pxa3xx_cpufreq_get, .name ="pxa3xx-cpufreq" , };
Signature · 1 line
1.7.12.rc2.18.g61b472e
Viresh Kumar
maintainerPATCH RESEND v2 3/44 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 RESEND v2 4/44 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 | 10 ++++++++-- drivers/cpufreq/sparc-us3-cpufreq.c | 11 +++++++++-- 2 files changed, 17 insertions(+), 4 deletions(-)
drivers/cpufreq/sparc-us2e-cpufreq.c +8 -2
@@ -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,13 +325,18 @@ 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) { -if (cpufreq_us2e_driver) +if (cpufreq_us2e_driver) { +cpufreq_frequency_table_put_attr (policy->cpu);us2e_set_cpu_divider_index (policy,0 ); + }return 0 ; }
drivers/cpufreq/sparc-us3-cpufreq.c +9 -2
@@ -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,13 +182,19 @@ 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) { -if (cpufreq_us3_driver) +if (cpufreq_us3_driver) { +cpufreq_frequency_table_put_attr (policy->cpu);us3_set_cpu_divider_index (policy,0 ); + }return 0 ; }
Signature · 1 line
1.7.12.rc2.18.g61b472e
Viresh Kumar
maintainerPATCH RESEND v2 5/44 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 RESEND v2 6/44 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 RESEND v2 7/44 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 RESEND v2 8/44 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 RESEND v2 9/44 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 RESEND v2 10/44 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 RESEND v2 11/44 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 RESEND v2 12/44 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 RESEND v2 13/44 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 RESEND v2 14/44 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
@@ -326,7 +326,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;
@@ -336,8 +336,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 RESEND v2 15/44 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 RESEND v2 16/44 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
@@ -160,7 +160,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;
@@ -169,7 +169,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 RESEND v2 17/44 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 RESEND v2 18/44 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 RESEND v2 19/44 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 RESEND v2 20/44 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 RESEND v2 21/44 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 RESEND v2 22/44 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 RESEND v2 23/44 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 RESEND v2 24/44 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
@@ -408,8 +408,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
@@ -363,10 +363,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 RESEND v2 25/44 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 RESEND v2 26/44 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 RESEND v2 27/44 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 RESEND v2 28/44 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 RESEND v2 29/44 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 RESEND v2 30/44 cpufreq: sa11x0: Expose frequency table
In reply to Viresh KumarThis patch exposes sa11x0's frequency table to cpufreq core. It always existed but not as an array frequencies and not in the format cpufreq core wants it to. Also it was present in the unit of 100kHz earlier which is made consistent with cpufreq core now, i.e. kHz.
--- arch/arm/mach-sa1100/generic.c | 45 ++++++++++++++++++++-------------------- arch/arm/mach-sa1100/generic.h | 1 + drivers/cpufreq/sa1100-cpufreq.c | 3 ++- drivers/cpufreq/sa1110-cpufreq.c | 3 ++- 4 files changed, 27 insertions(+), 25 deletions(-)
arch/arm/mach-sa1100/generic.c +22 -23
@@ -42,23 +42,24 @@ EXPORT_SYMBOL(reset_status);/* * This table is setup for a 3.6864MHz Crystal. */ -static const unsigned short cclk_frequency_100khz[NR_FREQS ] = { -590 ,/* 59.0 MHz */ -737 ,/* 73.7 MHz */ -885 ,/* 88.5 MHz */ -1032 ,/* 103.2 MHz */ -1180 ,/* 118.0 MHz */ -1327 ,/* 132.7 MHz */ -1475 ,/* 147.5 MHz */ -1622 ,/* 162.2 MHz */ -1769 ,/* 176.9 MHz */ -1917 ,/* 191.7 MHz */ -2064 ,/* 206.4 MHz */ -2212 ,/* 221.2 MHz */ -2359 ,/* 235.9 MHz */ -2507 ,/* 250.7 MHz */ -2654 ,/* 265.4 MHz */ -2802 /* 280.2 MHz */ +struct cpufreq_frequency_table sa11x0_freq_table[NR_FREQS +1 ] = { + { .frequency =59000 ,/* 59.0 MHz */ }, + { .frequency =73700 ,/* 73.7 MHz */ }, + { .frequency =88500 ,/* 88.5 MHz */ }, + { .frequency =103200 ,/* 103.2 MHz */ }, + { .frequency =118000 ,/* 118.0 MHz */ }, + { .frequency =132700 ,/* 132.7 MHz */ }, + { .frequency =147500 ,/* 147.5 MHz */ }, + { .frequency =162200 ,/* 162.2 MHz */ }, + { .frequency =176900 ,/* 176.9 MHz */ }, + { .frequency =191700 ,/* 191.7 MHz */ }, + { .frequency =206400 ,/* 206.4 MHz */ }, + { .frequency =221200 ,/* 221.2 MHz */ }, + { .frequency =235900 ,/* 235.9 MHz */ }, + { .frequency =250700 ,/* 250.7 MHz */ }, + { .frequency =265400 ,/* 265.4 MHz */ }, + { .frequency =280200 ,/* 280.2 MHz */ }, + { .frequency =CPUFREQ_TABLE_END , }, };/* rounds up(!) */
@@ -66,10 +67,8 @@ unsigned int sa11x0_freq_to_ppcr(unsigned int khz) {int i; - khz /=100 ; -for (i =0 ; i <NR_FREQS ; i++) -if (cclk_frequency_100khz[i] >= khz) +if (sa11x0_freq_table[i].frequency >= khz)break ;return i;
@@ -79,7 +78,7 @@ unsigned int sa11x0_ppcr_to_freq(unsigned int idx) {unsigned int freq =0 ;if (idx <NR_FREQS ) - freq = cclk_frequency_100khz[idx] *100 ; + freq = sa11x0_freq_table[idx].frequency;return freq; }
@@ -96,7 +95,7 @@ int sa11x0_verify_speed(struct cpufreq_policy *policy)cpufreq_verify_within_limits (policy, policy->cpuinfo.min_freq, policy->cpuinfo.max_freq);/* make sure that at least one frequency is within the policy */ - tmp = cclk_frequency_100khz[sa11x0_freq_to_ppcr (policy->min)] *100 ; + tmp = sa11x0_freq_table[sa11x0_freq_to_ppcr (policy->min)].frequency;if (tmp > policy->max) policy->max = tmp;
@@ -109,7 +108,7 @@ unsigned int sa11x0_getspeed(unsigned int cpu) {if (cpu)return 0 ; -return cclk_frequency_100khz[PPCR &0xf ] *100 ; +return sa11x0_freq_table[PPCR &0xf ].frequency; }/*
arch/arm/mach-sa1100/generic.h +1 -0
@@ -21,6 +21,7 @@ extern void sa1110_mb_disable(void);struct cpufreq_policy ; +extern struct cpufreq_frequency_table sa11x0_freq_table[];extern unsigned int sa11x0_freq_to_ppcr (unsigned int khz);extern int sa11x0_verify_speed (struct cpufreq_policy *policy);extern unsigned int sa11x0_getspeed (unsigned int cpu);
drivers/cpufreq/sa1100-cpufreq.c +2 -1
@@ -224,7 +224,8 @@ static int __init sa1100_cpu_init(struct cpufreq_policy *policy) policy->cpuinfo.min_freq =59000 ; policy->cpuinfo.max_freq =287000 ; policy->cpuinfo.transition_latency =CPUFREQ_ETERNAL ; -return 0 ; + +return cpufreq_table_validate_and_show (policy, sa11x0_freq_table); }static struct cpufreq_driver sa1100_driver__refdata = {
drivers/cpufreq/sa1110-cpufreq.c +2 -1
@@ -338,7 +338,8 @@ static int __init sa1110_cpu_init(struct cpufreq_policy *policy) policy->cpuinfo.min_freq =59000 ; policy->cpuinfo.max_freq =287000 ; policy->cpuinfo.transition_latency =CPUFREQ_ETERNAL ; -return 0 ; + +return cpufreq_table_validate_and_show (policy, sa11x0_freq_table); }/* sa1110_driver needs __refdata because it must remain after init registers
Signature · 1 line
1.7.12.rc2.18.g61b472e
Viresh Kumar
maintainerPATCH RESEND v2 31/44 cpufreq: sa11x0: let cpufreq core initialize struct policy fields
In reply to Viresh KumarMany fields of struct policy are filled by cpufreq core when we call cpufreq_table_validate_and_show() and so cpufreq driver doesn't need to set them anymore.
--- drivers/cpufreq/sa1100-cpufreq.c | 4 +--- drivers/cpufreq/sa1110-cpufreq.c | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-)
drivers/cpufreq/sa1100-cpufreq.c +1 -3
@@ -220,9 +220,7 @@ static int __init sa1100_cpu_init(struct cpufreq_policy *policy) {if (policy->cpu !=0 )return -EINVAL ; - policy->cur = policy->min = policy->max =sa11x0_getspeed (0 ); - policy->cpuinfo.min_freq =59000 ; - policy->cpuinfo.max_freq =287000 ; + policy->cur =sa11x0_getspeed (0 ); policy->cpuinfo.transition_latency =CPUFREQ_ETERNAL ;return cpufreq_table_validate_and_show (policy, sa11x0_freq_table);
drivers/cpufreq/sa1110-cpufreq.c +1 -3
@@ -334,9 +334,7 @@ static int __init sa1110_cpu_init(struct cpufreq_policy *policy) {if (policy->cpu !=0 )return -EINVAL ; - policy->cur = policy->min = policy->max =sa11x0_getspeed (0 ); - policy->cpuinfo.min_freq =59000 ; - policy->cpuinfo.max_freq =287000 ; + policy->cur =sa11x0_getspeed (0 ); policy->cpuinfo.transition_latency =CPUFREQ_ETERNAL ;return cpufreq_table_validate_and_show (policy, sa11x0_freq_table);
Signature · 1 line
1.7.12.rc2.18.g61b472e
Viresh Kumar
maintainerPATCH RESEND v2 32/44 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 RESEND v2 33/44 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 RESEND v2 34/44 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 RESEND v2 35/44 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 RESEND v2 36/44 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 RESEND v2 37/44 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 | 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
Viresh Kumar
maintainerPATCH RESEND v2 38/44 cpufreq: tegra: fix implementation of ->exit()
In reply to Viresh Kumar->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
Viresh Kumar
maintainerPATCH RESEND v2 39/44 cpufreq: at32ap: add frequency table
In reply to Viresh KumarFrom: Hans-Christian Egtvedt <[email protected]>
This patch adds a dynamically calculated frequency table to the at32ap driver. In short the architecture can scale in power of two between a maximum and minimum frequency. Min, max, and the steps in between are added to the table.
--- drivers/cpufreq/at32ap-cpufreq.c | 49 +++++++++++++++++++++++++++++++++++++--- 1 file changed, 46 insertions(+), 3 deletions(-)
drivers/cpufreq/at32ap-cpufreq.c +46 -3
@@ -19,8 +19,10 @@#include <linux/clk.h> #include <linux/err.h> #include <linux/export.h> +#include <linux/slab.h> static struct clk *cpuclk; +static struct cpufreq_frequency_table *freq_table;static int at32_verify_speed (struct cpufreq_policy *policy) {
@@ -85,13 +87,17 @@ static int at32_set_target(struct cpufreq_policy *policy,static int __init at32_cpufreq_driver_init (struct cpufreq_policy *policy) { +unsigned int frequency, rate; +int retval, steps, i; +if (policy->cpu !=0 )return -EINVAL ; cpuclk =clk_get (NULL ,"cpu" );if (IS_ERR (cpuclk)) {pr_debug ("cpufreq: could not get CPU clk\n" ); -return PTR_ERR (cpuclk); + retval =PTR_ERR (cpuclk); + goto out_err; } policy->cpuinfo.min_freq = (clk_round_rate (cpuclk,1 ) +500 ) /1000 ;
@@ -101,9 +107,46 @@ static int __init at32_cpufreq_driver_init(struct cpufreq_policy *policy) policy->min = policy->cpuinfo.min_freq; policy->max = policy->cpuinfo.max_freq; -printk ("cpufreq: AT32AP CPU frequency driver\n" ); +/* +* AVR32 CPU frequency rate scales in power of two between maximum and +* minimum, also add space for the table end marker. +* +* Further validate that the frequency is usable, and append it to the +* frequency table. +*/ + steps =fls (policy->cpuinfo.max_freq / policy->cpuinfo.min_freq) +1 ; + freq_table =kzalloc (steps *sizeof (struct cpufreq_frequency_table ), +GFP_KERNEL ); +if (!freq_table) { + retval = -ENOMEM ; + goto out_err_put_clk; + } -return 0 ; + frequency = policy->cpuinfo.max_freq; +for (i =0 ; i < (steps -1 ); i++) { + rate =clk_round_rate (cpuclk, frequency *1000 ) /1000 ; + +if (rate != frequency) + freq_table[i].frequency =CPUFREQ_ENTRY_INVALID ; +else + freq_table[i].frequency = frequency; + + frequency /=2 ; + } + + freq_table[steps -1 ].frequency =CPUFREQ_TABLE_END ; + + retval =cpufreq_table_validate_and_show (policy, freq_table); +if (!retval) { +printk ("cpufreq: AT32AP CPU frequency driver\n" ); +return 0 ; + } + +kfree (freq_table); +out_err_put_clk: +clk_put (cpuclk); +out_err: +return retval; }static struct cpufreq_driver at32_driver = {
Signature · 1 line
1.7.12.rc2.18.g61b472e
Viresh Kumar
maintainerPATCH RESEND v2 40/44 cpufreq: arm_big_little: call cpufreq_frequency_table_put_attr()
In reply to Viresh KumarDrivers which have an exit path must call cpufreq_frequency_table_put_attr() if they have called cpufreq_frequency_table_get_attr() in their init path.
This driver was missing this part and is fixed with this patch.
--- drivers/cpufreq/arm_big_little.c | 1 + 1 file changed, 1 insertion(+)
drivers/cpufreq/arm_big_little.c +1 -0
@@ -198,6 +198,7 @@ static int bL_cpufreq_exit(struct cpufreq_policy *policy)return -ENODEV ; } +cpufreq_frequency_table_put_attr (policy->cpu);put_cluster_clk_and_freq_table (cpu_dev);dev_dbg (cpu_dev,"%s: Exited, cpu: %d\n" , __func__, policy->cpu);
Signature · 1 line
1.7.12.rc2.18.g61b472e
Viresh Kumar
maintainerPATCH RESEND v2 41/44 cpufreq: blackfin: call cpufreq_frequency_table_put_attr()
In reply to Viresh KumarDrivers which have an exit path must call cpufreq_frequency_table_put_attr() if they have called cpufreq_frequency_table_get_attr() in their init path.
This driver was missing this part and is fixed with this patch.
--- drivers/cpufreq/blackfin-cpufreq.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/cpufreq/blackfin-cpufreq.c +8 -0
@@ -213,6 +213,13 @@ static int __bfin_cpu_init(struct cpufreq_policy *policy)return cpufreq_table_validate_and_show (policy, bfin_freq_table); } +static int __bfin_cpu_exit (struct cpufreq_policy *policy) +{ + +cpufreq_frequency_table_put_attr (policy->cpu); +return 0 ; +} +static struct freq_attr *bfin_freq_attr[] = { &cpufreq_freq_attr_scaling_available_freqs,NULL ,
@@ -223,6 +230,7 @@ static struct cpufreq_driver bfin_driver = { .target = bfin_target, .get = bfin_getfreq_khz, .init = __bfin_cpu_init, + .exit = __bfin_cpu_exit, .name = "bfin cpufreq", .attr = bfin_freq_attr, };
Signature · 1 line
1.7.12.rc2.18.g61b472e
Viresh Kumar
maintainerPATCH RESEND v2 42/44 cpufreq: exynos: call cpufreq_frequency_table_put_attr()
In reply to Viresh KumarDrivers which have an exit path must call cpufreq_frequency_table_put_attr() if they have called cpufreq_frequency_table_get_attr() in their init path.
This driver was missing this part and is fixed with this patch.
--- drivers/cpufreq/exynos5440-cpufreq.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/cpufreq/exynos5440-cpufreq.c +7 -0
@@ -339,12 +339,19 @@ static int exynos_cpufreq_cpu_init(struct cpufreq_policy *policy)return 0 ; } +static int exynos_cpufreq_cpu_exit (struct cpufreq_policy *policy) +{ +cpufreq_frequency_table_put_attr (policy->cpu); +return 0 ; +} +static struct cpufreq_driver exynos_driver = { .flags =CPUFREQ_STICKY , .verify = exynos_verify_speed, .target = exynos_target, .get = exynos_getspeed, .init = exynos_cpufreq_cpu_init, + .exit = exynos_cpufreq_cpu_exit, .name =CPUFREQ_NAME , };
Signature · 1 line
1.7.12.rc2.18.g61b472e
Viresh Kumar
maintainerPATCH RESEND v2 43/44 cpufreq: loongson2: call cpufreq_frequency_table_put_attr()
In reply to Viresh KumarDrivers which have an exit path must call cpufreq_frequency_table_put_attr() if they have called cpufreq_frequency_table_get_attr() in their init path.
This driver was missing this part and is fixed with this patch.
--- drivers/cpufreq/loongson2_cpufreq.c | 1 + 1 file changed, 1 insertion(+)
drivers/cpufreq/loongson2_cpufreq.c +1 -0
@@ -145,6 +145,7 @@ static int loongson2_cpufreq_verify(struct cpufreq_policy *policy)static int loongson2_cpufreq_exit (struct cpufreq_policy *policy) { +cpufreq_frequency_table_put_attr (policy->cpu);clk_put (cpuclk);return 0 ; }
Signature · 1 line
1.7.12.rc2.18.g61b472e
Viresh Kumar
maintainerPATCH RESEND v2 44/44 cpufreq: omap: call cpufreq_frequency_table_put_attr()
In reply to Viresh KumarDrivers which have an exit path must call cpufreq_frequency_table_put_attr() if they have called cpufreq_frequency_table_get_attr() in their init path.
This driver was missing this part and is fixed with this patch.
--- drivers/cpufreq/omap-cpufreq.c | 1 + 1 file changed, 1 insertion(+)
drivers/cpufreq/omap-cpufreq.c +1 -0
@@ -221,6 +221,7 @@ fail_ck:static int omap_cpu_exit (struct cpufreq_policy *policy) { +cpufreq_frequency_table_put_attr (policy->cpu);freq_table_free ();clk_put (mpu_clk);return 0 ;
Signature · 1 line
1.7.12.rc2.18.g61b472e