diff mbox series

[10/25] pinctrl: mediatek: pinctrl-mtk-common-v2: Mark 'mtk_default_register_base_names' as __maybe_unused

Message ID 20200713144930.1034632-11-lee.jones@linaro.org
State Accepted
Commit ea0b879b5d6e9af2e7b60ff62fc5c985d43fc920
Headers show
Series Rid W=1 warnings in Pinctrl | expand

Commit Message

Lee Jones July 13, 2020, 2:49 p.m. UTC
Not all sourcefiles which end up including pinctrl-mtk-common-v2.h make use
of 'mtk_default_register_base_names' and there is nowhere we can place the
definition to void the need for __maybe_unused except its own headerfile,
which seems like overkill.  So instead we tell the compiler that it's okay
for it to be unused by some of the consumers.

Fixes the following W=1 kernel build warning(s):

 In file included from drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c:19:
 drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.h:83:27: warning: ‘mtk_default_register_base_names’ defined but not used [-Wunused-const-variable=]
 83 | static const char const mtk_default_register_base_names[] = {
 | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 In file included from drivers/pinctrl/mediatek/pinctrl-moore.h:25,
 from drivers/pinctrl/mediatek/pinctrl-moore.c:12:
 drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.h:83:27: warning: ‘mtk_default_register_base_names’ defined but not used [-Wunused-const-variable=]
 83 | static const char const mtk_default_register_base_names[] = {
 | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 In file included from drivers/pinctrl/mediatek/pinctrl-paris.h:27,
 from drivers/pinctrl/mediatek/pinctrl-paris.c:15:
 drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.h:83:27: warning: ‘mtk_default_register_base_names’ defined but not used [-Wunused-const-variable=]
 83 | static const char const mtk_default_register_base_names[] = {
 | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 In file included from drivers/pinctrl/mediatek/pinctrl-paris.h:27,
 from drivers/pinctrl/mediatek/pinctrl-mtk-mt6797.h:15,
 from drivers/pinctrl/mediatek/pinctrl-mt6797.c:13:
 drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.h:83:27: warning: ‘mtk_default_register_base_names’ defined but not used [-Wunused-const-variable=]
 83 | static const char const mtk_default_register_base_names[] = {
 | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 In file included from drivers/pinctrl/mediatek/pinctrl-paris.h:27,
 from drivers/pinctrl/mediatek/pinctrl-mtk-mt8183.h:12,
 from drivers/pinctrl/mediatek/pinctrl-mt8183.c:9:
 drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.h:83:27: warning: ‘mtk_default_register_base_names’ defined but not used [-Wunused-const-variable=]
 83 | static const char const mtk_default_register_base_names[] = {
 | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 In file included from drivers/pinctrl/mediatek/pinctrl-paris.h:27,
 from drivers/pinctrl/mediatek/pinctrl-mtk-mt6765.h:12,
 from drivers/pinctrl/mediatek/pinctrl-mt6765.c:10:
 drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.h:83:27: warning: ‘mtk_default_register_base_names’ defined but not used [-Wunused-const-variable=]
 83 | static const char const mtk_default_register_base_names[] = {
 | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Cc: Sean Wang <sean.wang@kernel.org>
Cc: Matthias Brugger <matthias.bgg@gmail.com>
Cc: linux-mediatek@lists.infradead.org
Signed-off-by: Lee Jones <lee.jones@linaro.org>

---
 drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

-- 
2.25.1

Comments

Sean Wang July 14, 2020, 9:21 p.m. UTC | #1
On Mon, Jul 13, 2020 at 7:49 AM Lee Jones <lee.jones@linaro.org> wrote:
>

> Not all sourcefiles which end up including pinctrl-mtk-common-v2.h make use

> of 'mtk_default_register_base_names' and there is nowhere we can place the

> definition to void the need for __maybe_unused except its own headerfile,

> which seems like overkill.  So instead we tell the compiler that it's okay

> for it to be unused by some of the consumers.

>

> Fixes the following W=1 kernel build warning(s):

>

>  In file included from drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c:19:

>  drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.h:83:27: warning: ‘mtk_default_register_base_names’ defined but not used [-Wunused-const-variable=]

>  83 | static const char const mtk_default_register_base_names[] = {

>  | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

>  In file included from drivers/pinctrl/mediatek/pinctrl-moore.h:25,

>  from drivers/pinctrl/mediatek/pinctrl-moore.c:12:

>  drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.h:83:27: warning: ‘mtk_default_register_base_names’ defined but not used [-Wunused-const-variable=]

>  83 | static const char const mtk_default_register_base_names[] = {

>  | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

>  In file included from drivers/pinctrl/mediatek/pinctrl-paris.h:27,

>  from drivers/pinctrl/mediatek/pinctrl-paris.c:15:

>  drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.h:83:27: warning: ‘mtk_default_register_base_names’ defined but not used [-Wunused-const-variable=]

>  83 | static const char const mtk_default_register_base_names[] = {

>  | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

>  In file included from drivers/pinctrl/mediatek/pinctrl-paris.h:27,

>  from drivers/pinctrl/mediatek/pinctrl-mtk-mt6797.h:15,

>  from drivers/pinctrl/mediatek/pinctrl-mt6797.c:13:

>  drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.h:83:27: warning: ‘mtk_default_register_base_names’ defined but not used [-Wunused-const-variable=]

>  83 | static const char const mtk_default_register_base_names[] = {

>  | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

>  In file included from drivers/pinctrl/mediatek/pinctrl-paris.h:27,

>  from drivers/pinctrl/mediatek/pinctrl-mtk-mt8183.h:12,

>  from drivers/pinctrl/mediatek/pinctrl-mt8183.c:9:

>  drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.h:83:27: warning: ‘mtk_default_register_base_names’ defined but not used [-Wunused-const-variable=]

>  83 | static const char const mtk_default_register_base_names[] = {

>  | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

>  In file included from drivers/pinctrl/mediatek/pinctrl-paris.h:27,

>  from drivers/pinctrl/mediatek/pinctrl-mtk-mt6765.h:12,

>  from drivers/pinctrl/mediatek/pinctrl-mt6765.c:10:

>  drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.h:83:27: warning: ‘mtk_default_register_base_names’ defined but not used [-Wunused-const-variable=]

>  83 | static const char const mtk_default_register_base_names[] = {

>  | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

>

> Cc: Sean Wang <sean.wang@kernel.org>

> Cc: Matthias Brugger <matthias.bgg@gmail.com>

> Cc: linux-mediatek@lists.infradead.org

> Signed-off-by: Lee Jones <lee.jones@linaro.org>


Those MediaTek SoCs with multiple register bases wouldn't refer to the array
Acked-by: Sean Wang <sean.wang@kernel.org>


> ---

>  drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.h | 2 +-
diff mbox series

Patch

diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.h b/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.h
index 27df087363960..45aa0fdbe3306 100644
--- a/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.h
+++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.h
@@ -80,7 +80,7 @@  enum {
 	DRV_GRP_MAX,
 };
 
-static const char * const mtk_default_register_base_names[] = {
+static const char * const mtk_default_register_base_names[] __maybe_unused = {
 	"base",
 };