From: "Amadeusz Sławiński" <amadeuszx.slawinski@linux.intel.com>
To: Rob Herring <robh@kernel.org>,
Liam Girdwood <lgirdwood@gmail.com>,
Mark Brown <broonie@kernel.org>, Jaroslav Kysela <perex@perex.cz>,
Takashi Iwai <tiwai@suse.com>, Shawn Guo <shawnguo@kernel.org>,
Sascha Hauer <s.hauer@pengutronix.de>,
Pengutronix Kernel Team <kernel@pengutronix.de>,
Fabio Estevam <festevam@gmail.com>,
NXP Linux Team <linux-imx@nxp.com>,
Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>,
Sylwester Nawrocki <s.nawrocki@samsung.com>,
Olivier Moysan <olivier.moysan@foss.st.com>,
Arnaud Pouliquen <arnaud.pouliquen@foss.st.com>,
Maxime Coquelin <mcoquelin.stm32@gmail.com>,
Alexandre Torgue <alexandre.torgue@foss.st.com>,
Thierry Reding <thierry.reding@gmail.com>,
Jonathan Hunter <jonathanh@nvidia.com>
Cc: devicetree@vger.kernel.org, alsa-devel@alsa-project.org,
linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-stm32@st-md-mailman.stormreply.com,
linux-tegra@vger.kernel.org
Subject: Re: [PATCH] ASoC: Use of_property_present() for testing DT property presence
Date: Fri, 10 Mar 2023 16:01:45 +0100 [thread overview]
Message-ID: <a23852d7-c70c-a03c-99fb-b453bdc750a1@linux.intel.com> (raw)
In-Reply-To: <20230310144732.1546328-1-robh@kernel.org>
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@kernel.org>
> ---
> 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?
> return info.id;
>
> node = of_get_parent(ep);
> diff --git a/sound/soc/generic/audio-graph-card2.c b/sound/soc/generic/audio-graph-card2.c
> index 06609a526b78..259544f64df9 100644
> --- a/sound/soc/generic/audio-graph-card2.c
> +++ b/sound/soc/generic/audio-graph-card2.c
> @@ -376,7 +376,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"))
And here?
next prev parent reply other threads:[~2023-03-10 15:11 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-10 14:47 [PATCH] ASoC: Use of_property_present() for testing DT property presence Rob Herring
2023-03-10 15:01 ` Amadeusz Sławiński [this message]
2023-03-10 15:14 ` Rob Herring
2023-03-10 15:31 ` Mark Brown
2023-03-11 17:19 ` Mark Brown
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=a23852d7-c70c-a03c-99fb-b453bdc750a1@linux.intel.com \
--to=amadeuszx.slawinski@linux.intel.com \
--cc=alexandre.torgue@foss.st.com \
--cc=alsa-devel@alsa-project.org \
--cc=arnaud.pouliquen@foss.st.com \
--cc=broonie@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=festevam@gmail.com \
--cc=jonathanh@nvidia.com \
--cc=kernel@pengutronix.de \
--cc=krzysztof.kozlowski@linaro.org \
--cc=lgirdwood@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-imx@nxp.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-stm32@st-md-mailman.stormreply.com \
--cc=linux-tegra@vger.kernel.org \
--cc=mcoquelin.stm32@gmail.com \
--cc=olivier.moysan@foss.st.com \
--cc=perex@perex.cz \
--cc=robh@kernel.org \
--cc=s.hauer@pengutronix.de \
--cc=s.nawrocki@samsung.com \
--cc=shawnguo@kernel.org \
--cc=thierry.reding@gmail.com \
--cc=tiwai@suse.com \
/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