<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Jun 1, 2022 at 5:23 PM Marco Felsch <<a href="mailto:m.felsch@pengutronix.de">m.felsch@pengutronix.de</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Use a local variable to dereference the device pointer once and use the<br>
local variable in further calls. No functional changes.<br>
<br>
Signed-off-by: Marco Felsch <<a href="mailto:m.felsch@pengutronix.de" target="_blank">m.felsch@pengutronix.de</a>><br></blockquote><div><br></div><div>Acked-by: Shengjiu Wang <<a href="mailto:shengjiu.wang@gmail.com">shengjiu.wang@gmail.com</a>></div><div><br></div><div>Best regards</div><div>Wang shengjiu </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
---<br>
 sound/soc/fsl/fsl_sai.c | 53 +++++++++++++++++++++--------------------<br>
 1 file changed, 27 insertions(+), 26 deletions(-)<br>
<br>
diff --git a/sound/soc/fsl/fsl_sai.c b/sound/soc/fsl/fsl_sai.c<br>
index fa950dde5310..a7637d602f3c 100644<br>
--- a/sound/soc/fsl/fsl_sai.c<br>
+++ b/sound/soc/fsl/fsl_sai.c<br>
@@ -1004,6 +1004,7 @@ static int fsl_sai_runtime_resume(struct device *dev);<br>
 static int fsl_sai_probe(struct platform_device *pdev)<br>
 {<br>
        struct device_node *np = pdev->dev.of_node;<br>
+       struct device *dev = &pdev->dev;<br>
        struct fsl_sai *sai;<br>
        struct regmap *gpr;<br>
        struct resource *res;<br>
@@ -1012,12 +1013,12 @@ static int fsl_sai_probe(struct platform_device *pdev)<br>
        int irq, ret, i;<br>
        int index;<br>
<br>
-       sai = devm_kzalloc(&pdev->dev, sizeof(*sai), GFP_KERNEL);<br>
+       sai = devm_kzalloc(dev, sizeof(*sai), GFP_KERNEL);<br>
        if (!sai)<br>
                return -ENOMEM;<br>
<br>
        sai->pdev = pdev;<br>
-       sai->soc_data = of_device_get_match_data(&pdev->dev);<br>
+       sai->soc_data = of_device_get_match_data(dev);<br>
<br>
        sai->is_lsb_first = of_property_read_bool(np, "lsb-first");<br>
<br>
@@ -1032,18 +1033,18 @@ static int fsl_sai_probe(struct platform_device *pdev)<br>
                        ARRAY_SIZE(fsl_sai_reg_defaults_ofs8);<br>
        }<br>
<br>
-       sai->regmap = devm_regmap_init_mmio(&pdev->dev, base, &fsl_sai_regmap_config);<br>
+       sai->regmap = devm_regmap_init_mmio(dev, base, &fsl_sai_regmap_config);<br>
        if (IS_ERR(sai->regmap)) {<br>
-               dev_err(&pdev->dev, "regmap init failed\n");<br>
+               dev_err(dev, "regmap init failed\n");<br>
                return PTR_ERR(sai->regmap);<br>
        }<br>
<br>
-       sai->bus_clk = devm_clk_get(&pdev->dev, "bus");<br>
+       sai->bus_clk = devm_clk_get(dev, "bus");<br>
        /* Compatible with old DTB cases */<br>
        if (IS_ERR(sai->bus_clk) && PTR_ERR(sai->bus_clk) != -EPROBE_DEFER)<br>
