Linux Sound subsystem development
 help / color / mirror / Atom feed
From: Fabio Estevam <festevam@gmail.com>
To: broonie@kernel.org
Cc: robh@kernel.org, lgirdwood@gmail.com, perex@perex.cz,
	tiwai@suse.com, linux-sound@vger.kernel.org,
	Fabio Estevam <festevam@denx.de>
Subject: [PATCH] ASoC: soc-core: Use of_property_present() for non-boolean properties
Date: Wed,  5 Feb 2025 09:01:28 -0300	[thread overview]
Message-ID: <20250205120128.1080295-1-festevam@gmail.com> (raw)

From: Fabio Estevam <festevam@denx.de>

The use of of_property_read_bool() for non-boolean properties is
deprecated in favor of of_property_present() when testing for property
presence.

Switch to of_property_present() to fix the following warnings observed
when booting the imx8mp-evk board:

[   11.436855] OF: /sound-bt-sco/simple-audio-card,cpu: Read of boolean property 'dai-tdm-slot-num' with a value.
[   11.436885] OF: /sound-bt-sco/simple-audio-card,cpu: Read of boolean property 'dai-tdm-slot-width' with a value.
[   11.436941] OF: /sound-bt-sco: Read of boolean property 'simple-audio-card,bitclock-master' with a value.
[   11.436960] OF: /sound-bt-sco: Read of boolean property 'simple-audio-card,frame-master' with a value.

Based on Rob Herring's patch for mmc.

Signed-off-by: Fabio Estevam <festevam@denx.de>
---
 sound/soc/soc-core.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 3c6d8aef4130..2c529210a8e0 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -3120,7 +3120,7 @@ int snd_soc_of_parse_tdm_slot(struct device_node *np,
 	if (rx_mask)
 		snd_soc_of_get_slot_mask(np, "dai-tdm-slot-rx-mask", rx_mask);
 
-	if (of_property_read_bool(np, "dai-tdm-slot-num")) {
+	if (of_property_present(np, "dai-tdm-slot-num")) {
 		ret = of_property_read_u32(np, "dai-tdm-slot-num", &val);
 		if (ret)
 			return ret;
@@ -3129,7 +3129,7 @@ int snd_soc_of_parse_tdm_slot(struct device_node *np,
 			*slots = val;
 	}
 
-	if (of_property_read_bool(np, "dai-tdm-slot-width")) {
+	if (of_property_present(np, "dai-tdm-slot-width")) {
 		ret = of_property_read_u32(np, "dai-tdm-slot-width", &val);
 		if (ret)
 			return ret;
@@ -3403,12 +3403,12 @@ unsigned int snd_soc_daifmt_parse_clock_provider_raw(struct device_node *np,
 	 * check "[prefix]frame-master"
 	 */
 	snprintf(prop, sizeof(prop), "%sbitclock-master", prefix);
-	bit = of_property_read_bool(np, prop);
+	bit = of_property_present(np, prop);
 	if (bit && bitclkmaster)
 		*bitclkmaster = of_parse_phandle(np, prop, 0);
 
 	snprintf(prop, sizeof(prop), "%sframe-master", prefix);
-	frame = of_property_read_bool(np, prop);
+	frame = of_property_present(np, prop);
 	if (frame && framemaster)
 		*framemaster = of_parse_phandle(np, prop, 0);
 
-- 
2.34.1


             reply	other threads:[~2025-02-05 12:01 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-05 12:01 Fabio Estevam [this message]
2025-02-05 12:45 ` [PATCH] ASoC: soc-core: Use of_property_present() for non-boolean properties Mark Brown
2025-02-05 12:50   ` Fabio Estevam
2025-02-05 12:52     ` Fabio Estevam

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=20250205120128.1080295-1-festevam@gmail.com \
    --to=festevam@gmail.com \
    --cc=broonie@kernel.org \
    --cc=festevam@denx.de \
    --cc=lgirdwood@gmail.com \
    --cc=linux-sound@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=robh@kernel.org \
    --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