Message ID | 236b227e929e5adc04d1e9e7af6845a46c8e9432.1737525916.git.viresh.kumar@linaro.org (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | [V2] cpufreq: s3c64xx: Fix compilation warning | expand |
On Wed, Jan 22, 2025 at 7:06 AM Viresh Kumar <viresh.kumar@linaro.org> wrote: > > The driver generates following warning when regulator support isn't > enabled in the kernel. Fix it. > > drivers/cpufreq/s3c64xx-cpufreq.c: In function 's3c64xx_cpufreq_set_target': > >> drivers/cpufreq/s3c64xx-cpufreq.c:55:22: warning: variable 'old_freq' set but not used [-Wunused-but-set-variable] > 55 | unsigned int old_freq, new_freq; > | ^~~~~~~~ > >> drivers/cpufreq/s3c64xx-cpufreq.c:54:30: warning: variable 'dvfs' set but not used [-Wunused-but-set-variable] > 54 | struct s3c64xx_dvfs *dvfs; > | ^~~~ > > Reported-by: kernel test robot <lkp@intel.com> > Closes: https://lore.kernel.org/oe-kbuild-all/202501191803.CtfT7b2o-lkp@intel.com/ > Cc: <stable@vger.kernel.org> # v5.4+ > Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> > --- > V2: Move s3c64xx_dvfs_table too inside ifdef. Applied as 6.14-rc material. If you'd rather apply it yourself, please let me know and I'll drop it. Thanks! > drivers/cpufreq/s3c64xx-cpufreq.c | 11 +++++++---- > 1 file changed, 7 insertions(+), 4 deletions(-) > > diff --git a/drivers/cpufreq/s3c64xx-cpufreq.c b/drivers/cpufreq/s3c64xx-cpufreq.c > index c6bdfc308e99..9cef71528076 100644 > --- a/drivers/cpufreq/s3c64xx-cpufreq.c > +++ b/drivers/cpufreq/s3c64xx-cpufreq.c > @@ -24,6 +24,7 @@ struct s3c64xx_dvfs { > unsigned int vddarm_max; > }; > > +#ifdef CONFIG_REGULATOR > static struct s3c64xx_dvfs s3c64xx_dvfs_table[] = { > [0] = { 1000000, 1150000 }, > [1] = { 1050000, 1150000 }, > @@ -31,6 +32,7 @@ static struct s3c64xx_dvfs s3c64xx_dvfs_table[] = { > [3] = { 1200000, 1350000 }, > [4] = { 1300000, 1350000 }, > }; > +#endif > > static struct cpufreq_frequency_table s3c64xx_freq_table[] = { > { 0, 0, 66000 }, > @@ -51,15 +53,16 @@ static struct cpufreq_frequency_table s3c64xx_freq_table[] = { > static int s3c64xx_cpufreq_set_target(struct cpufreq_policy *policy, > unsigned int index) > { > - struct s3c64xx_dvfs *dvfs; > - unsigned int old_freq, new_freq; > + unsigned int new_freq = s3c64xx_freq_table[index].frequency; > int ret; > > +#ifdef CONFIG_REGULATOR > + struct s3c64xx_dvfs *dvfs; > + unsigned int old_freq; > + > old_freq = clk_get_rate(policy->clk) / 1000; > - new_freq = s3c64xx_freq_table[index].frequency; > dvfs = &s3c64xx_dvfs_table[s3c64xx_freq_table[index].driver_data]; > > -#ifdef CONFIG_REGULATOR > if (vddarm && new_freq > old_freq) { > ret = regulator_set_voltage(vddarm, > dvfs->vddarm_min, > -- > 2.31.1.272.g89b43f80a514 > >
On 23-01-25, 20:48, Rafael J. Wysocki wrote: > On Wed, Jan 22, 2025 at 7:06 AM Viresh Kumar <viresh.kumar@linaro.org> wrote: > > > > The driver generates following warning when regulator support isn't > > enabled in the kernel. Fix it. > > > > drivers/cpufreq/s3c64xx-cpufreq.c: In function 's3c64xx_cpufreq_set_target': > > >> drivers/cpufreq/s3c64xx-cpufreq.c:55:22: warning: variable 'old_freq' set but not used [-Wunused-but-set-variable] > > 55 | unsigned int old_freq, new_freq; > > | ^~~~~~~~ > > >> drivers/cpufreq/s3c64xx-cpufreq.c:54:30: warning: variable 'dvfs' set but not used [-Wunused-but-set-variable] > > 54 | struct s3c64xx_dvfs *dvfs; > > | ^~~~ > > > > Reported-by: kernel test robot <lkp@intel.com> > > Closes: https://lore.kernel.org/oe-kbuild-all/202501191803.CtfT7b2o-lkp@intel.com/ > > Cc: <stable@vger.kernel.org> # v5.4+ > > Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> > > --- > > V2: Move s3c64xx_dvfs_table too inside ifdef. > > Applied as 6.14-rc material. Thanks.
diff --git a/drivers/cpufreq/s3c64xx-cpufreq.c b/drivers/cpufreq/s3c64xx-cpufreq.c index c6bdfc308e99..9cef71528076 100644 --- a/drivers/cpufreq/s3c64xx-cpufreq.c +++ b/drivers/cpufreq/s3c64xx-cpufreq.c @@ -24,6 +24,7 @@ struct s3c64xx_dvfs { unsigned int vddarm_max; }; +#ifdef CONFIG_REGULATOR static struct s3c64xx_dvfs s3c64xx_dvfs_table[] = { [0] = { 1000000, 1150000 }, [1] = { 1050000, 1150000 }, @@ -31,6 +32,7 @@ static struct s3c64xx_dvfs s3c64xx_dvfs_table[] = { [3] = { 1200000, 1350000 }, [4] = { 1300000, 1350000 }, }; +#endif static struct cpufreq_frequency_table s3c64xx_freq_table[] = { { 0, 0, 66000 }, @@ -51,15 +53,16 @@ static struct cpufreq_frequency_table s3c64xx_freq_table[] = { static int s3c64xx_cpufreq_set_target(struct cpufreq_policy *policy, unsigned int index) { - struct s3c64xx_dvfs *dvfs; - unsigned int old_freq, new_freq; + unsigned int new_freq = s3c64xx_freq_table[index].frequency; int ret; +#ifdef CONFIG_REGULATOR + struct s3c64xx_dvfs *dvfs; + unsigned int old_freq; + old_freq = clk_get_rate(policy->clk) / 1000; - new_freq = s3c64xx_freq_table[index].frequency; dvfs = &s3c64xx_dvfs_table[s3c64xx_freq_table[index].driver_data]; -#ifdef CONFIG_REGULATOR if (vddarm && new_freq > old_freq) { ret = regulator_set_voltage(vddarm, dvfs->vddarm_min,