[PATCH 02/13] dmaengine: mxs-dma: Use local dev variable in probe()
Frank Li
Frank.Li at nxp.com
Wed Jan 14 14:33:14 PST 2026
Introduce a local dev variable in probe() to avoid repeated use of
&pdev->dev throughout the function.
No functional change.
Signed-off-by: Frank Li <Frank.Li at nxp.com>
---
drivers/dma/mxs-dma.c | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/drivers/dma/mxs-dma.c b/drivers/dma/mxs-dma.c
index cfb9962417ef68e976ae03c3c6f3054dc89bd1e6..c7e535c91469f0d819d6fe7465725736dc6128d8 100644
--- a/drivers/dma/mxs-dma.c
+++ b/drivers/dma/mxs-dma.c
@@ -744,20 +744,21 @@ static int mxs_dma_probe(struct platform_device *pdev)
{
struct device_node *np = pdev->dev.of_node;
const struct mxs_dma_type *dma_type;
+ struct device *dev = &pdev->dev;
struct mxs_dma_engine *mxs_dma;
int ret, i;
- mxs_dma = devm_kzalloc(&pdev->dev, sizeof(*mxs_dma), GFP_KERNEL);
+ mxs_dma = devm_kzalloc(dev, sizeof(*mxs_dma), GFP_KERNEL);
if (!mxs_dma)
return -ENOMEM;
ret = of_property_read_u32(np, "dma-channels", &mxs_dma->nr_channels);
if (ret) {
- dev_err(&pdev->dev, "failed to read dma-channels\n");
+ dev_err(dev, "failed to read dma-channels\n");
return ret;
}
- dma_type = (struct mxs_dma_type *)of_device_get_match_data(&pdev->dev);
+ dma_type = (struct mxs_dma_type *)of_device_get_match_data(dev);
mxs_dma->type = dma_type->type;
mxs_dma->dev_id = dma_type->id;
@@ -765,7 +766,7 @@ static int mxs_dma_probe(struct platform_device *pdev)
if (IS_ERR(mxs_dma->base))
return PTR_ERR(mxs_dma->base);
- mxs_dma->clk = devm_clk_get(&pdev->dev, NULL);
+ mxs_dma->clk = devm_clk_get(dev, NULL);
if (IS_ERR(mxs_dma->clk))
return PTR_ERR(mxs_dma->clk);
@@ -795,7 +796,7 @@ static int mxs_dma_probe(struct platform_device *pdev)
return ret;
mxs_dma->pdev = pdev;
- mxs_dma->dma_device.dev = &pdev->dev;
+ mxs_dma->dma_device.dev = dev;
/* mxs_dma gets 65535 bytes maximum sg size */
dma_set_max_seg_size(mxs_dma->dma_device.dev, MAX_XFER_BYTES);
@@ -816,13 +817,13 @@ static int mxs_dma_probe(struct platform_device *pdev)
ret = dmaenginem_async_device_register(&mxs_dma->dma_device);
if (ret) {
- dev_err(mxs_dma->dma_device.dev, "unable to register\n");
+ dev_err(dev, "unable to register\n");
return ret;
}
ret = of_dma_controller_register(np, mxs_dma_xlate, mxs_dma);
if (ret) {
- dev_err(mxs_dma->dma_device.dev,
+ dev_err(dev,
"failed to register controller\n");
}
--
2.34.1
More information about the linux-arm-kernel
mailing list