linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] ASoC: mediatek: mt8195: Fix build warning without CONFIG_OF
@ 2022-05-06  2:26 YueHaibing
  2022-05-06  7:08 ` Arnd Bergmann
  0 siblings, 1 reply; 3+ messages in thread
From: YueHaibing @ 2022-05-06  2:26 UTC (permalink / raw)
  To: lgirdwood, broonie, perex, tiwai, matthias.bgg, tzungbi,
	angelogioacchino.delregno, trevor.wu
  Cc: alsa-devel, linux-arm-kernel, linux-mediatek, linux-kernel, YueHaibing

sound/soc/mediatek/mt8195/mt8195-mt6359.c:1639:32: warning: ‘mt8195_mt6359_max98390_rt5682_card’ defined but not used [-Wunused-variable]
 1639 | static struct mt8195_card_data mt8195_mt6359_max98390_rt5682_card = {
      |                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sound/soc/mediatek/mt8195/mt8195-mt6359.c:1634:32: warning: ‘mt8195_mt6359_rt1011_rt5682_card’ defined but not used [-Wunused-variable]
 1634 | static struct mt8195_card_data mt8195_mt6359_rt1011_rt5682_card = {
      |                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sound/soc/mediatek/mt8195/mt8195-mt6359.c:1629:32: warning: ‘mt8195_mt6359_rt1019_rt5682_card’ defined but not used [-Wunused-variable]
 1629 | static struct mt8195_card_data mt8195_mt6359_rt1019_rt5682_card = {
      |                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

These variables is only used with CONFIG_OF, move it into the ifdef block.

Fixes: 86a6b9c9dfff ("ASoC: mediatek: mt8195: add machine support for max98390 and rt5682")
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
 sound/soc/mediatek/mt8195/mt8195-mt6359.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/mediatek/mt8195/mt8195-mt6359.c b/sound/soc/mediatek/mt8195/mt8195-mt6359.c
index 3e32fe801b3c..f90675f14d60 100644
--- a/sound/soc/mediatek/mt8195/mt8195-mt6359.c
+++ b/sound/soc/mediatek/mt8195/mt8195-mt6359.c
@@ -1626,6 +1626,7 @@ static int mt8195_mt6359_dev_probe(struct platform_device *pdev)
 	return ret;
 }
 
+#ifdef CONFIG_OF
 static struct mt8195_card_data mt8195_mt6359_rt1019_rt5682_card = {
 	.name = "mt8195_r1019_5682",
 	.quirk = RT1019_SPEAKER_AMP_PRESENT,
@@ -1641,7 +1642,6 @@ static struct mt8195_card_data mt8195_mt6359_max98390_rt5682_card = {
 	.quirk = MAX98390_SPEAKER_AMP_PRESENT,
 };
 
-#ifdef CONFIG_OF
 static const struct of_device_id mt8195_mt6359_dt_match[] = {
 	{
 		.compatible = "mediatek,mt8195_mt6359_rt1019_rt5682",
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH -next] ASoC: mediatek: mt8195: Fix build warning without CONFIG_OF
  2022-05-06  2:26 [PATCH -next] ASoC: mediatek: mt8195: Fix build warning without CONFIG_OF YueHaibing
@ 2022-05-06  7:08 ` Arnd Bergmann
  2022-05-07  2:05   ` YueHaibing
  0 siblings, 1 reply; 3+ messages in thread
From: Arnd Bergmann @ 2022-05-06  7:08 UTC (permalink / raw)
  To: YueHaibing
  Cc: Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai,
	Matthias Brugger, Tzung-Bi Shih, AngeloGioacchino Del Regno,
	Trevor Wu, ALSA Development Mailing List, Linux ARM,
	moderated list:ARM/Mediatek SoC...,
	Linux Kernel Mailing List

On Fri, May 6, 2022 at 4:26 AM YueHaibing <yuehaibing@huawei.com> wrote:
>
> sound/soc/mediatek/mt8195/mt8195-mt6359.c:1639:32: warning: ‘mt8195_mt6359_max98390_rt5682_card’ defined but not used [-Wunused-variable]
>  1639 | static struct mt8195_card_data mt8195_mt6359_max98390_rt5682_card = {
>       |                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> sound/soc/mediatek/mt8195/mt8195-mt6359.c:1634:32: warning: ‘mt8195_mt6359_rt1011_rt5682_card’ defined but not used [-Wunused-variable]
>  1634 | static struct mt8195_card_data mt8195_mt6359_rt1011_rt5682_card = {
>       |                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> sound/soc/mediatek/mt8195/mt8195-mt6359.c:1629:32: warning: ‘mt8195_mt6359_rt1019_rt5682_card’ defined but not used [-Wunused-variable]
>  1629 | static struct mt8195_card_data mt8195_mt6359_rt1019_rt5682_card = {
>       |                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> These variables is only used with CONFIG_OF, move it into the ifdef block.
>
> Fixes: 86a6b9c9dfff ("ASoC: mediatek: mt8195: add machine support for max98390 and rt5682")
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>

It's generally better to remove the #ifdef rather than expanding it,
there is no need to
save a few bytes on kernel builds of this driver that disable
CONFIG_OF. Just drop
the of_match_ptr() macro as well.


        Arnd

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH -next] ASoC: mediatek: mt8195: Fix build warning without CONFIG_OF
  2022-05-06  7:08 ` Arnd Bergmann
