Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Chao Song <chao.song@linux.intel.com>
To: Ban Tao <fengzheng923@gmail.com>,
	lgirdwood@gmail.com, broonie@kernel.org, perex@perex.cz,
	tiwai@suse.com, wens@csie.org, jernej.skrabec@gmail.com,
	samuel@sholland.org
Cc: alsa-devel@alsa-project.org, linux-sunxi@lists.linux.dev,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] ASoC: sun50i-dmic: avoid unused variable warning for sun50i_dmic_of_match
Date: Wed, 26 Oct 2022 22:31:05 +0800	[thread overview]
Message-ID: <69fa20ca-da52-b85f-ffcc-66a533471568@linux.intel.com> (raw)
In-Reply-To: <1666511085-2748-1-git-send-email-fengzheng923@gmail.com>


On 10/23/2022 3:44 PM, Ban Tao wrote:
> In configurations with CONFIG_OF=n, we get a harmless build warning:
>
> sound/soc/sunxi/sun50i-dmic.c:268:34: warning: unused variable
> 'sun50i_dmic_of_match' [-Wunused-const-variable]
>
> Signed-off-by: Ban Tao <fengzheng923@gmail.com>
> Reported-by: kernel test robot <lkp@intel.com>
> Acked-by: Jernej Skrabec <jernej.skrabec@gmail.com>
> ---
> v1->v2:Add "Acked-by" tag.
> ---
>   sound/soc/sunxi/sun50i-dmic.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/sound/soc/sunxi/sun50i-dmic.c b/sound/soc/sunxi/sun50i-dmic.c
> index 86cff5a..62509cb 100644
> --- a/sound/soc/sunxi/sun50i-dmic.c
> +++ b/sound/soc/sunxi/sun50i-dmic.c
> @@ -391,7 +391,7 @@ static const struct dev_pm_ops sun50i_dmic_pm = {
>   static struct platform_driver sun50i_dmic_driver = {
>   	.driver         = {
>   		.name   = "sun50i-dmic",
> -		.of_match_table = of_match_ptr(sun50i_dmic_of_match),
> +		.of_match_table = sun50i_dmic_of_match,
I don't think this is the right direction (remove the of_match_ptr) to 
fix the issue.

of_match_ptr(of_table) returns of_table if CONFIG_OF=y, and returns NULL 
if CONFIG_OF=n.

So guard  the definition of sun50i_dmic_of_match with `#ifdef CONFIG_OF` 
should be better.

Many other drivers do it this way.

>   		.pm     = &sun50i_dmic_pm,
>   	},
>   	.probe          = sun50i_dmic_probe,

  parent reply	other threads:[~2022-10-26 14:33 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-23  7:44 [PATCH v2] ASoC: sun50i-dmic: avoid unused variable warning for sun50i_dmic_of_match Ban Tao
2022-10-24 14:01 ` Mark Brown
2022-10-26 14:31 ` Chao Song [this message]
2022-10-29  2:44   ` 班涛

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=69fa20ca-da52-b85f-ffcc-66a533471568@linux.intel.com \
    --to=chao.song@linux.intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=fengzheng923@gmail.com \
    --cc=jernej.skrabec@gmail.com \
    --cc=lgirdwood@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sunxi@lists.linux.dev \
    --cc=perex@perex.cz \
    --cc=samuel@sholland.org \
    --cc=tiwai@suse.com \
    --cc=wens@csie.org \
    /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: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox