[PATCH 01/15] mmc: core: quirks: Mark fixups as __maybe_unused

Lee Jones lee.jones at linaro.org
Wed Jul 1 08:46:48 EDT 2020


Not all source files which include quirks.h make use of the all of
the available fixup information.  When this happens the compiler
complains that some constant variables are defined by never used.
We can fix this by telling the compiler that this intentional by
simply marking them as __maybe_unused.

Fixes the following W=1 kernel build warnings:

 In file included from drivers/mmc/core/sdio.c:22:
 drivers/mmc/core/quirks.h:105:31: warning: ‘mmc_ext_csd_fixups’ defined but not used [-Wunused-const-variable=]
 105 | static const struct mmc_fixup mmc_ext_csd_fixups[] = {
 | ^~~~~~~~~~~~~~~~~~
 drivers/mmc/core/quirks.h:17:31: warning: ‘mmc_blk_fixups’ defined but not used [-Wunused-const-variable=]
 17 | static const struct mmc_fixup mmc_blk_fixups[] = {
 | ^~~~~~~~~~~~~~
 In file included from drivers/mmc/core/mmc.c:25:
 drivers/mmc/core/quirks.h:123:31: warning: ‘sdio_fixup_methods’ defined but not used [-Wunused-const-variable=]
 123 | static const struct mmc_fixup sdio_fixup_methods[] = {
 | ^~~~~~~~~~~~~~~~~~
 drivers/mmc/core/quirks.h:17:31: warning: ‘mmc_blk_fixups’ defined but not used [-Wunused-const-variable=]
 17 | static const struct mmc_fixup mmc_blk_fixups[] = {
 | ^~~~~~~~~~~~~~

Cc: Andrei Warkentin <andreiw at motorola.com>
Cc: Martin Mares <mj at ucw.cz>
Signed-off-by: Lee Jones <lee.jones at linaro.org>
---
 drivers/mmc/core/quirks.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/mmc/core/quirks.h b/drivers/mmc/core/quirks.h
index 472fa2fdcf139..d68e6e513a4f4 100644
--- a/drivers/mmc/core/quirks.h
+++ b/drivers/mmc/core/quirks.h
@@ -14,7 +14,7 @@
 
 #include "card.h"
 
-static const struct mmc_fixup mmc_blk_fixups[] = {
+static const struct mmc_fixup __maybe_unused mmc_blk_fixups[] = {
 #define INAND_CMD38_ARG_EXT_CSD  113
 #define INAND_CMD38_ARG_ERASE    0x00
 #define INAND_CMD38_ARG_TRIM     0x01
@@ -102,7 +102,7 @@ static const struct mmc_fixup mmc_blk_fixups[] = {
 	END_FIXUP
 };
 
-static const struct mmc_fixup mmc_ext_csd_fixups[] = {
+static const struct mmc_fixup __maybe_unused mmc_ext_csd_fixups[] = {
 	/*
 	 * Certain Hynix eMMC 4.41 cards might get broken when HPI feature
 	 * is used so disable the HPI feature for such buggy cards.
@@ -120,7 +120,7 @@ static const struct mmc_fixup mmc_ext_csd_fixups[] = {
 };
 
 
-static const struct mmc_fixup sdio_fixup_methods[] = {
+static const struct mmc_fixup __maybe_unused sdio_fixup_methods[] = {
 	SDIO_FIXUP(SDIO_VENDOR_ID_TI_WL1251, SDIO_DEVICE_ID_TI_WL1251,
 		   add_quirk, MMC_QUIRK_NONSTD_FUNC_IF),
 
-- 
2.25.1




More information about the linux-arm-kernel mailing list