@ 2022-05-07  2:05   ` YueHaibing
  0 siblings, 0 replies; 3+ messages in thread
From: YueHaibing @ 2022-05-07  2:05 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai,
	Matthias Brugger, Tzung-Bi Shih, AngeloGioacchino Del Regno,
	Trevor Wu, ALSA Development Mailing List, Linux ARM,
	moderated list:ARM/Mediatek SoC...,
	Linux Kernel Mailing List

On 2022/5/6 15:08, Arnd Bergmann wrote:
> On Fri, May 6, 2022 at 4:26 AM YueHaibing <yuehaibing@huawei.com> wrote:
>>
>> sound/soc/mediatek/mt8195/mt8195-mt6359.c:1639:32: warning: ‘mt8195_mt6359_max98390_rt5682_card’ defined but not used [-Wunused-variable]
>>  1639 | static struct mt8195_card_data mt8195_mt6359_max98390_rt5682_card = {
>>       |                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> sound/soc/mediatek/mt8195/mt8195-mt6359.c:1634:32: warning: ‘mt8195_mt6359_rt1011_rt5682_card’ defined but not used [-Wunused-variable]
>>  1634 | static struct mt8195_card_data mt8195_mt6359_rt1011_rt5682_card = {
>>       |                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> sound/soc/mediatek/mt8195/mt8195-mt6359.c:1629:32: warning: ‘mt8195_mt6359_rt1019_rt5682_card’ defined but not used [-Wunused-variable]
>>  1629 | static struct mt8195_card_data mt8195_mt6359_rt1019_rt5682_card = {
>>       |                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>
>> These variables is only used with CONFIG_OF, move it into the ifdef block.
>>
>> Fixes: 86a6b9c9dfff ("ASoC: mediatek: mt8195: add machine support for max98390 and rt5682")
>> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
> 
> It's generally better to remove the #ifdef rather than expanding it,
> there is no need to
> save a few bytes on kernel builds of this driver that disable
> CONFIG_OF. Just drop
> the of_match_ptr() macro as well.

Sure, will do that in v2.
> 
> 
>         Arnd
> 
> .
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-05-07  2:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-06  2:26 [PATCH -next] ASoC: mediatek: mt8195: Fix build warning without CONFIG_OF YueHaibing
2022-05-06  7:08 ` Arnd Bergmann
2022-05-07  2:05   ` YueHaibing

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).