public inbox for devicetree@vger.kernel.org
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: Markus Mayer <code@mmayer.net>
Cc: Device Tree <devicetree@vger.kernel.org>,
	Power Management List <linux-pm@vger.kernel.org>,
	Viresh Kumar <viresh.kumar@linaro.org>,
	"Rafael J . Wysocki" <rjw@rjwysocki.net>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Broadcom Kernel List <bcm-kernel-feedback-list@broadcom.com>,
	Markus Mayer <mmayer@broadcom.com>,
	linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org
Subject: fwd, Re: [PATCH v3] cpufreq: brcmstb-cpufreq: CPUfreq driver for older Broadcom STB SoCs
Date: Mon, 28 Nov 2016 11:16:48 +0100	[thread overview]
Message-ID: <5336918.eLmd7pA3eN@wuerfel> (raw)
In-Reply-To: <20161122213245.17955-1-code@mmayer.net>

[resending my mail, this time with devicetree, linux-clk, and linux-arm-kernel
on cc]

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

           reply	other threads:[~2016-11-28 10:16 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <20161122213245.17955-1-code@mmayer.net>]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5336918.eLmd7pA3eN@wuerfel \
    --to=arnd@arndb.de \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=code@mmayer.net \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=mmayer@broadcom.com \
    --cc=rjw@rjwysocki.net \
    --cc=viresh.kumar@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox