From: Frank Li <Frank.li@nxp.com>
To: Marco Felsch <m.felsch@pengutronix.de>
Cc: Vinod Koul <vkoul@kernel.org>, Shawn Guo <shawnguo@kernel.org>,
Sascha Hauer <s.hauer@pengutronix.de>,
Pengutronix Kernel Team <kernel@pengutronix.de>,
Fabio Estevam <festevam@gmail.com>,
Jiada Wang <jiada_wang@mentor.com>,
dmaengine@vger.kernel.org, imx@lists.linux.dev,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 03/11] dmaengine: imx-sdma: cosmetic cleanup
Date: Wed, 3 Sep 2025 10:55:45 -0400 [thread overview]
Message-ID: <aLhW8XQV/PSqCZrx@lizhi-Precision-Tower-5810> (raw)
In-Reply-To: <20250903-v6-16-topic-sdma-v1-3-ac7bab629e8b@pengutronix.de>
On Wed, Sep 03, 2025 at 03:06:11PM +0200, Marco Felsch wrote:
> Make use of local struct device pointer to not dereference the
> platform_device pointer everytime.
>
> Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
> ---
> drivers/dma/imx-sdma.c | 31 ++++++++++++++++---------------
> 1 file changed, 16 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c
> index 422086632d3445b2ce3f2e5df9b2130174a311e8..a85739d279f51fdb517fce90b3dc67673cf2b56c 100644
> --- a/drivers/dma/imx-sdma.c
> +++ b/drivers/dma/imx-sdma.c
> @@ -2234,7 +2234,8 @@ static struct dma_chan *sdma_xlate(struct of_phandle_args *dma_spec,
>
> static int sdma_probe(struct platform_device *pdev)
> {
> - struct device_node *np = pdev->dev.of_node;
> + struct device *dev = &pdev->dev;
> + struct device_node *np = dev->of_node;
> struct device_node *spba_bus;
> const char *fw_name;
> int ret;
> @@ -2244,18 +2245,18 @@ static int sdma_probe(struct platform_device *pdev)
> struct sdma_engine *sdma;
> s32 *saddr_arr;
>
> - ret = dma_coerce_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
> + ret = dma_coerce_mask_and_coherent(dev, DMA_BIT_MASK(32));
> if (ret)
> return ret;
Not related this patch, you can remove this check later because
dma_coerce_mask_and_coherent() never return failure when >= 32bit.
Reviewed-by: Frank Li <Frank.Li@nxp.com>
>
> - sdma = devm_kzalloc(&pdev->dev, sizeof(*sdma), GFP_KERNEL);
> + sdma = devm_kzalloc(dev, sizeof(*sdma), GFP_KERNEL);
> if (!sdma)
> return -ENOMEM;
>
> spin_lock_init(&sdma->channel_0_lock);
>
> - sdma->dev = &pdev->dev;
> - sdma->drvdata = of_device_get_match_data(sdma->dev);
> + sdma->dev = dev;
> + sdma->drvdata = of_device_get_match_data(dev);
>
> irq = platform_get_irq(pdev, 0);
> if (irq < 0)
> @@ -2265,11 +2266,11 @@ static int sdma_probe(struct platform_device *pdev)
> if (IS_ERR(sdma->regs))
> return PTR_ERR(sdma->regs);
>
> - sdma->clk_ipg = devm_clk_get(&pdev->dev, "ipg");
> + sdma->clk_ipg = devm_clk_get(dev, "ipg");
> if (IS_ERR(sdma->clk_ipg))
> return PTR_ERR(sdma->clk_ipg);
>
> - sdma->clk_ahb = devm_clk_get(&pdev->dev, "ahb");
> + sdma->clk_ahb = devm_clk_get(dev, "ahb");
> if (IS_ERR(sdma->clk_ahb))
> return PTR_ERR(sdma->clk_ahb);
>
> @@ -2281,8 +2282,8 @@ static int sdma_probe(struct platform_device *pdev)
> if (ret)
> goto err_clk;
>
> - ret = devm_request_irq(&pdev->dev, irq, sdma_int_handler, 0,
> - dev_name(&pdev->dev), sdma);
> + ret = devm_request_irq(dev, irq, sdma_int_handler, 0,
> + dev_name(dev), sdma);
> if (ret)
> goto err_irq;
>
> @@ -2327,7 +2328,7 @@ static int sdma_probe(struct platform_device *pdev)
>
> sdma->iram_pool = of_gen_pool_get(np, "iram", 0);
> if (sdma->iram_pool)
> - dev_info(&pdev->dev, "alloc bd from iram.\n");
> + dev_info(dev, "alloc bd from iram.\n");
>
> ret = sdma_init(sdma);
> if (ret)
> @@ -2340,7 +2341,7 @@ static int sdma_probe(struct platform_device *pdev)
> if (sdma->drvdata->script_addrs)
> sdma_add_scripts(sdma, sdma->drvdata->script_addrs);
>
> - sdma->dma_device.dev = &pdev->dev;
> + sdma->dma_device.dev = dev;
>
> sdma->dma_device.device_alloc_chan_resources = sdma_alloc_chan_resources;
> sdma->dma_device.device_free_chan_resources = sdma_free_chan_resources;
> @@ -2363,13 +2364,13 @@ static int sdma_probe(struct platform_device *pdev)
>
> ret = dma_async_device_register(&sdma->dma_device);
> if (ret) {
> - dev_err(&pdev->dev, "unable to register\n");
> + dev_err(dev, "unable to register\n");
> goto err_init;
> }
>
> ret = of_dma_controller_register(np, sdma_xlate, sdma);
> if (ret) {
> - dev_err(&pdev->dev, "failed to register controller\n");
> + dev_err(dev, "failed to register controller\n");
> goto err_register;
> }
>
> @@ -2389,11 +2390,11 @@ static int sdma_probe(struct platform_device *pdev)
> ret = of_property_read_string(np, "fsl,sdma-ram-script-name",
> &fw_name);
> if (ret) {
> - dev_warn(&pdev->dev, "failed to get firmware name\n");
> + dev_warn(dev, "failed to get firmware name\n");
> } else {
> ret = sdma_get_firmware(sdma, fw_name);
> if (ret)
> - dev_warn(&pdev->dev, "failed to get firmware from device tree\n");
> + dev_warn(dev, "failed to get firmware from device tree\n");
> }
>
> return 0;
>
> --
> 2.47.2
>
next prev parent reply other threads:[~2025-09-03 19:54 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-03 13:06 [PATCH 00/11] i.MX SDMA cleanups and fixes Marco Felsch
2025-09-03 13:06 ` [PATCH 01/11] dmaengine: imx-sdma: drop legacy device_node np check Marco Felsch
2025-09-03 14:48 ` Frank Li
2025-09-03 13:06 ` [PATCH 02/11] dmaengine: imx-sdma: sdma_remove minor cleanups Marco Felsch
2025-09-03 14:50 ` Frank Li
2025-09-03 13:06 ` [PATCH 03/11] dmaengine: imx-sdma: cosmetic cleanup Marco Felsch
2025-09-03 14:55 ` Frank Li [this message]
2025-09-03 13:06 ` [PATCH 04/11] dmaengine: imx-sdma: make use of devm_kzalloc for script_addrs Marco Felsch
2025-09-03 15:00 ` Frank Li
2025-09-03 13:06 ` [PATCH 05/11] dmaengine: imx-sdma: make use of devm_clk_get_prepared() Marco Felsch
2025-09-03 15:01 ` Frank Li
2025-09-03 13:06 ` [PATCH 06/11] dmaengine: imx-sdma: make use of devm_add_action_or_reset to unregiser the dma_device Marco Felsch
2025-09-03 14:53 ` Frank Li
2025-09-10 10:13 ` Marco Felsch
2025-09-03 13:06 ` [PATCH 07/11] dmaengine: imx-sdma: make use of dev_err_probe() Marco Felsch
2025-09-03 15:04 ` Frank Li
2025-09-10 12:05 ` Marco Felsch
2025-09-03 13:06 ` [PATCH 08/11] dmaengine: imx-sdma: fix missing of_dma_controller_free() Marco Felsch
2025-09-03 15:08 ` Frank Li
2025-09-10 9:45 ` Marco Felsch
2025-09-03 13:06 ` [PATCH 09/11] dmaengine: add support for device_link Marco Felsch
2025-09-03 14:46 ` Frank Li
2025-09-09 12:03 ` Marco Felsch
2025-09-09 14:42 ` Frank Li
2025-09-10 9:34 ` Marco Felsch
2025-09-10 15:51 ` Frank Li
2025-09-10 19:35 ` Marco Felsch
2025-09-10 21:41 ` Frank Li
2025-09-11 11:50 ` Marco Felsch
2025-09-11 15:18 ` Frank Li
2025-09-11 19:23 ` Marco Felsch
2025-09-03 13:06 ` [PATCH 10/11] dmaengine: imx-sdma: drop remove callback Marco Felsch
2025-09-03 15:15 ` Frank Li
2025-09-03 13:06 ` [PATCH 11/11] dmaengine: imx-sdma: fix spba-bus handling for i.MX8M Marco Felsch
2025-09-04 4:31 ` kernel test robot
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=aLhW8XQV/PSqCZrx@lizhi-Precision-Tower-5810 \
--to=frank.li@nxp.com \
--cc=dmaengine@vger.kernel.org \
--cc=festevam@gmail.com \
--cc=imx@lists.linux.dev \
--cc=jiada_wang@mentor.com \
--cc=kernel@pengutronix.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=m.felsch@pengutronix.de \
--cc=s.hauer@pengutronix.de \
--cc=shawnguo@kernel.org \
--cc=vkoul@kernel.org \
/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