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


Groups > linux.kernel > #1531176 > unrolled thread

Re: [PATCH v3] cpufreq: brcmstb-cpufreq: CPUfreq driver for older Broadcom STB SoCs

Started byArnd Bergmann <arnd@arndb.de>
First post2016-11-28 11:20 +0100
Last post2016-12-02 02:00 +0100
Articles 6 — 3 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH v3] cpufreq: brcmstb-cpufreq: CPUfreq driver for older Broadcom STB SoCs Arnd Bergmann <arnd@arndb.de> - 2016-11-28 11:20 +0100
    Re: [PATCH v3] cpufreq: brcmstb-cpufreq: CPUfreq driver for older  Broadcom STB SoCs "Rafael J. Wysocki" <rafael@kernel.org> - 2016-11-28 14:30 +0100
    Re: [PATCH v3] cpufreq: brcmstb-cpufreq: CPUfreq driver for older  Broadcom STB SoCs Markus Mayer <markus.mayer@broadcom.com> - 2016-11-28 18:20 +0100
      Re: [PATCH v3] cpufreq: brcmstb-cpufreq: CPUfreq driver for older Broadcom STB SoCs Arnd Bergmann <arnd@arndb.de> - 2016-11-28 22:00 +0100
        Re: [PATCH v3] cpufreq: brcmstb-cpufreq: CPUfreq driver for older  Broadcom STB SoCs Markus Mayer <markus.mayer@broadcom.com> - 2016-11-28 22:10 +0100
    Re: [PATCH v3] cpufreq: brcmstb-cpufreq: CPUfreq driver for older  Broadcom STB SoCs Markus Mayer <markus.mayer@broadcom.com> - 2016-12-02 02:00 +0100

#1531176 — Re: [PATCH v3] cpufreq: brcmstb-cpufreq: CPUfreq driver for older Broadcom STB SoCs

FromArnd Bergmann <arnd@arndb.de>
Date2016-11-28 11:20 +0100
SubjectRe: [PATCH v3] cpufreq: brcmstb-cpufreq: CPUfreq driver for older Broadcom STB SoCs
Message-ID<sIrct-P3-23@gated-at.bofh.it>
On Tuesday, November 22, 2016 1:32:45 PM CET Markus Mayer wrote:
> From: Markus Mayer <mmayer@broadcom.com>
> 
> This CPUfreq driver provides basic frequency scaling for older Broadcom
> STB SoCs that do not use AVS firmware with DVFS support. There is no
> support for voltage scaling.
> 
> Signed-off-by: Markus Mayer <mmayer@broadcom.com>
> Acked-by: Viresh Kumar <viresh.kumar@linaro.org>

This causes multiple build errors in linux-next, please fix asap or
drop the patch again. My feeling is that it's probably too late to
fix it for v4.10, but that's up to Viresh and Rafael of course.

> +#define BRCMSTB_CPUFREQ_PREFIX	"brcmstb"
> +#define BRCMSTB_CPUFREQ_NAME	BRCMSTB_CPUFREQ_PREFIX "-cpufreq"
> +
> +/* We search for these compatible strings. */
> +#define BRCMSTB_DT_CPU_CLK_CTRL	"brcm,brcmstb-cpu-clk-div"
> +#define BRCMSTB_DT_MEMC_DDR	"brcm,brcmstb-memc-ddr"
> +#define BRCM_AVS_CPU_DATA	"brcm,avs-cpu-data-mem"
> +
> +/* We also need a few clocks in device tree. These are node names. */
> +#define BRCMSTB_CLK_MDIV_CH0	"cpu_mdiv_ch0"
> +#define BRCMSTB_CLK_NDIV_INT	"cpu_ndiv_int"
> +#define BRCMSTB_CLK_SW_SCB	"sw_scb"

Not critical but the use of those macros obfuscates the DT interfaces
here and made it harder to analyse what was going on.

Also, a couple of them are lacking a DT binding.

