[PATCH v2] ASoC: sun50i-dmic: avoid unused variable warning for sun50i_dmic_of_match

班涛 fengzheng923 at gmail.com
Sat Oct 29 04:44:43 CEST 2022


Hi, Song Chao:

Chao Song <chao.song at linux.intel.com> 于2022年10月26日周三 22:31写道:

>
> 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 at gmail.com>
> > Reported-by: kernel test robot <lkp at intel.com>
> > Acked-by: Jernej Skrabec <jernej.skrabec at 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.
>

But I think there is no difference between the two modifications. I refer
to other driver files of sunxi (sound/soc/sunxi), all of which are in the
same format.

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


More information about the Alsa-devel mailing list