Re: [PATCH] ASoC: Use of_property_present() for testing DT property presence

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Mar 10, 2023 at 9:01 AM Amadeusz Sławiński
<amadeuszx.slawinski@xxxxxxxxxxxxxxx> wrote:
>
> On 3/10/2023 3:47 PM, Rob Herring wrote:
> > It is preferred to use typed property access functions (i.e.
> > of_property_read_<type> functions) rather than low-level
> > of_get_property/of_find_property functions for reading properties. As
> > part of this, convert of_get_property/of_find_property calls to the
> > recently added of_property_present() helper when we just want to test
> > for presence of a property and nothing more.
> >
> > Signed-off-by: Rob Herring <robh@xxxxxxxxxx>
> > ---
> >   sound/soc/codecs/lpass-macro-common.c | 2 +-
> >   sound/soc/generic/audio-graph-card.c  | 2 +-
> >   sound/soc/generic/audio-graph-card2.c | 2 +-
> >   sound/soc/mxs/mxs-sgtl5000.c          | 2 +-
> >   sound/soc/samsung/i2s.c               | 2 +-
> >   sound/soc/sh/fsi.c                    | 2 +-
> >   sound/soc/stm/stm32_i2s.c             | 2 +-
> >   sound/soc/stm/stm32_sai_sub.c         | 4 ++--
> >   sound/soc/tegra/tegra_asoc_machine.c  | 2 +-
> >   9 files changed, 10 insertions(+), 10 deletions(-)
> >
> > diff --git a/sound/soc/codecs/lpass-macro-common.c b/sound/soc/codecs/lpass-macro-common.c
> > index 1b9082d237c1..f54baaad54d4 100644
> > --- a/sound/soc/codecs/lpass-macro-common.c
> > +++ b/sound/soc/codecs/lpass-macro-common.c
> > @@ -16,7 +16,7 @@ struct lpass_macro *lpass_macro_pds_init(struct device *dev)
> >       struct lpass_macro *l_pds;
> >       int ret;
> >
> > -     if (!of_find_property(dev->of_node, "power-domains", NULL))
> > +     if (!of_property_present(dev->of_node, "power-domains"))
> >               return NULL;
> >
> >       l_pds = devm_kzalloc(dev, sizeof(*l_pds), GFP_KERNEL);
> > diff --git a/sound/soc/generic/audio-graph-card.c b/sound/soc/generic/audio-graph-card.c
> > index 5daa824a4ffc..d788f5f23a8a 100644
> > --- a/sound/soc/generic/audio-graph-card.c
> > +++ b/sound/soc/generic/audio-graph-card.c
> > @@ -78,7 +78,7 @@ static int graph_get_dai_id(struct device_node *ep)
> >                * only of_graph_parse_endpoint().
> >                * We need to check "reg" property
> >                */
> > -             if (of_get_property(ep,   "reg", NULL))
> > +             if (of_property_present(ep,   "reg"))
>
> Bit of nit picking, but any reason, why there are multiple spaces,
> before "reg" here?

Only because there was before and it was a scripted change.

Rob




[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Pulse Audio]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux