From: Arnd Bergmann <arnd@arndb.de> To: "Jérôme Pouiller" <jerome.pouiller@silabs.com>, "Greg Kroah-Hartman" <gregkh@linuxfoundation.org> Cc: "Arnd Bergmann" <arnd@arndb.de>, "Jules Irenge" <jbi.octave@gmail.com>, "Michał Mirosław" <mirq-linux@rere.qmqm.pl>, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: [PATCH] staging: wfx: avoid compiler warning on empty array Date: Wed, 29 Apr 2020 16:21:09 +0200 [thread overview] Message-ID: <20200429142119.1735196-1-arnd@arndb.de> (raw) When CONFIG_OF is disabled, gcc-9 produces a warning about the wfx_sdio_of_match[] array having a declaration without a dimension: drivers/staging/wfx/bus_sdio.c:159:34: error: array 'wfx_sdio_of_match' assumed to have one element [-Werror] 159 | static const struct of_device_id wfx_sdio_of_match[]; | ^~~~~~~~~~~~~~~~~ Move the proper declaration up and out of the #ifdef instead. Fixes: a7a91ca5a23d ("staging: wfx: add infrastructure for new driver") Signed-off-by: Arnd Bergmann <arnd@arndb.de> --- drivers/staging/wfx/bus_sdio.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/drivers/staging/wfx/bus_sdio.c b/drivers/staging/wfx/bus_sdio.c index dedc3ff58d3e..c2e4bd1e3b0a 100644 --- a/drivers/staging/wfx/bus_sdio.c +++ b/drivers/staging/wfx/bus_sdio.c @@ -156,7 +156,13 @@ static const struct hwbus_ops wfx_sdio_hwbus_ops = { .align_size = wfx_sdio_align_size, }; -static const struct of_device_id wfx_sdio_of_match[]; +static const struct of_device_id wfx_sdio_of_match[] = { + { .compatible = "silabs,wfx-sdio" }, + { .compatible = "silabs,wf200" }, + { }, +}; +MODULE_DEVICE_TABLE(of, wfx_sdio_of_match); + static int wfx_sdio_probe(struct sdio_func *func, const struct sdio_device_id *id) { @@ -248,15 +254,6 @@ static const struct sdio_device_id wfx_sdio_ids[] = { }; MODULE_DEVICE_TABLE(sdio, wfx_sdio_ids); -#ifdef CONFIG_OF -static const struct of_device_id wfx_sdio_of_match[] = { - { .compatible = "silabs,wfx-sdio" }, - { .compatible = "silabs,wf200" }, - { }, -}; -MODULE_DEVICE_TABLE(of, wfx_sdio_of_match); -#endif - struct sdio_driver wfx_sdio_driver = { .name = "wfx-sdio", .id_table = wfx_sdio_ids, @@ -264,6 +261,6 @@ struct sdio_driver wfx_sdio_driver = { .remove = wfx_sdio_remove, .drv = { .owner = THIS_MODULE, - .of_match_table = of_match_ptr(wfx_sdio_of_match), + .of_match_table = wfx_sdio_of_match, } }; -- 2.26.0
WARNING: multiple messages have this Message-ID (diff)
From: Arnd Bergmann <arnd@arndb.de> To: "Jérôme Pouiller" <jerome.pouiller@silabs.com>, "Greg Kroah-Hartman" <gregkh@linuxfoundation.org> Cc: devel@driverdev.osuosl.org, "Jules Irenge" <jbi.octave@gmail.com>, linux-kernel@vger.kernel.org, "Arnd Bergmann" <arnd@arndb.de>, "Michał Mirosław" <mirq-linux@rere.qmqm.pl> Subject: [PATCH] staging: wfx: avoid compiler warning on empty array Date: Wed, 29 Apr 2020 16:21:09 +0200 [thread overview] Message-ID: <20200429142119.1735196-1-arnd@arndb.de> (raw) When CONFIG_OF is disabled, gcc-9 produces a warning about the wfx_sdio_of_match[] array having a declaration without a dimension: drivers/staging/wfx/bus_sdio.c:159:34: error: array 'wfx_sdio_of_match' assumed to have one element [-Werror] 159 | static const struct of_device_id wfx_sdio_of_match[]; | ^~~~~~~~~~~~~~~~~ Move the proper declaration up and out of the #ifdef instead. Fixes: a7a91ca5a23d ("staging: wfx: add infrastructure for new driver") Signed-off-by: Arnd Bergmann <arnd@arndb.de> --- drivers/staging/wfx/bus_sdio.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/drivers/staging/wfx/bus_sdio.c b/drivers/staging/wfx/bus_sdio.c index dedc3ff58d3e..c2e4bd1e3b0a 100644 --- a/drivers/staging/wfx/bus_sdio.c +++ b/drivers/staging/wfx/bus_sdio.c @@ -156,7 +156,13 @@ static const struct hwbus_ops wfx_sdio_hwbus_ops = { .align_size = wfx_sdio_align_size, }; -static const struct of_device_id wfx_sdio_of_match[]; +static const struct of_device_id wfx_sdio_of_match[] = { + { .compatible = "silabs,wfx-sdio" }, + { .compatible = "silabs,wf200" }, + { }, +}; +MODULE_DEVICE_TABLE(of, wfx_sdio_of_match); + static int wfx_sdio_probe(struct sdio_func *func, const struct sdio_device_id *id) { @@ -248,15 +254,6 @@ static const struct sdio_device_id wfx_sdio_ids[] = { }; MODULE_DEVICE_TABLE(sdio, wfx_sdio_ids); -#ifdef CONFIG_OF -static const struct of_device_id wfx_sdio_of_match[] = { - { .compatible = "silabs,wfx-sdio" }, - { .compatible = "silabs,wf200" }, - { }, -}; -MODULE_DEVICE_TABLE(of, wfx_sdio_of_match); -#endif - struct sdio_driver wfx_sdio_driver = { .name = "wfx-sdio", .id_table = wfx_sdio_ids, @@ -264,6 +261,6 @@ struct sdio_driver wfx_sdio_driver = { .remove = wfx_sdio_remove, .drv = { .owner = THIS_MODULE, - .of_match_table = of_match_ptr(wfx_sdio_of_match), + .of_match_table = wfx_sdio_of_match, } }; -- 2.26.0 _______________________________________________ devel mailing list devel@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
next reply other threads:[~2020-04-29 14:21 UTC|newest] Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-04-29 14:21 Arnd Bergmann [this message] 2020-04-29 14:21 ` [PATCH] staging: wfx: avoid compiler warning on empty array Arnd Bergmann 2020-04-29 16:04 ` Jerome Pouiller 2020-04-29 16:04 ` Jerome Pouiller 2020-04-29 20:34 ` Arnd Bergmann 2020-04-29 20:34 ` Arnd Bergmann 2020-04-30 8:42 ` Jerome Pouiller 2020-04-30 8:42 ` Jerome Pouiller 2020-04-30 13:21 ` Arnd Bergmann 2020-04-30 13:21 ` Arnd Bergmann
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20200429142119.1735196-1-arnd@arndb.de \ --to=arnd@arndb.de \ --cc=devel@driverdev.osuosl.org \ --cc=gregkh@linuxfoundation.org \ --cc=jbi.octave@gmail.com \ --cc=jerome.pouiller@silabs.com \ --cc=linux-kernel@vger.kernel.org \ --cc=mirq-linux@rere.qmqm.pl \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.