spi: sh-msiof: use dev in sh_msiof_spi_probe()

sh_msiof_spi_probe() is using priv->dev everywhere,
but it makes code long. Create struct device *dev and use it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://patch.msgid.link/87y0vy2x0o.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Kuninori Morimoto 2025-04-17 23:23:03 +00:00 committed by Mark Brown
parent 8ffd015db8
commit c4887bd4b3
No known key found for this signature in database
GPG Key ID: 24D68B725D5487D0

View File

@ -1276,20 +1276,21 @@ static int sh_msiof_spi_probe(struct platform_device *pdev)
const struct sh_msiof_chipdata *chipdata;
struct sh_msiof_spi_info *info;
struct sh_msiof_spi_priv *p;
struct device *dev = &pdev->dev;
unsigned long clksrc;
int i;
int ret;
chipdata = of_device_get_match_data(&pdev->dev);
chipdata = of_device_get_match_data(dev);
if (chipdata) {
info = sh_msiof_spi_parse_dt(&pdev->dev);
info = sh_msiof_spi_parse_dt(dev);
} else {
chipdata = (const void *)pdev->id_entry->driver_data;
info = dev_get_platdata(&pdev->dev);
info = dev_get_platdata(dev);
}
if (!info) {
dev_err(&pdev->dev, "failed to obtain device info\n");
dev_err(dev, "failed to obtain device info\n");
return -ENXIO;
}
@ -1297,11 +1298,9 @@ static int sh_msiof_spi_probe(struct platform_device *pdev)
info->dtdl = 200;
if (info->mode == MSIOF_SPI_TARGET)
ctlr = spi_alloc_target(&pdev->dev,
sizeof(struct sh_msiof_spi_priv));
ctlr = spi_alloc_target(dev, sizeof(struct sh_msiof_spi_priv));
else
ctlr = spi_alloc_host(&pdev->dev,
sizeof(struct sh_msiof_spi_priv));
ctlr = spi_alloc_host(dev, sizeof(struct sh_msiof_spi_priv));
if (ctlr == NULL)
return -ENOMEM;
@ -1315,9 +1314,9 @@ static int sh_msiof_spi_probe(struct platform_device *pdev)
init_completion(&p->done);
init_completion(&p->done_txdma);
p->clk = devm_clk_get(&pdev->dev, NULL);
p->clk = devm_clk_get(dev, NULL);
if (IS_ERR(p->clk)) {
dev_err(&pdev->dev, "cannot get clock\n");
dev_err(dev, "cannot get clock\n");
ret = PTR_ERR(p->clk);
goto err1;
}
@ -1334,15 +1333,14 @@ static int sh_msiof_spi_probe(struct platform_device *pdev)
goto err1;
}
ret = devm_request_irq(&pdev->dev, i, sh_msiof_spi_irq, 0,
dev_name(&pdev->dev), p);
ret = devm_request_irq(dev, i, sh_msiof_spi_irq, 0, dev_name(&pdev->dev), p);
if (ret) {
dev_err(&pdev->dev, "unable to request irq\n");
dev_err(dev, "unable to request irq\n");
goto err1;
}
p->pdev = pdev;
pm_runtime_enable(&pdev->dev);
pm_runtime_enable(dev);
/* Platform data may override FIFO sizes */
p->tx_fifo_size = chipdata->tx_fifo_size;
@ -1361,7 +1359,7 @@ static int sh_msiof_spi_probe(struct platform_device *pdev)
ctlr->flags = chipdata->ctlr_flags;
ctlr->bus_num = pdev->id;
ctlr->num_chipselect = p->info->num_chipselect;
ctlr->dev.of_node = pdev->dev.of_node;
ctlr->dev.of_node = dev->of_node;
ctlr->setup = sh_msiof_spi_setup;
ctlr->prepare_message = sh_msiof_prepare_message;
ctlr->target_abort = sh_msiof_target_abort;
@ -1373,11 +1371,11 @@ static int sh_msiof_spi_probe(struct platform_device *pdev)
ret = sh_msiof_request_dma(p);
if (ret < 0)
dev_warn(&pdev->dev, "DMA not available, using PIO\n");
dev_warn(dev, "DMA not available, using PIO\n");
ret = devm_spi_register_controller(&pdev->dev, ctlr);
ret = devm_spi_register_controller(dev, ctlr);
if (ret < 0) {
dev_err(&pdev->dev, "devm_spi_register_controller error.\n");
dev_err(dev, "devm_spi_register_controller error.\n");
goto err2;
}
@ -1385,7 +1383,7 @@ static int sh_msiof_spi_probe(struct platform_device *pdev)
err2:
sh_msiof_release_dma(p);
pm_runtime_disable(&pdev->dev);
pm_runtime_disable(dev);
err1:
spi_controller_put(ctlr);
return ret;