Re: drivers/mtd/nand/xway_nand.c:235:1: error: type defaults to 'int' in declaration of 'MODULE_DEVICE_TABLE'

From: Paul Gortmaker
Date: Tue Dec 20 2016 - 16:09:34 EST


[drivers/mtd/nand/xway_nand.c:235:1: error: type defaults to 'int' in declaration of 'MODULE_DEVICE_TABLE'] On 21/12/2016 (Wed 03:16) kbuild test robot wrote:

> tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> head: e93b1cc8a8965da137ffea0b88e5f62fa1d2a9e6
> commit: d47529b2e9fe0ec2eb1f072afad8849f52e385c4 gpio: don't include module.h in shared driver header
> date: 3 months ago
> config: mips-xway_defconfig (attached as .config)

Is this config not in tree? I don't see it in linux-next:

$ make mips-xway_defconfig
***
*** Can't find default configuration "arch/mips/configs/mips-xway_defconfig"!

> compiler: mips-linux-gnu-gcc (Debian 6.1.1-9) 6.1.1 20160705
> reproduce:
> wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
> chmod +x ~/bin/make.cross
> git checkout d47529b2e9fe0ec2eb1f072afad8849f52e385c4
> # save the attached .config to linux build tree
> make.cross ARCH=mips
>
> All error/warnings (new ones prefixed by >>):
>
> >> drivers/mtd/nand/xway_nand.c:235:1: warning: data definition has no type or storage class
> MODULE_DEVICE_TABLE(of, xway_nand_match);

Fix is obvious, even though I'm not sure what config to test it with.
Commit log below explains...

I'll git send-email it separately so the Cc get proper coverage.

Paul.

-----------------------------------------8<------------------------------

From 8b6672855ef671effcceabdcac8788fd72bd22ca Mon Sep 17 00:00:00 2001
From: Paul Gortmaker <paul.gortmaker@xxxxxxxxxxxxx>
Date: Tue, 20 Dec 2016 15:54:16 -0500
Subject: [PATCH] mtd: nand: fix implicit module.h usage in xway_nand.c

In commit d47529b2e9fe0ec2eb1f072afad8849f52e385c4 ("gpio: don't
include module.h in shared driver header") we fixed a bunch of
implicit includes and then did what the shortlog says -- remove
module.h from a gpio header.

In parallel, commit 024366750c2e04fdcda8bca685194ef0196b35fe
("mtd: nand: xway: convert to normal platform driver") added new
modular function calls to a file that now became relying on the
above module.h presence in the gpio header, since it did not
explicitly include module.h header for them as part of the change.

The problem only appears when the two dev streams are merged.

Since the file is tristate, the fix is obvious -- it needs an
explicit include of module.h header.

Reported-by: kbuild test robot <fengguang.wu@xxxxxxxxx>
Cc: Hauke Mehrtens <hauke@xxxxxxxxxx>
Cc: Boris Brezillon <boris.brezillon@xxxxxxxxxxxxxxxxxx>
Cc: Linus Walleij <linus.walleij@xxxxxxxxxx>
Cc: Alexandre Courbot <gnurou@xxxxxxxxx>
Cc: linux-gpio@xxxxxxxxxxxxxxx
Signed-off-by: Paul Gortmaker <paul.gortmaker@xxxxxxxxxxxxx>
---
drivers/mtd/nand/xway_nand.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/mtd/nand/xway_nand.c b/drivers/mtd/nand/xway_nand.c
index 1f2948c0c458..00168d633bcf 100644
--- a/drivers/mtd/nand/xway_nand.c
+++ b/drivers/mtd/nand/xway_nand.c
@@ -7,6 +7,7 @@
* Copyright © 2016 Hauke Mehrtens <hauke@xxxxxxxxxx>
*/

+#include <linux/module.h>
#include <linux/mtd/nand.h>
#include <linux/of_gpio.h>
#include <linux/of_platform.h>
--
2.11.0