Commit 3f049e7d authored by Markus Elfring's avatar Markus Elfring Committed by Mark Brown

spi: xtensa-xtfpga: Use devm_platform_ioremap_resource() in xtfpga_spi_probe()

Simplify this function implementation by using a known wrapper function.

This issue was detected by using the Coccinelle software.
Signed-off-by: default avatarMarkus Elfring <elfring@users.sourceforge.net>
Link: https://lore.kernel.org/r/178bb78e-714f-645f-d819-5732870c4272@web.deSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 6cdcb5d3
...@@ -80,7 +80,6 @@ static void xtfpga_spi_chipselect(struct spi_device *spi, int is_on) ...@@ -80,7 +80,6 @@ static void xtfpga_spi_chipselect(struct spi_device *spi, int is_on)
static int xtfpga_spi_probe(struct platform_device *pdev) static int xtfpga_spi_probe(struct platform_device *pdev)
{ {
struct xtfpga_spi *xspi; struct xtfpga_spi *xspi;
struct resource *mem;
int ret; int ret;
struct spi_master *master; struct spi_master *master;
...@@ -97,14 +96,7 @@ static int xtfpga_spi_probe(struct platform_device *pdev) ...@@ -97,14 +96,7 @@ static int xtfpga_spi_probe(struct platform_device *pdev)
xspi->bitbang.master = master; xspi->bitbang.master = master;
xspi->bitbang.chipselect = xtfpga_spi_chipselect; xspi->bitbang.chipselect = xtfpga_spi_chipselect;
xspi->bitbang.txrx_word[SPI_MODE_0] = xtfpga_spi_txrx_word; xspi->bitbang.txrx_word[SPI_MODE_0] = xtfpga_spi_txrx_word;
xspi->regs = devm_platform_ioremap_resource(pdev, 0);
mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!mem) {
dev_err(&pdev->dev, "No memory resource\n");
ret = -ENODEV;
goto err;
}
xspi->regs = devm_ioremap_resource(&pdev->dev, mem);
if (IS_ERR(xspi->regs)) { if (IS_ERR(xspi->regs)) {
ret = PTR_ERR(xspi->regs); ret = PTR_ERR(xspi->regs);
goto err; goto err;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment