[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <6e5a8fdb-0a02-5eae-ca1f-37df8a454e34@infradead.org>
Date: Mon, 2 Nov 2020 09:15:20 -0800
From: Randy Dunlap <rdunlap@...radead.org>
To: Valdis Klētnieks <valdis.kletnieks@...edu>,
Dong Aisheng <aisheng.dong@....com>,
Michael Turquette <mturquette@...libre.com>,
Shawn Guo <shawnguo@...nel.org>,
Stephen Boyd <sboyd@...nel.org>,
Sascha Hauer <s.hauer@...gutronix.de>
Cc: linux-clk@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
linux-kernel@...r.kernel.org,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Subject: Re: [PATCH] clk: imx: scu: Fix compile error with module build of
clk-scu.o
On 11/2/20 4:02 AM, Valdis Klētnieks wrote:
> commit 77d8f3068c63ee0983f0b5ba3207d3f7cce11be4 (HEAD)
> Author: Dong Aisheng <aisheng.dong@....com>
> Date: Wed Jul 29 16:00:10 2020 +0800
>
> clk: imx: scu: add two cells binding support
>
> This missed a #include, which results in some nasty errors when
> built as a module
>
> CC [M] drivers/clk/imx/clk-scu.o
> In file included from ./include/linux/device.h:32,
> from ./include/linux/of_platform.h:9,
> from drivers/clk/imx/clk-scu.c:11:
> ./include/linux/device/driver.h:290:1: warning: data definition has no type or storage class
> device_initcall(__driver##_init);
> ^~~~~~~~~~~~~~~
> ./include/linux/platform_device.h:258:2: note: in expansion of macro 'builtin_driver'
> builtin_driver(__platform_driver, platform_driver_register)
> ^~~~~~~~~~~~~~
> drivers/clk/imx/clk-scu.c:545:1: note: in expansion of macro 'builtin_platform_driver'
> builtin_platform_driver(imx_clk_scu_driver);
> ^~~~~~~~~~~~~~~~~~~~~~~
> ./include/linux/device/driver.h:290:1: error: type defaults to 'int' in declaration of 'device_initcall' [-Werror=implicit-int]
> device_initcall(__driver##_init);
> ^~~~~~~~~~~~~~~
> ./include/linux/platform_device.h:258:2: note: in expansion of macro 'builtin_driver'
> builtin_driver(__platform_driver, platform_driver_register)
> ^~~~~~~~~~~~~~
> drivers/clk/imx/clk-scu.c:545:1: note: in expansion of macro 'builtin_platform_driver'
> builtin_platform_driver(imx_clk_scu_driver);
> ^~~~~~~~~~~~~~~~~~~~~~~
> drivers/clk/imx/clk-scu.c:545:1: warning: parameter names (without types) in function declaration
> In file included from ./include/linux/device.h:32,
> from ./include/linux/of_platform.h:9,
> from drivers/clk/imx/clk-scu.c:11:
> drivers/clk/imx/clk-scu.c:545:25: warning: 'imx_clk_scu_driver_init' defined but not used [-Wunused-function]
> builtin_platform_driver(imx_clk_scu_driver);
> ^~~~~~~~~~~~~~~~~~
> ./include/linux/device/driver.h:286:19: note: in definition of macro 'builtin_driver'
> static int __init __driver##_init(void) \
> ^~~~~~~~
> drivers/clk/imx/clk-scu.c:545:1: note: in expansion of macro 'builtin_platform_driver'
> builtin_platform_driver(imx_clk_scu_driver);
> ^~~~~~~~~~~~~~~~~~~~~~~
> cc1: some warnings being treated as errors
> make[3]: *** [scripts/Makefile.build:283: drivers/clk/imx/clk-scu.o] Error 1
>
> Fix by providing the include.
also
Reported-by: kernel test robot <lkp@...el.com>
However, this driver does not directly use <linux/module.h>.
platform_device.h #includes <linux/device.h>, which is where the
problem lies:
<linux/device.h> uses macros that are provided by <linux/module.h>
so <linux/device.h> should #include <linux/module.h>.
and that fixes this commit:
commit 4c002c978b7f2f2306d53de051c054504af920a9
Author: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Date: Mon Dec 9 20:33:03 2019 +0100
device.h: move 'struct driver' stuff out to device/driver.h
>
> Signed-off-by: Valdis Kletnieks <valdis.kletnieks@...edu>
>
> diff --git a/drivers/clk/imx/clk-scu.c b/drivers/clk/imx/clk-scu.c
> index 229a290ca5b6..15d382f6f9f8 100644
> --- a/drivers/clk/imx/clk-scu.c
> +++ b/drivers/clk/imx/clk-scu.c
> @@ -8,6 +8,7 @@
> #include <linux/arm-smccc.h>
> #include <linux/clk-provider.h>
> #include <linux/err.h>
> +#include <linux/module.h>
> #include <linux/of_platform.h>
> #include <linux/platform_device.h>
> #include <linux/pm_domain.h>
>
>
--
~Randy
Powered by blists - more mailing lists