> +static int get_frequencies(const struct cpufreq_policy *policy,
> +			   unsigned int *vco_freq, unsigned int *cpu_freq,
> +			   unsigned int *scb_freq)
> +{
> +	struct clk *cpu_ndiv_int, *sw_scb;
> +
> +	cpu_ndiv_int = __clk_lookup(BRCMSTB_CLK_NDIV_INT);
> +	if (!cpu_ndiv_int)
> +		return -ENODEV;
> +
> +	sw_scb = __clk_lookup(BRCMSTB_CLK_SW_SCB);
> +	if (!sw_scb)
> +		return -ENODEV;
> +
> +	/* return frequencies in kHz */
> +	*vco_freq = clk_get_rate(cpu_ndiv_int) / 1000;
> +	*cpu_freq = clk_get_rate(policy->clk) / 1000;
> +	*scb_freq = clk_get_rate(sw_scb) / 1000;
> +
> +	return 0;
> +}

You really can't do this: 

../drivers/cpufreq/brcmstb-cpufreq.c: In function 'get_frequencies':
../drivers/cpufreq/brcmstb-cpufreq.c:71:17: error: implicit declaration of function '__clk_lookup';did you mean 'key_lookup'? [-Werror=implicit-function-declaration]
  cpu_ndiv_int = __clk_lookup(BRCMSTB_CLK_NDIV_INT);
                 ^~~~~~~~~~~~

__clk_lookup is an internal API for the clk providers.

In particular, relying on undocumented internal names of the
clk provider in a device driver is inappropriate.

> +static const struct of_device_id brcmstb_cpufreq_match[] = {
> +	{ .compatible = BRCMSTB_DT_CPU_CLK_CTRL },
> +	{ }
> +};
> +MODULE_DEVICE_TABLE(platform, brcmstb_cpufreq_match);

This is a simple typo, also causing the build to fail:

    FATAL: drivers/cpufreq/brcmstb-cpufreq: sizeof(struct platform_device_id)=24 is not a modulo of the size of section __mod_platform__<identifier>_device_table=392.

	Arnd

[toc] | [next] | [standalone]


#1531301 — Re: [PATCH v3] cpufreq: brcmstb-cpufreq: CPUfreq driver for older Broadcom STB SoCs

From"Rafael J. Wysocki" <rafael@kernel.org>
Date2016-11-28 14:30 +0100
SubjectRe: [PATCH v3] cpufreq: brcmstb-cpufreq: CPUfreq driver for older Broadcom STB SoCs
Message-ID<sIuam-2Cp-29@gated-at.bofh.it>
In reply to#1531176
On Mon, Nov 28, 2016 at 11:14 AM, Arnd Bergmann <arnd@arndb.de> wrote:
> On Tuesday, November 22, 2016 1:32:45 PM CET Markus Mayer wrote:
>> From: Markus Mayer <mmayer@broadcom.com>
>>
>> This CPUfreq driver provides basic frequency scaling for older Broadcom
>> STB SoCs that do not use AVS firmware with DVFS support. There is no
>> support for voltage scaling.
>>
>> Signed-off-by: Markus Mayer <mmayer@broadcom.com>
>> Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
>
> This causes multiple build errors in linux-next, please fix asap or
> drop the patch again. My feeling is that it's probably too late to
> fix it for v4.10, but that's up to Viresh and Rafael of course.
>
>> +#define BRCMSTB_CPUFREQ_PREFIX       "brcmstb"
>> +#define BRCMSTB_CPUFREQ_NAME BRCMSTB_CPUFREQ_PREFIX "-cpufreq"
>> +
>> +/* We search for these compatible strings. */
>> +#define BRCMSTB_DT_CPU_CLK_CTRL      "brcm,brcmstb-cpu-clk-div"
>> +#define BRCMSTB_DT_MEMC_DDR  "brcm,brcmstb-memc-ddr"
>> +#define BRCM_AVS_CPU_DATA    "brcm,avs-cpu-data-mem"
>> +
>> +/* We also need a few clocks in device tree. These are node names. */
>> +#define BRCMSTB_CLK_MDIV_CH0 "cpu_mdiv_ch0"
>> +#define BRCMSTB_CLK_NDIV_INT "cpu_ndiv_int"
>> +#define BRCMSTB_CLK_SW_SCB   "sw_scb"
>
> Not critical but the use of those macros obfuscates the DT interfaces
> here and made it harder to analyse what was going on.
>
> Also, a couple of them are lacking a DT binding.
>
>> +static int get_frequencies(const struct cpufreq_policy *policy,
>> +                        unsigned int *vco_freq, unsigned int *cpu_freq,
>> +                        unsigned int *scb_freq)
>> +{
>> +     struct clk *cpu_ndiv_int, *sw_scb;
>> +
>> +     cpu_ndiv_int = __clk_lookup(BRCMSTB_CLK_NDIV_INT);
>> +     if (!cpu_ndiv_int)
>> +             return -ENODEV;
>> +
>> +     sw_scb = __clk_lookup(BRCMSTB_CLK_SW_SCB);
>> +     if (!sw_scb)
>> +             return -ENODEV;
>> +
>> +     /* return frequencies in kHz */
>> +     *vco_freq = clk_get_rate(cpu_ndiv_int) / 1000;
>> +     *cpu_freq = clk_get_rate(policy->clk) / 1000;
>> +     *scb_freq = clk_get_rate(sw_scb) / 1000;
>> +
>> +     return 0;
>> +}
>
> You really can't do this:
>
> ../drivers/cpufreq/brcmstb-cpufreq.c: In function 'get_frequencies':
> ../drivers/cpufreq/brcmstb-cpufreq.c:71:17: error: implicit declaration of function '__clk_lookup';did you mean 'key_lookup'? [-Werror=implicit-function-declaration]
>   cpu_ndiv_int = __clk_lookup(BRCMSTB_CLK_NDIV_INT);
>                  ^~~~~~~~~~~~
>
> __clk_lookup is an internal API for the clk providers.
>
> In particular, relying on undocumented internal names of the
> clk provider in a device driver is inappropriate.
>
>> +static const struct of_device_id brcmstb_cpufreq_match[] = {
>> +     { .compatible = BRCMSTB_DT_CPU_CLK_CTRL },
>> +     { }
>> +};
>> +MODULE_DEVICE_TABLE(platform, brcmstb_cpufreq_match);
>
> This is a simple typo, also causing the build to fail:
>
>     FATAL: drivers/cpufreq/brcmstb-cpufreq: sizeof(struct platform_device_id)=24 is not a modulo of the size of section __mod_platform__<identifier>_device_table=392.
>

I've dropped the patch.

Markus, please fix the problems pointed out by Arnd and resend.

Thanks,
Rafael

[toc] | [prev] | [next] | [standalone]


#1531460 — Re: [PATCH v3] cpufreq: brcmstb-cpufreq: CPUfreq driver for older Broadcom STB SoCs

