[linux-chenxing:mstar_v5_14_rebase_i2_drm 80/349] include/linux/device/driver.h:288:20: warning: passing argument 1 of '__platform_driver_register' discards 'const' qualifier from pointer target type

From: kernel test robot
Date: Sun Jul 18 2021 - 17:39:53 EST


tree: git://github.com/linux-chenxing/linux.git mstar_v5_14_rebase_i2_drm
head: 93dfb2364436067bf34c6d4ddcd282496182cc0f
commit: 2c26aea472dc85f461af5a2e8a89894fc1e623a0 [80/349] clk: mstar: pll common
config: s390-allyesconfig (attached as .config)
compiler: s390-linux-gcc (GCC) 10.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/linux-chenxing/linux/commit/2c26aea472dc85f461af5a2e8a89894fc1e623a0
git remote add linux-chenxing git://github.com/linux-chenxing/linux.git
git fetch --no-tags linux-chenxing mstar_v5_14_rebase_i2_drm
git checkout 2c26aea472dc85f461af5a2e8a89894fc1e623a0
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-10.3.0 make.cross ARCH=s390

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All warnings (new ones prefixed by >>):

In file included from drivers/clk/mstar/clk-msc313-upll.c:6:
drivers/clk/mstar/clk-msc313-upll.c: In function 'msc313_upll_driver_init':
>> include/linux/device/driver.h:288:20: warning: passing argument 1 of '__platform_driver_register' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
288 | return __register(&(__driver) , ##__VA_ARGS__); \
| ^~~~~~~~~~~
include/linux/platform_device.h:224:29: note: in definition of macro 'platform_driver_register'
224 | __platform_driver_register(drv, THIS_MODULE)
| ^~~
include/linux/platform_device.h:264:2: note: in expansion of macro 'builtin_driver'
264 | builtin_driver(__platform_driver, platform_driver_register)
| ^~~~~~~~~~~~~~
drivers/clk/mstar/clk-msc313-upll.c:88:1: note: in expansion of macro 'builtin_platform_driver'
88 | builtin_platform_driver(msc313_upll_driver);
| ^~~~~~~~~~~~~~~~~~~~~~~
include/linux/platform_device.h:225:39: note: expected 'struct platform_driver *' but argument is of type 'const struct platform_driver *'
225 | extern int __platform_driver_register(struct platform_driver *,
| ^~~~~~~~~~~~~~~~~~~~~~~~


vim +288 include/linux/device/driver.h

4c002c978b7f2f Greg Kroah-Hartman 2019-12-09 269
4c002c978b7f2f Greg Kroah-Hartman 2019-12-09 270 /**
4c002c978b7f2f Greg Kroah-Hartman 2019-12-09 271 * builtin_driver() - Helper macro for drivers that don't do anything
4c002c978b7f2f Greg Kroah-Hartman 2019-12-09 272 * special in init and have no exit. This eliminates some boilerplate.
4c002c978b7f2f Greg Kroah-Hartman 2019-12-09 273 * Each driver may only use this macro once, and calling it replaces
4c002c978b7f2f Greg Kroah-Hartman 2019-12-09 274 * device_initcall (or in some cases, the legacy __initcall). This is
4c002c978b7f2f Greg Kroah-Hartman 2019-12-09 275 * meant to be a direct parallel of module_driver() above but without
4c002c978b7f2f Greg Kroah-Hartman 2019-12-09 276 * the __exit stuff that is not used for builtin cases.
4c002c978b7f2f Greg Kroah-Hartman 2019-12-09 277 *
4c002c978b7f2f Greg Kroah-Hartman 2019-12-09 278 * @__driver: driver name
4c002c978b7f2f Greg Kroah-Hartman 2019-12-09 279 * @__register: register function for this driver type
4c002c978b7f2f Greg Kroah-Hartman 2019-12-09 280 * @...: Additional arguments to be passed to __register
4c002c978b7f2f Greg Kroah-Hartman 2019-12-09 281 *
4c002c978b7f2f Greg Kroah-Hartman 2019-12-09 282 * Use this macro to construct bus specific macros for registering
4c002c978b7f2f Greg Kroah-Hartman 2019-12-09 283 * drivers, and do not use it on its own.
4c002c978b7f2f Greg Kroah-Hartman 2019-12-09 284 */
4c002c978b7f2f Greg Kroah-Hartman 2019-12-09 285 #define builtin_driver(__driver, __register, ...) \
4c002c978b7f2f Greg Kroah-Hartman 2019-12-09 286 static int __init __driver##_init(void) \
4c002c978b7f2f Greg Kroah-Hartman 2019-12-09 287 { \
4c002c978b7f2f Greg Kroah-Hartman 2019-12-09 @288 return __register(&(__driver) , ##__VA_ARGS__); \
4c002c978b7f2f Greg Kroah-Hartman 2019-12-09 289 } \
4c002c978b7f2f Greg Kroah-Hartman 2019-12-09 290 device_initcall(__driver##_init);
4c002c978b7f2f Greg Kroah-Hartman 2019-12-09 291

:::::: The code at line 288 was first introduced by commit
:::::: 4c002c978b7f2f2306d53de051c054504af920a9 device.h: move 'struct driver' stuff out to device/driver.h

:::::: TO: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
:::::: CC: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip