Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754503AbcK1KPl (ORCPT ); Mon, 28 Nov 2016 05:15:41 -0500 Received: from mout.kundenserver.de ([212.227.17.24]:57755 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754249AbcK1KOo (ORCPT ); Mon, 28 Nov 2016 05:14:44 -0500 From: Arnd Bergmann To: Markus Mayer Cc: Viresh Kumar , "Rafael J . Wysocki" , Power Management List , Broadcom Kernel List , Linux Kernel Mailing List , Markus Mayer Subject: Re: [PATCH v3] cpufreq: brcmstb-cpufreq: CPUfreq driver for older Broadcom STB SoCs Date: Mon, 28 Nov 2016 11:14:36 +0100 Message-ID: <8526810.ogr5uYm3lV@wuerfel> User-Agent: KMail/5.1.3 (Linux/4.4.0-34-generic; KDE/5.18.0; x86_64; ; ) In-Reply-To: <20161122213245.17955-1-code@mmayer.net> References: <20161122213245.17955-1-code@mmayer.net> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Provags-ID: V03:K0:eeOhp5AF58cVr+H8dxbY9Q0xBYXkXC/V4BqJfCTDE6tp1jh7Ih6 C+NBSF5H/J0J8nChJlmNI/f8RtzyfleY/S3gmamfV+OWfpnZzJWu1EODy5HByOoO62Jbkgy vjoGv7qijYlV5JyIGbfeTDPU45HFRYkTWipCtOgISs96dO1mRw/uJbenQ4zf8UXtelueZkA mOWJ8ZYk0EvIQHFFp2WeA== X-UI-Out-Filterresults: notjunk:1;V01:K0:CcyVtGtu6gU=:/mRhAD4pQVBP7cVmXl67dY TerWmn9XPHhGClHl60C+GfgoN05NMdXN+O4wOzsjVHYLKx3NDI1MUJvYJMPSKsEal/e4XKQ1p b87KbIdgI1r/WxO8TAXhnG4ijTb3y70g2WCgs/6yiksZEv73hJ0SSHnb3f6sICtqTacGdZCzZ Z3mIu5TVpt3PUev/Od9lgXCQ/4/8qaV9Pheu0/DxQJa1ZyXqX19wEnJS2TTyQcs/uy81KV0jY i6LTZPcmNLYzGs6xm6pBV6THjXlccdAdmTfqDAR8PWnhHwW/iflyR9Ip5wbEMrduUbXnCCs26 Ome8gUtZXJ1JZWV3eARPsygcE2evrY1VydGfNOr8KoVi9ngdDVCrEEauFlZDGCLd55z/7mte5 4KaMJTD1azUV8D/WBhbUf0LakqxrwCTHqeOyCdm4l66Ebeq9hY68dgP/t9Rw87tnBggLgKU/Q jGVSY+Xyr7dX2aXyD4/GfbFft1T7/ZBqjWIjTgGVS958+mOe5V/TbxRb7OzkJVMfA5nRgfI90 e4tMQMq9IWle8CYLo32/GxRyxQ0ackxZBr9vwJlXPS0z6kp3FtYVDTj0NhnjWk36EWq+vkeQO cbUyA5Mqytk9SSJTqzWT+C5QUwldL4HnmwQOL0lW2cfcX99XGhcjtT9dOjtFZ6E5NPMLISjl+ Ovo71fE552p+Fa+0grCrtekFIVpMg/E8cawpx71Ksx7kj8bZn1iVBZtod6v1sSMNiHplNCGs6 LuNrZgMSZW5zsYpR Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2844 Lines: 77 On Tuesday, November 22, 2016 1:32:45 PM CET Markus Mayer wrote: > From: Markus Mayer > > 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 > Acked-by: Viresh Kumar 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___device_table=392. Arnd