FromMarkus Mayer <markus.mayer@broadcom.com>
Date2016-11-28 18:20 +0100
SubjectRe: [PATCH v3] cpufreq: brcmstb-cpufreq: CPUfreq driver for older Broadcom STB SoCs
Message-ID<sIxKW-4YT-41@gated-at.bofh.it>
In reply to#1531176
On 28 November 2016 at 02:14, Arnd Bergmann <arnd@arndb.de> wrote:
> On Tuesday, November 22, 2016 1:32:45 PM CET Markus Mayer wrote:
>> From: Markus Mayer <mmayer@broadcom.com>
>>
>> This CPUfreq driver provides basic frequency scaling for older Broadcom
>> STB SoCs that do not use AVS firmware with DVFS support. There is no
>> support for voltage scaling.
>>
>> Signed-off-by: Markus Mayer <mmayer@broadcom.com>
>> Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
>
> This causes multiple build errors in linux-next, please fix asap or
> drop the patch again. My feeling is that it's probably too late to
> fix it for v4.10, but that's up to Viresh and Rafael of course.
>
>> +#define BRCMSTB_CPUFREQ_PREFIX       "brcmstb"
>> +#define BRCMSTB_CPUFREQ_NAME BRCMSTB_CPUFREQ_PREFIX "-cpufreq"
>> +
>> +/* We search for these compatible strings. */
>> +#define BRCMSTB_DT_CPU_CLK_CTRL      "brcm,brcmstb-cpu-clk-div"
>> +#define BRCMSTB_DT_MEMC_DDR  "brcm,brcmstb-memc-ddr"
>> +#define BRCM_AVS_CPU_DATA    "brcm,avs-cpu-data-mem"
>> +
>> +/* We also need a few clocks in device tree. These are node names. */
>> +#define BRCMSTB_CLK_MDIV_CH0 "cpu_mdiv_ch0"
>> +#define BRCMSTB_CLK_NDIV_INT "cpu_ndiv_int"
>> +#define BRCMSTB_CLK_SW_SCB   "sw_scb"
>
> Not critical but the use of those macros obfuscates the DT interfaces
> here and made it harder to analyse what was going on.
>
> Also, a couple of them are lacking a DT binding.
>
>> +static int get_frequencies(const struct cpufreq_policy *policy,
>> +                        unsigned int *vco_freq, unsigned int *cpu_freq,
>> +                        unsigned int *scb_freq)
>> +{
>> +     struct clk *cpu_ndiv_int, *sw_scb;
>> +
>> +     cpu_ndiv_int = __clk_lookup(BRCMSTB_CLK_NDIV_INT);
>> +     if (!cpu_ndiv_int)
>> +             return -ENODEV;
>> +
>> +     sw_scb = __clk_lookup(BRCMSTB_CLK_SW_SCB);
>> +     if (!sw_scb)
>> +             return -ENODEV;
>> +
>> +     /* return frequencies in kHz */
>> +     *vco_freq = clk_get_rate(cpu_ndiv_int) / 1000;
>> +     *cpu_freq = clk_get_rate(policy->clk) / 1000;
>> +     *scb_freq = clk_get_rate(sw_scb) / 1000;
>> +
>> +     return 0;
>> +}
>
> You really can't do this:
>
> ../drivers/cpufreq/brcmstb-cpufreq.c: In function 'get_frequencies':
> ../drivers/cpufreq/brcmstb-cpufreq.c:71:17: error: implicit declaration of function '__clk_lookup';did you mean 'key_lookup'? [-Werror=implicit-function-declaration]
>   cpu_ndiv_int = __clk_lookup(BRCMSTB_CLK_NDIV_INT);
>                  ^~~~~~~~~~~~
>
> __clk_lookup is an internal API for the clk providers.
>
> In particular, relying on undocumented internal names of the
> clk provider in a device driver is inappropriate.

What compiler are you using? I didn't get any warnings. Otherwise I
would have known right away that something isn't right.

>> +static const struct of_device_id brcmstb_cpufreq_match[] = {
>> +     { .compatible = BRCMSTB_DT_CPU_CLK_CTRL },
>> +     { }
>> +};
>> +MODULE_DEVICE_TABLE(platform, brcmstb_cpufreq_match);
>
> This is a simple typo, also causing the build to fail:
>
>     FATAL: drivers/cpufreq/brcmstb-cpufreq: sizeof(struct platform_device_id)=24 is not a modulo of the size of section __mod_platform__<identifier>_device_table=392.

What is the typo, if I may ask. Again strange, since the build doesn't
fail for me. What was the configuration you used?

>         Arnd

[toc] | [prev] | [next] | [standalone]


#1531653

FromArnd Bergmann <arnd@arndb.de>
Date2016-11-28 22:00 +0100
Message-ID<sIBbP-72M-1@gated-at.bofh.it>
In reply to#1531460
On Monday, November 28, 2016 9:12:05 AM CET Markus Mayer wrote:
> >> +static int get_frequencies(const struct cpufreq_policy *policy,
> >> +                        unsigned int *vco_freq, unsigned int *cpu_freq,
> >> +                        unsigned int *scb_freq)
> >> +{
> >> +     struct clk *cpu_ndiv_int, *sw_scb;
> >> +
> >> +     cpu_ndiv_int = __clk_lookup(BRCMSTB_CLK_NDIV_INT);
> >> +     if (!cpu_ndiv_int)
> >> +             return -ENODEV;
> >> +
> >> +     sw_scb = __clk_lookup(BRCMSTB_CLK_SW_SCB);
> >> +     if (!sw_scb)
> >> +             return -ENODEV;
> >> +
> >> +     /* return frequencies in kHz */
> >> +     *vco_freq = clk_get_rate(cpu_ndiv_int) / 1000;
> >> +     *cpu_freq = clk_get_rate(policy->clk) / 1000;
> >> +     *scb_freq = clk_get_rate(sw_scb) / 1000;
> >> +
> >> +     return 0;
> >> +}
> >
> > You really can't do this:
> >
> > ../drivers/cpufreq/brcmstb-cpufreq.c: In function 'get_frequencies':
> > ../drivers/cpufreq/brcmstb-cpufreq.c:71:17: error: implicit declaration of function '__clk_lookup';did you mean 'key_lookup'? [-Werror=implicit-function-declaration]
> >   cpu_ndiv_int = __clk_lookup(BRCMSTB_CLK_NDIV_INT);
> >                  ^~~~~~~~~~~~
> >
> > __clk_lookup is an internal API for the clk providers.
> >
> > In particular, relying on undocumented internal names of the
> > clk provider in a device driver is inappropriate.
> 
> What compiler are you using? I didn't get any warnings. Otherwise I
> would have known right away that something isn't right.

This is a randconfig build with CONFIG_COMMON_CLK=n. There is a different
problem with COMMON_CLK=y and the cpufreq driver as a loadable module,
where the symbol causes a link error.

I did not get any warnings either, these are both hard errors.

> >> +static const struct of_device_id brcmstb_cpufreq_match[] = {
> >> +     { .compatible = BRCMSTB_DT_CPU_CLK_CTRL },
> >> +     { }
> >> +};
> >> +MODULE_DEVICE_TABLE(platform, brcmstb_cpufreq_match);
> >
> > This is a simple typo, also causing the build to fail:
> >
> >     FATAL: drivers/cpufreq/brcmstb-cpufreq: sizeof(struct platform_device_id)=24 is not a modulo of the size of section __mod_platform__<identifier>_device_table=392.
> 
> What is the typo, if I may ask. Again strange, since the build doesn't
> fail for me. What was the configuration you used?

MODULE_DEVICE_TABLE() is only used when building a loadable module,
e.g. in allmodconfig.

MODULE_DEVICE_TABLE(platform, ...) is for 'struct platform_device_id'.
You need to use MODULE_DEVICE_TABLE(of, ...) for 'struct of_device_id'.

	Arnd

[toc] | [prev] | [next] | [standalone]


#1531661 — Re: [PATCH v3] cpufreq: brcmstb-cpufreq: CPUfreq driver for older Broadcom STB SoCs

FromMarkus Mayer <markus.mayer@broadcom.com>
Date2016-11-28 22:10 +0100
SubjectRe: [PATCH v3] cpufreq: brcmstb-cpufreq: CPUfreq driver for older Broadcom STB SoCs
Message-ID<sIBlv-7lp-9@gated-at.bofh.it>
In reply to#1531653
On 28 November 2016 at 12:58, Arnd Bergmann <arnd@arndb.de> wrote:
> On Monday, November 28, 2016 9:12:05 AM CET Markus Mayer wrote:
>> >> +static int get_frequencies(const struct cpufreq_policy *policy,
>> >> +                        unsigned int *vco_freq, unsigned int *cpu_freq,
>> >> +                        unsigned int *scb_freq)
>> >> +{
>> >> +     struct clk *cpu_ndiv_int, *sw_scb;
>> >> +
>> >> +     cpu_ndiv_int = __clk_lookup(BRCMSTB_CLK_NDIV_INT);
>> >> +     if (!cpu_ndiv_int)
>> >> +             return -ENODEV;
>> >> +
>> >> +     sw_scb = __clk_lookup(BRCMSTB_CLK_SW_SCB);
>> >> +     if (!sw_scb)
>> >> +             return -ENODEV;
>> >> +
>> >> +     /* return frequencies in kHz */
>> >> +     *vco_freq = clk_get_rate(cpu_ndiv_int) / 1000;
>> >> +     *cpu_freq = clk_get_rate(policy->clk) / 1000;
>> >> +     *scb_freq = clk_get_rate(sw_scb) / 1000;
>> >> +
>> >> +     return 0;
>> >> +}
>> >
>> > You really can't do this:
>> >
>> > ../drivers/cpufreq/brcmstb-cpufreq.c: In function 'get_frequencies':
>> > ../drivers/cpufreq/brcmstb-cpufreq.c:71:17: error: implicit declaration of function '__clk_lookup';did you mean 'key_lookup'? [-Werror=implicit-function-declaration]
>> >   cpu_ndiv_int = __clk_lookup(BRCMSTB_CLK_NDIV_INT);
>> >                  ^~~~~~~~~~~~
>> >
>> > __clk_lookup is an internal API for the clk providers.
>> >
>> > In particular, relying on undocumented internal names of the
>> > clk provider in a device driver is inappropriate.
>>
>> What compiler are you using? I didn't get any warnings. Otherwise I
>> would have known right away that something isn't right.
>
> This is a randconfig build with CONFIG_COMMON_CLK=n. There is a different
> problem with COMMON_CLK=y and the cpufreq driver as a loadable module,
> where the symbol causes a link error.
>
> I did not get any warnings either, these are both hard errors.
>
>> >> +static const struct of_device_id brcmstb_cpufreq_match[] = {
>> >> +     { .compatible = BRCMSTB_DT_CPU_CLK_CTRL },
>> >> +     { }
>> >> +};
>> >> +MODULE_DEVICE_TABLE(platform, brcmstb_cpufreq_match);
>> >
>> > This is a simple typo, also causing the build to fail:
>> >
>> >     FATAL: drivers/cpufreq/brcmstb-cpufreq: sizeof(struct platform_device_id)=24 is not a modulo of the size of section __mod_platform__<identifier>_device_table=392.
>>
>> What is the typo, if I may ask. Again strange, since the build doesn't
>> fail for me. What was the configuration you used?
>
> MODULE_DEVICE_TABLE() is only used when building a loadable module,
> e.g. in allmodconfig.
>
> MODULE_DEVICE_TABLE(platform, ...) is for 'struct platform_device_id'.
> You need to use MODULE_DEVICE_TABLE(of, ...) for 'struct of_device_id'.

Got it. Thanks.

I fixed this problem and the
IS_ENABLED(CONFIG_ARM_BRCMSTB_AVS_CPUFREQ) issue in my copy. I'll need
to look a bit more what I can do instead of calling __clk_lookup().

Regards,
-Markus

[toc] | [prev] | [next] | [standalone]


#1534605 — Re: [PATCH v3] cpufreq: brcmstb-cpufreq: CPUfreq driver for older Broadcom STB SoCs

