lkml.org 
[lkml]   [2019]   [Sep]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH] mbox: qcom: avoid unused-variable warning
Date
Quoting Geert Uytterhoeven (2019-09-26 06:07:13)
> Hi Stephen,
>
> On Fri, Sep 20, 2019 at 11:06 PM Stephen Boyd <sboyd@kernel.org> wrote:
> > Quoting Arnd Bergmann (2019-09-20 12:27:50)
> > > On Fri, Sep 20, 2019 at 6:45 PM Stephen Boyd <sboyd@kernel.org> wrote:
> > > > > @@ -54,11 +60,6 @@ static int qcom_apcs_ipc_probe(struct platform_device *pdev)
> > > > > void __iomem *base;
> > > > > unsigned long i;
> > > > > int ret;
> > > > > - const struct of_device_id apcs_clk_match_table[] = {
> > > >
> > > > Does marking it static here work too? It would be nice to limit the
> > > > scope of this variable to this function instead of making it a global.
> > > > Also, it might be slightly smaller code size if that works.
> > >
> > > No, I just tried and the warning returned.
>
> It's there for the convenience for the user, so he doesn't have to add it
> himself explicitly.
>
> > ("of/device: Nullify match table in of_match_device() for CONFIG_OF=n"),
> > but it's been 5 years! Surely we can revert this change now that commit
> > 219a7bc577e6 ("spi: rspi: Use of_device_get_match_data() helper") is
> > merged.
>
> Right, the particular error case in the RSPI driver can no longer happen.
>
> Calling of_device_get_match_data() is the better solution anyway, as
> that uses the match table stored in dev->driver->of_match_table, so
> there's no need to pass the table explicitly, and conditionally.
>
> Hence...
>
> > --- a/drivers/leds/leds-pca9532.c
> > +++ b/drivers/leds/leds-pca9532.c
> > @@ -472,7 +472,7 @@ pca9532_of_populate_pdata(struct device *dev, struct device_node *np)
> > int i = 0;
> > const char *state;
> >
> > - match = of_match_device(of_pca9532_leds_match, dev);
> > + match = of_match_device(of_match_ptr(of_pca9532_leds_match), dev);
> > if (!match)
> > return ERR_PTR(-ENODEV);
>
> Please convert to of_device_get_match_data() instead of adding
> of_match_ptr() invocations...

How is this workable? I left it as of_match_device() because the value
returned may be 0 for the enum and that looks the same as NULL.

>
> > @@ -525,7 +525,7 @@ static int pca9532_probe(struct i2c_client *client,
> > dev_err(&client->dev, "no platform data\n");
> > return -EINVAL;
> > }
> > - of_id = of_match_device(of_pca9532_leds_match,
> > + of_id = of_match_device(of_match_ptr(of_pca9532_leds_match),
>
> Likewise.
>
> > --- a/sound/soc/jz4740/jz4740-i2s.c
> > +++ b/sound/soc/jz4740/jz4740-i2s.c
> > @@ -503,7 +503,7 @@ static int jz4740_i2s_dev_probe(struct platform_device *pdev)
> > if (!i2s)
> > return -ENOMEM;
> >
> > - match = of_match_device(jz4740_of_matches, &pdev->dev);
> > + match = of_match_device(of_match_ptr(jz4740_of_matches), &pdev->dev);
>
> Given of_device_get_match_data() returns NULL, not an error code, even
> this one could use of_device_get_match_data().
>

\
 
 \ /
  Last update: 2019-09-27 20:27    [W:1.320 / U:0.056 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site