Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755222AbcK1U7L (ORCPT ); Mon, 28 Nov 2016 15:59:11 -0500 Received: from mout.kundenserver.de ([217.72.192.73]:55779 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754808AbcK1U7D (ORCPT ); Mon, 28 Nov 2016 15:59:03 -0500 From: Arnd Bergmann To: Markus Mayer Cc: Markus Mayer , Viresh Kumar , "Rafael J . Wysocki" , Power Management List , Broadcom Kernel List , Linux Kernel Mailing List Subject: Re: [PATCH v3] cpufreq: brcmstb-cpufreq: CPUfreq driver for older Broadcom STB SoCs Date: Mon, 28 Nov 2016 21:58:53 +0100 Message-ID: <5489387.Z7UgOxivrY@wuerfel> User-Agent: KMail/5.1.3 (Linux/4.4.0-34-generic; KDE/5.18.0; x86_64; ; ) In-Reply-To: References: <20161122213245.17955-1-code@mmayer.net> <8526810.ogr5uYm3lV@wuerfel> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Provags-ID: V03:K0:I0otT3YNlZoGAS7qoij+g8tKLd+DZStMk5ZQiLGOCAXIb90rSly Fed/dc978GVSO0oHUtCVJxdmR/ufFHAjF1xRurmQxUDA5f6riqGNM89L47iTMXb5YedUujj K5Z1pUpBQDOtE/f10gNZFW7tWfsMax94JfzEhQ2KwHuE5RXDTF8JcsHvxm6+Mq+ut/eX8cA CmZtMdwMD8er9YA8Jqggw== X-UI-Out-Filterresults: notjunk:1;V01:K0:2A5MiRhSXjg=:Glzgp6aZpaAfivoKNKrJbd Ak8/tzrDs04URhnTnCcrKpq9QN6n0oill6Q2hkhnubwRbpLosA4ONFq532+G04XO9qIDdrRO4 h+shKsB2K7hPgfUh1isedRuEgpyhdSiVrqCajd9GQgKSXT7ygmVhZwXjQCBL52CNvXEHpnK98 pv0E45VzpXMcYTcpyWGKsyP4juTJhsHXD/2jlyTv3uJIw1ww0p8OkJfQp0h7W7VFXWK8UWbeu cF6af6EDqHS2qjbyUbgJU28A7hFXnQHUUNA2VeXvgbNMxE32RWHwfjLGwAboagP3BqO0u+Oh3 Ki7HGV/lVj6Uxg4te2eYoEQ8Lxx+TFG2YB86IkusCu5XAQWtmWTamX92dn3lT3FhQzTPw8xYK j0PpLSwY1SQqw/Oio1YvOMEtN/8WLyT6UwG7oEQ8KNq2n6Lcnm/bBywoWukzWJxX/ge4eQ3FM pY4td7HLksuDZQss73W2FxQnSb3k1PtR28fqsypk7NAYYBgMzW2twluOw468YGaidsZCkkC2K ZgEluxdZUeb+XMtaHhiPmus11g8Uv/nlZU0lAfr0d9rD8kPgPIoHSrJt7s57tBtd/puAOnDf5 ZNhyKQjx9rqsf5DsVnFPgcQdduGtYQeOkb1oLzDZHPcpgjX8GzzJMq/czRCIbxUhT48yZ1WvB XIAUvqymV42WpfWVqAVMveROG345KT0sI6caqq6a7gtwjV2RFfAl8B5jHfffOBgA21obEYoX3 ikjKdCVyKEQXUwO4 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2578 Lines: 64 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___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