FromMarkus Mayer <markus.mayer@broadcom.com>
Date2016-12-02 02:00 +0100
SubjectRe: [PATCH v3] cpufreq: brcmstb-cpufreq: CPUfreq driver for older Broadcom STB SoCs
Message-ID<sJKmK-4Kj-5@gated-at.bofh.it>
In reply to#1531176
On 28 November 2016 at 02:14, Arnd Bergmann <arnd@arndb.de> wrote:
> On Tuesday, November 22, 2016 1:32:45 PM CET Markus Mayer wrote:
>> From: Markus Mayer <mmayer@broadcom.com>
>>
>> This CPUfreq driver provides basic frequency scaling for older Broadcom
>> STB SoCs that do not use AVS firmware with DVFS support. There is no
>> support for voltage scaling.
>>
>> Signed-off-by: Markus Mayer <mmayer@broadcom.com>
>> Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
>
> This causes multiple build errors in linux-next, please fix asap or
> drop the patch again. My feeling is that it's probably too late to
> fix it for v4.10, but that's up to Viresh and Rafael of course.
>
>> +#define BRCMSTB_CPUFREQ_PREFIX       "brcmstb"
>> +#define BRCMSTB_CPUFREQ_NAME BRCMSTB_CPUFREQ_PREFIX "-cpufreq"
>> +
>> +/* We search for these compatible strings. */
>> +#define BRCMSTB_DT_CPU_CLK_CTRL      "brcm,brcmstb-cpu-clk-div"
>> +#define BRCMSTB_DT_MEMC_DDR  "brcm,brcmstb-memc-ddr"
>> +#define BRCM_AVS_CPU_DATA    "brcm,avs-cpu-data-mem"
>> +
>> +/* We also need a few clocks in device tree. These are node names. */
>> +#define BRCMSTB_CLK_MDIV_CH0 "cpu_mdiv_ch0"
>> +#define BRCMSTB_CLK_NDIV_INT "cpu_ndiv_int"
>> +#define BRCMSTB_CLK_SW_SCB   "sw_scb"
>
> Not critical but the use of those macros obfuscates the DT interfaces
> here and made it harder to analyse what was going on.
>
> Also, a couple of them are lacking a DT binding.
>
>> +static int get_frequencies(const struct cpufreq_policy *policy,
>> +                        unsigned int *vco_freq, unsigned int *cpu_freq,
>> +                        unsigned int *scb_freq)
>> +{
>> +     struct clk *cpu_ndiv_int, *sw_scb;
>> +
>> +     cpu_ndiv_int = __clk_lookup(BRCMSTB_CLK_NDIV_INT);
>> +     if (!cpu_ndiv_int)
>> +             return -ENODEV;
>> +
>> +     sw_scb = __clk_lookup(BRCMSTB_CLK_SW_SCB);
>> +     if (!sw_scb)
>> +             return -ENODEV;
>> +
>> +     /* return frequencies in kHz */
>> +     *vco_freq = clk_get_rate(cpu_ndiv_int) / 1000;
>> +     *cpu_freq = clk_get_rate(policy->clk) / 1000;
>> +     *scb_freq = clk_get_rate(sw_scb) / 1000;
>> +
>> +     return 0;
>> +}
>
> You really can't do this:
>
> ../drivers/cpufreq/brcmstb-cpufreq.c: In function 'get_frequencies':
> ../drivers/cpufreq/brcmstb-cpufreq.c:71:17: error: implicit declaration of function '__clk_lookup';did you mean 'key_lookup'? [-Werror=implicit-function-declaration]
>   cpu_ndiv_int = __clk_lookup(BRCMSTB_CLK_NDIV_INT);
>                  ^~~~~~~~~~~~
>
> __clk_lookup is an internal API for the clk providers.
>
> In particular, relying on undocumented internal names of the
> clk provider in a device driver is inappropriate.

Do you happen to know of an "approved" way of looking up a clock node?
Everything we need is in device tree. We can certainly add bindings
for the missing nodes. It just seems somewhat difficult to get at the
information in a clean way.

>> +static const struct of_device_id brcmstb_cpufreq_match[] = {
>> +     { .compatible = BRCMSTB_DT_CPU_CLK_CTRL },
>> +     { }
>> +};
>> +MODULE_DEVICE_TABLE(platform, brcmstb_cpufreq_match);
>
> This is a simple typo, also causing the build to fail:
>
>     FATAL: drivers/cpufreq/brcmstb-cpufreq: sizeof(struct platform_device_id)=24 is not a modulo of the size of section __mod_platform__<identifier>_device_table=392.
>
>         Arnd

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web