-               sai->bus_clk = devm_clk_get(&pdev->dev, "sai");<br>
+               sai->bus_clk = devm_clk_get(dev, "sai");<br>
        if (IS_ERR(sai->bus_clk)) {<br>
-               dev_err(&pdev->dev, "failed to get bus clock: %ld\n",<br>
+               dev_err(dev, "failed to get bus clock: %ld\n",<br>
                                PTR_ERR(sai->bus_clk));<br>
                /* -EPROBE_DEFER */<br>
                return PTR_ERR(sai->bus_clk);<br>
@@ -1051,9 +1052,9 @@ static int fsl_sai_probe(struct platform_device *pdev)<br>
<br>
        for (i = 1; i < FSL_SAI_MCLK_MAX; i++) {<br>
                sprintf(tmp, "mclk%d", i);<br>
-               sai->mclk_clk[i] = devm_clk_get(&pdev->dev, tmp);<br>
+               sai->mclk_clk[i] = devm_clk_get(dev, tmp);<br>
                if (IS_ERR(sai->mclk_clk[i])) {<br>
-                       dev_err(&pdev->dev, "failed to get mclk%d clock: %ld\n",<br>
+                       dev_err(dev, "failed to get mclk%d clock: %ld\n",<br>
                                        i + 1, PTR_ERR(sai->mclk_clk[i]));<br>
                        sai->mclk_clk[i] = NULL;<br>
                }<br>
@@ -1068,10 +1069,10 @@ static int fsl_sai_probe(struct platform_device *pdev)<br>
        if (irq < 0)<br>
                return irq;<br>
<br>
-       ret = devm_request_irq(&pdev->dev, irq, fsl_sai_isr, IRQF_SHARED,<br>
+       ret = devm_request_irq(dev, irq, fsl_sai_isr, IRQF_SHARED,<br>
                               np->name, sai);<br>
        if (ret) {<br>
-               dev_err(&pdev->dev, "failed to claim irq %u\n", irq);<br>
+               dev_err(dev, "failed to claim irq %u\n", irq);<br>
                return ret;<br>
        }<br>
<br>
@@ -1088,7 +1089,7 @@ static int fsl_sai_probe(struct platform_device *pdev)<br>
        if (of_find_property(np, "fsl,sai-synchronous-rx", NULL) &&<br>
            of_find_property(np, "fsl,sai-asynchronous", NULL)) {<br>
                /* error out if both synchronous and asynchronous are present */<br>
-               dev_err(&pdev->dev, "invalid binding for synchronous mode\n");<br>
+               dev_err(dev, "invalid binding for synchronous mode\n");<br>
                return -EINVAL;<br>
        }<br>
<br>
@@ -1109,7 +1110,7 @@ static int fsl_sai_probe(struct platform_device *pdev)<br>
            of_device_is_compatible(np, "fsl,imx6ul-sai")) {<br>
                gpr = syscon_regmap_lookup_by_compatible("fsl,imx6ul-iomuxc-gpr");<br>
                if (IS_ERR(gpr)) {<br>
-                       dev_err(&pdev->dev, "cannot find iomuxc registers\n");<br>
+                       dev_err(dev, "cannot find iomuxc registers\n");<br>
                        return PTR_ERR(gpr);<br>
                }<br>
<br>
@@ -1127,23 +1128,23 @@ static int fsl_sai_probe(struct platform_device *pdev)<br>
        sai->dma_params_tx.maxburst = FSL_SAI_MAXBURST_TX;<br>
<br>
        platform_set_drvdata(pdev, sai);<br>
-       pm_runtime_enable(&pdev->dev);<br>
-       if (!pm_runtime_enabled(&pdev->dev)) {<br>
-               ret = fsl_sai_runtime_resume(&pdev->dev);<br>
+       pm_runtime_enable(dev);<br>
+       if (!pm_runtime_enabled(dev)) {<br>
+               ret = fsl_sai_runtime_resume(dev);<br>
                if (ret)<br>
                        goto err_pm_disable;<br>
        }<br>
<br>
-       ret = pm_runtime_get_sync(&pdev->dev);<br>
+       ret = pm_runtime_get_sync(dev);<br>
        if (ret < 0) {<br>
-               pm_runtime_put_noidle(&pdev->dev);<br>
+               pm_runtime_put_noidle(dev);<br>
                goto err_pm_get_sync;<br>
        }<br>
<br>
        /* Get sai version */<br>
-       ret = fsl_sai_check_version(&pdev->dev);<br>
+       ret = fsl_sai_check_version(dev);<br>
        if (ret < 0)<br>
-               dev_warn(&pdev->dev, "Error reading SAI version: %d\n", ret);<br>
+               dev_warn(dev, "Error reading SAI version: %d\n", ret);<br>
<br>
        /* Select MCLK direction */<br>
        if (of_find_property(np, "fsl,sai-mclk-direction-output", NULL) &&<br>
@@ -1152,7 +1153,7 @@ static int fsl_sai_probe(struct platform_device *pdev)<br>
                                   FSL_SAI_MCTL_MCLK_EN, FSL_SAI_MCTL_MCLK_EN);<br>
        }<br>
<br>
-       ret = pm_runtime_put_sync(&pdev->dev);<br>
+       ret = pm_runtime_put_sync(dev);<br>
        if (ret < 0)<br>
                goto err_pm_get_sync;<br>
<br>
@@ -1165,12 +1166,12 @@ static int fsl_sai_probe(struct platform_device *pdev)<br>
                if (ret)<br>
                        goto err_pm_get_sync;<br>
        } else {<br>
-               ret = devm_snd_dmaengine_pcm_register(&pdev->dev, NULL, 0);<br>
+               ret = devm_snd_dmaengine_pcm_register(dev, NULL, 0);<br>
                if (ret)<br>
                        goto err_pm_get_sync;<br>
        }<br>
<br>
-       ret = devm_snd_soc_register_component(&pdev->dev, &fsl_component,<br>
+       ret = devm_snd_soc_register_component(dev, &fsl_component,<br>
                                              &sai->cpu_dai_drv, 1);<br>
        if (ret)<br>
                goto err_pm_get_sync;<br>
@@ -1178,10 +1179,10 @@ static int fsl_sai_probe(struct platform_device *pdev)<br>
        return ret;<br>
<br>
 err_pm_get_sync:<br>
-       if (!pm_runtime_status_suspended(&pdev->dev))<br>
-               fsl_sai_runtime_suspend(&pdev->dev);<br>
+       if (!pm_runtime_status_suspended(dev))<br>
+               fsl_sai_runtime_suspend(dev);<br>
 err_pm_disable:<br>
-       pm_runtime_disable(&pdev->dev);<br>
+       pm_runtime_disable(dev);<br>
<br>
        return ret;<br>
 }<br>
-- <br>
2.30.2<br>
<br>
</blockquote></div></div>