[PATCHv2 1/2] dmaengine: fsl_raid: pass platform_device to drvdata

From: Rosen Penev

Date: Tue Jul 21 2026 - 19:02:46 EST


Simplifies code slightly and avoids having to take pointer of a platform
device member. A platform device is always used.

Signed-off-by: Rosen Penev <rosenp@xxxxxxxxx>
---
drivers/dma/fsl_raid.c | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/drivers/dma/fsl_raid.c b/drivers/dma/fsl_raid.c
index da5228e121d1..2d54879cd6e1 100644
--- a/drivers/dma/fsl_raid.c
+++ b/drivers/dma/fsl_raid.c
@@ -219,10 +219,11 @@ static void fsl_re_dequeue(struct tasklet_struct *t)
/* Per Job Ring interrupt handler */
static irqreturn_t fsl_re_isr(int irq, void *data)
{
+ struct platform_device *pdev = data;
struct fsl_re_chan *re_chan;
u32 irqstate, status;

- re_chan = dev_get_drvdata((struct device *)data);
+ re_chan = platform_get_drvdata(pdev);

irqstate = in_be32(&re_chan->jrregs->jr_interrupt_status);
if (!irqstate)
@@ -649,7 +650,7 @@ static int fsl_re_chan_probe(struct platform_device *ofdev,
struct platform_device *chan_ofdev;

dev = &ofdev->dev;
- re_priv = dev_get_drvdata(dev);
+ re_priv = platform_get_drvdata(ofdev);
dma_dev = &re_priv->dma_dev;

chan = devm_kzalloc(dev, sizeof(*chan), GFP_KERNEL);
@@ -687,7 +688,7 @@ static int fsl_re_chan_probe(struct platform_device *ofdev,
chandev = &chan_ofdev->dev;
tasklet_setup(&chan->irqtask, fsl_re_dequeue);

- ret = request_irq(chan->irq, fsl_re_isr, 0, chan->name, chandev);
+ ret = request_irq(chan->irq, fsl_re_isr, 0, chan->name, chan_ofdev);
if (ret) {
dev_err(dev, "Unable to register interrupt for JR %d\n", q);
ret = -EINVAL;
@@ -743,7 +744,7 @@ static int fsl_re_chan_probe(struct platform_device *ofdev,
out_be32(&chan->jrregs->jr_config_1,
FSL_RE_CFG1_CBSI | FSL_RE_CFG1_CBS0 | status);

- dev_set_drvdata(chandev, chan);
+ platform_set_drvdata(chan_ofdev, chan);

/* Enable RE/CHAN */
out_be32(&chan->jrregs->jr_command, FSL_RE_ENABLE);
@@ -834,7 +835,7 @@ static int fsl_re_probe(struct platform_device *ofdev)
return -ENOMEM;
}

- dev_set_drvdata(dev, re_priv);
+ platform_set_drvdata(ofdev, re_priv);

/* Parse Device tree to find out the total number of JQs present */
for_each_compatible_node_scoped(np, NULL, "fsl,raideng-v1.0-job-queue") {
@@ -903,11 +904,9 @@ static void fsl_re_remove_chan(struct fsl_re_chan *chan)
static void fsl_re_remove(struct platform_device *ofdev)
{
struct fsl_re_drv_private *re_priv;
- struct device *dev;
int i;

- dev = &ofdev->dev;
- re_priv = dev_get_drvdata(dev);
+ re_priv = platform_get_drvdata(ofdev);

/* Unregister the DMA device first so no client can still hold a
* channel and submit new work while the channel rings are torn
--
2.55.0