2022-12-06 00:07:25

by Brian Norris

[permalink] [raw]
Subject: [PATCH] mmc: sdhci-brcmstb: Resolve "unused" warnings with CONFIG_OF=n

With W=1, we can see this gcc warning:

drivers/mmc/host/sdhci-brcmstb.c:182:34: warning: ‘sdhci_brcm_of_match’ defined but not used [-Wunused-const-variable=]
182 | static const struct of_device_id sdhci_brcm_of_match[] = {
| ^~~~~~~~~~~~~~~~~~~

Rather than play around more with #ifdef's, the simplest solution is to
just mark this __maybe_unused.

Fixes: 1fad8422c989 ("mmc: sdhci-brcmstb: Allow building with COMPILE_TEST")
Reported-by: kernel test robot <[email protected]>
Link: https://lore.kernel.org/all/[email protected]/
Signed-off-by: Brian Norris <[email protected]>
---

drivers/mmc/host/sdhci-brcmstb.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mmc/host/sdhci-brcmstb.c b/drivers/mmc/host/sdhci-brcmstb.c
index 55d8bd232695..f2cf3d70db79 100644
--- a/drivers/mmc/host/sdhci-brcmstb.c
+++ b/drivers/mmc/host/sdhci-brcmstb.c
@@ -179,7 +179,7 @@ static const struct brcmstb_match_priv match_priv_7216 = {
.ops = &sdhci_brcmstb_ops_7216,
};

-static const struct of_device_id sdhci_brcm_of_match[] = {
+static const struct of_device_id __maybe_unused sdhci_brcm_of_match[] = {
{ .compatible = "brcm,bcm7425-sdhci", .data = &match_priv_7425 },
{ .compatible = "brcm,bcm7445-sdhci", .data = &match_priv_7445 },
{ .compatible = "brcm,bcm7216-sdhci", .data = &match_priv_7216 },
--
2.39.0.rc0.267.gcb52ba06e7-goog


2022-12-06 00:35:30

by Florian Fainelli

[permalink] [raw]
Subject: Re: [PATCH] mmc: sdhci-brcmstb: Resolve "unused" warnings with CONFIG_OF=n

On 12/5/22 16:04, Brian Norris wrote:
> With W=1, we can see this gcc warning:
>
> drivers/mmc/host/sdhci-brcmstb.c:182:34: warning: ‘sdhci_brcm_of_match’ defined but not used [-Wunused-const-variable=]
> 182 | static const struct of_device_id sdhci_brcm_of_match[] = {
> | ^~~~~~~~~~~~~~~~~~~
>
> Rather than play around more with #ifdef's, the simplest solution is to
> just mark this __maybe_unused.
>
> Fixes: 1fad8422c989 ("mmc: sdhci-brcmstb: Allow building with COMPILE_TEST")
> Reported-by: kernel test robot <[email protected]>
> Link: https://lore.kernel.org/all/[email protected]/
> Signed-off-by: Brian Norris <[email protected]>

Acked-by: Florian Fainelli <[email protected]>
--
Florian

2022-12-07 12:43:38

by Ulf Hansson

[permalink] [raw]
Subject: Re: [PATCH] mmc: sdhci-brcmstb: Resolve "unused" warnings with CONFIG_OF=n

On Tue, 6 Dec 2022 at 01:04, Brian Norris <[email protected]> wrote:
>
> With W=1, we can see this gcc warning:
>
> drivers/mmc/host/sdhci-brcmstb.c:182:34: warning: ‘sdhci_brcm_of_match’ defined but not used [-Wunused-const-variable=]
> 182 | static const struct of_device_id sdhci_brcm_of_match[] = {
> | ^~~~~~~~~~~~~~~~~~~
>
> Rather than play around more with #ifdef's, the simplest solution is to
> just mark this __maybe_unused.
>
> Fixes: 1fad8422c989 ("mmc: sdhci-brcmstb: Allow building with COMPILE_TEST")
> Reported-by: kernel test robot <[email protected]>
> Link: https://lore.kernel.org/all/[email protected]/
> Signed-off-by: Brian Norris <[email protected]>

Applied for next, thanks!

Kind regards
Uffe


> ---
>
> drivers/mmc/host/sdhci-brcmstb.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/mmc/host/sdhci-brcmstb.c b/drivers/mmc/host/sdhci-brcmstb.c
> index 55d8bd232695..f2cf3d70db79 100644
> --- a/drivers/mmc/host/sdhci-brcmstb.c
> +++ b/drivers/mmc/host/sdhci-brcmstb.c
> @@ -179,7 +179,7 @@ static const struct brcmstb_match_priv match_priv_7216 = {
> .ops = &sdhci_brcmstb_ops_7216,
> };
>
> -static const struct of_device_id sdhci_brcm_of_match[] = {
> +static const struct of_device_id __maybe_unused sdhci_brcm_of_match[] = {
> { .compatible = "brcm,bcm7425-sdhci", .data = &match_priv_7425 },
> { .compatible = "brcm,bcm7445-sdhci", .data = &match_priv_7445 },
> { .compatible = "brcm,bcm7216-sdhci", .data = &match_priv_7216 },
> --
> 2.39.0.rc0.267.gcb52ba06e7-goog
>