From patchwork Fri Mar 10 14:47:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Herring X-Patchwork-Id: 13169355 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 82C48C64EC4 for ; Fri, 10 Mar 2023 14:49:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=SKke38i3FauBwG/V4uXoNa94LLt1OoNYKNYFzikyYbs=; b=I+PLTicDRGF/gs bgRjQC8VzvW75Yk9mnqd3BTBcLUrCnsVoG+/D0ouc7WFrRedkiqoYBbbkPzBcTGX7xIxEKWUh8SFD XtSAXIv6ZLrn18LSD8YR9kI+vduuBKeY/FSxTVBHYZ9QW60FGVQtYHfvqQ2VbiDpI2DeSWW2Yon7V guQ3JixXzBm150CQjoQH1gaU6+R7A7W/qDXAJ8dE+n/2RGuRvAKEdJqyPZ7IKxxmlebv2F2qQSOir Lq+yiIMO3aaSYwMmhvcrSLZWo3WCzoIY7AbLb96M3KWaj+ZoQGYEha9pgQE4LHi7/N+LY1udqlYaK 6/9torQiAh1wFu4JKC0A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pae2h-00En6f-Os; Fri, 10 Mar 2023 14:48:24 +0000 Received: from mail-oa1-f43.google.com ([209.85.160.43]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pae2H-00Emay-EE for linux-arm-kernel@lists.infradead.org; Fri, 10 Mar 2023 14:47:59 +0000 Received: by mail-oa1-f43.google.com with SMTP id 586e51a60fabf-17671fb717cso6051451fac.8 for ; Fri, 10 Mar 2023 06:47:57 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678459677; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=8lNbDhvtNNABoeoJ1EEfrQ6VIu2kxnEGjaB82Wf/W24=; b=hLJY2ra2/zTLsCZ3qAbX2KAidvKp1urw5VlT4tG/TmCaoR32pm6dX63e7cUX6vZO21 VM7bI8IHBzWrsXqM5d0iY0KsfVd0p3mimuXOA14cNUR/ttUwm6vnzapLHOCvBMC8Sb/2 NSNzX6mr0dFN4nmiXOC3+PNbN31TkhiXLOlOBS5v9ISB5YCMgLLy23cA6CAY9+lnzd5O QKLSUSJR0A0ATiEwaBYMocKMWmOEWjP3imu+YG0/EXh4paq7etJOlE79MVkobn7IAXZl sJkUQmvh8sF8OhH4CAs9jS7rPktr4kziGsfejtycYfVi1Aqin4RNfctuePNRW6kETE/0 QX4Q== X-Gm-Message-State: AO0yUKVF0dfSd/xRWIMfTP0LXQTiJ8XTBdhDym5FpRjSfrIrhe2oCq3M MRtLenAnXps5lAcdj6fWbg== X-Google-Smtp-Source: AK7set9I+4VRoGtOVjvZEWPeH4QUf03Pg5OM+6KwBoqWhi2Fyc9oRdnGlhttZ2bQMXTrEhf9nUK3ig== X-Received: by 2002:a05:6870:73c6:b0:163:535d:4a86 with SMTP id a6-20020a05687073c600b00163535d4a86mr15295757oan.22.1678459676973; Fri, 10 Mar 2023 06:47:56 -0800 (PST) Received: from robh_at_kernel.org (66-90-144-107.dyn.grandenetworks.net. [66.90.144.107]) by smtp.gmail.com with ESMTPSA id m3-20020a056870a40300b00172289de1besm115189oal.18.2023.03.10.06.47.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Mar 2023 06:47:56 -0800 (PST) Received: (nullmailer pid 1546370 invoked by uid 1000); Fri, 10 Mar 2023 14:47:32 -0000 From: Rob Herring To: Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Krzysztof Kozlowski , Sylwester Nawrocki , Olivier Moysan , Arnaud Pouliquen , Maxime Coquelin , Alexandre Torgue , Thierry Reding , Jonathan Hunter 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: [PATCH] ASoC: Use of_property_present() for testing DT property presence Date: Fri, 10 Mar 2023 08:47:31 -0600 Message-Id: <20230310144732.1546328-1-robh@kernel.org> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230310_064757_534051_FD13EC5C X-CRM114-Status: GOOD ( 20.80 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org It is preferred to use typed property access functions (i.e. of_property_read_ 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 --- 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")) 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")) return info.id; node = of_get_parent(ep); diff --git a/sound/soc/mxs/mxs-sgtl5000.c b/sound/soc/mxs/mxs-sgtl5000.c index 746f40938675..a55e7256a4c3 100644 --- a/sound/soc/mxs/mxs-sgtl5000.c +++ b/sound/soc/mxs/mxs-sgtl5000.c @@ -150,7 +150,7 @@ static int mxs_sgtl5000_probe(struct platform_device *pdev) card->dev = &pdev->dev; - if (of_find_property(np, "audio-routing", NULL)) { + if (of_property_present(np, "audio-routing")) { card->dapm_widgets = mxs_sgtl5000_dapm_widgets; card->num_dapm_widgets = ARRAY_SIZE(mxs_sgtl5000_dapm_widgets); diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c index 6f96032090de..083e278aa021 100644 --- a/sound/soc/samsung/i2s.c +++ b/sound/soc/samsung/i2s.c @@ -1289,7 +1289,7 @@ static int i2s_register_clock_provider(struct samsung_i2s_priv *priv) int ret, i; /* Register the clock provider only if it's expected in the DTB */ - if (!of_find_property(dev->of_node, "#clock-cells", NULL)) + if (!of_property_present(dev->of_node, "#clock-cells")) return 0; /* Get the RCLKSRC mux clock parent clock names */ diff --git a/sound/soc/sh/fsi.c b/sound/soc/sh/fsi.c index f3edc2e3d9d7..9f3f1af6349f 100644 --- a/sound/soc/sh/fsi.c +++ b/sound/soc/sh/fsi.c @@ -1855,7 +1855,7 @@ static void fsi_of_parse(char *name, for (i = 0; i < ARRAY_SIZE(of_parse_property); i++) { sprintf(prop, "%s,%s", name, of_parse_property[i].name); - if (of_get_property(np, prop, NULL)) + if (of_property_present(np, prop)) flags |= of_parse_property[i].val; } info->flags = flags; diff --git a/sound/soc/stm/stm32_i2s.c b/sound/soc/stm/stm32_i2s.c index f3dd9f8e621c..9dad85ecb93f 100644 --- a/sound/soc/stm/stm32_i2s.c +++ b/sound/soc/stm/stm32_i2s.c @@ -1066,7 +1066,7 @@ static int stm32_i2s_parse_dt(struct platform_device *pdev, "Could not get x11k parent clock\n"); /* Register mclk provider if requested */ - if (of_find_property(np, "#clock-cells", NULL)) { + if (of_property_present(np, "#clock-cells")) { ret = stm32_i2s_add_mclk_provider(i2s); if (ret < 0) return ret; diff --git a/sound/soc/stm/stm32_sai_sub.c b/sound/soc/stm/stm32_sai_sub.c index eb31b49e6597..8ba4206f751d 100644 --- a/sound/soc/stm/stm32_sai_sub.c +++ b/sound/soc/stm/stm32_sai_sub.c @@ -1394,7 +1394,7 @@ static int stm32_sai_sub_parse_of(struct platform_device *pdev, /* Get spdif iec60958 property */ sai->spdif = false; - if (of_get_property(np, "st,iec60958", NULL)) { + if (of_property_present(np, "st,iec60958")) { if (!STM_SAI_HAS_SPDIF(sai) || sai->dir == SNDRV_PCM_STREAM_CAPTURE) { dev_err(&pdev->dev, "S/PDIF IEC60958 not supported\n"); @@ -1480,7 +1480,7 @@ static int stm32_sai_sub_parse_of(struct platform_device *pdev, return 0; /* Register mclk provider if requested */ - if (of_find_property(np, "#clock-cells", NULL)) { + if (of_property_present(np, "#clock-cells")) { ret = stm32_sai_add_mclk_provider(sai); if (ret < 0) return ret; diff --git a/sound/soc/tegra/tegra_asoc_machine.c b/sound/soc/tegra/tegra_asoc_machine.c index 78faa8bcae27..2dc1f44c5a8b 100644 --- a/sound/soc/tegra/tegra_asoc_machine.c +++ b/sound/soc/tegra/tegra_asoc_machine.c @@ -502,7 +502,7 @@ int tegra_asoc_machine_probe(struct platform_device *pdev) * If clock parents are not set in DT, configure here to use clk_out_1 * as mclk and extern1 as parent for Tegra30 and higher. */ - if (!of_find_property(dev->of_node, "assigned-clock-parents", NULL) && + if (!of_property_present(dev->of_node, "assigned-clock-parents") && !of_machine_is_compatible("nvidia,tegra20")) { struct clk *clk_out_1, *clk_extern1;