ASoC: Use of_property_present() for testing DT property presence
authorRob Herring <robh@kernel.org>
Fri, 10 Mar 2023 14:47:31 +0000 (08:47 -0600)
committerMark Brown <broonie@kernel.org>
Sat, 11 Mar 2023 12:18:54 +0000 (12:18 +0000)
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>
Link: https://lore.kernel.org/r/20230310144732.1546328-1-robh@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/codecs/lpass-macro-common.c
sound/soc/generic/audio-graph-card.c
sound/soc/generic/audio-graph-card2.c
sound/soc/mxs/mxs-sgtl5000.c
sound/soc/samsung/i2s.c
sound/soc/sh/fsi.c
sound/soc/stm/stm32_i2s.c
sound/soc/stm/stm32_sai_sub.c
sound/soc/tegra/tegra_asoc_machine.c

index 1b9082d237c13989e7d5ecac96505f401a346151..f54baaad54d4b4c2c5b3e73bfc2c2d868df01cc3 100644 (file)
@@ -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);
index 5daa824a4ffcf8925cd18b9406e4353413dd038b..d788f5f23a8acd2425899931b0e9c48817820ed1 100644 (file)
@@ -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);
index 06609a526b78321f44a9a6e1e9eb5cc09cf9cd09..259544f64df91e88a973c87e71be878566b5af70 100644 (file)
@@ -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);
index 746f409386751c820c294aedff12915cbf2eec1d..a55e7256a4c3b0fefe885d50356593cd69c92652 100644 (file)
@@ -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);
 
index 6f96032090de96de6d974bd640f96d28d57ad6ed..083e278aa021009aa25a1367fecc05937ec7caff 100644 (file)
@@ -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 */
index f3edc2e3d9d7c492391e2c1f8eb682b87feeb410..9f3f1af6349fd43ed63eeb626d1f67de1aff4b39 100644 (file)
@@ -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;
index f3dd9f8e621cc851259a3b7cdbfdc59f6ce77b60..9dad85ecb93f657f95e3840bb7260eb431e6a2c7 100644 (file)
@@ -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;
index eb31b49e659785bd0087e940dbfd1a6e2363de8e..8ba4206f751d1956e00d51581fa71522035b2fdf 100644 (file)
@@ -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;
index 78faa8bcae2742411fa799b49f060884d19af8ab..2dc1f44c5a8bb8592db9d8865c07c91506de29d5 100644 (file)
@@ -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;