diff mbox

[052/108] spi/xilinx: Clean ioremap calling

Message ID 1386922983-22135-53-git-send-email-daniel.sangorrin@toshiba.co.jp (mailing list archive)
State New, archived
Headers show

Commit Message

Daniel Sangorrin Dec. 13, 2013, 8:22 a.m. UTC
From: Michal Simek <michal.simek@xilinx.com>

devm_ioremap_resource() automatically checks that
struct resource is initialized.
Also group platform_get_resource() and devm_ioremap_resource()
together.
And remove mem resource from struct xilinx_spi.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit ad3fdbcaf98dc1258f7ee1503703e7fcbc0d8d8e)
Signed-off-by: Daniel Sangorrin <daniel.sangorrin@toshiba.co.jp>
Signed-off-by: Yoshitake Kobayashi <yoshitake.kobayashi@toshiba.co.jp>
---
 drivers/spi/spi-xilinx.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)
diff mbox

Patch

diff --git a/drivers/spi/spi-xilinx.c b/drivers/spi/spi-xilinx.c
index 5c98859..c3ea6ca 100644
--- a/drivers/spi/spi-xilinx.c
+++ b/drivers/spi/spi-xilinx.c
@@ -80,7 +80,6 @@  struct xilinx_spi {
 	/* bitbang has to be first */
 	struct spi_bitbang bitbang;
 	struct completion done;
-	struct resource mem; /* phys mem */
 	void __iomem	*regs;	/* virt. address of the control registers */
 
 	u32		irq;
@@ -359,7 +358,7 @@  static int xilinx_spi_probe(struct platform_device *pdev)
 {
 	struct xilinx_spi *xspi;
 	struct xspi_platform_data *pdata;
-	struct resource *r;
+	struct resource *res;
 	int ret, irq, num_cs = 0, bits_per_word = 8;
 	struct spi_master *master;
 	u32 tmp;
@@ -388,10 +387,6 @@  static int xilinx_spi_probe(struct platform_device *pdev)
 		return -EINVAL;
 	}
 
-	r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	if (!r)
-		return -ENODEV;
-
 	irq = platform_get_irq(pdev, 0);
 	if (irq < 0)
 		return -ENXIO;
@@ -411,7 +406,8 @@  static int xilinx_spi_probe(struct platform_device *pdev)
 	xspi->bitbang.master->setup = xilinx_spi_setup;
 	init_completion(&xspi->done);
 
-	xspi->regs = devm_ioremap_resource(&pdev->dev, r);
+	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+	xspi->regs = devm_ioremap_resource(&pdev->dev, res);
 	if (IS_ERR(xspi->regs)) {
 		ret = PTR_ERR(xspi->regs);
 		goto put_master;
@@ -421,7 +417,6 @@  static int xilinx_spi_probe(struct platform_device *pdev)
 	master->num_chipselect = num_cs;
 	master->dev.of_node = pdev->dev.of_node;
 
-	xspi->mem = *r;
 	xspi->irq = irq;
 
 	/*
@@ -473,7 +468,7 @@  static int xilinx_spi_probe(struct platform_device *pdev)
 	}
 
 	dev_info(&pdev->dev, "at 0x%08llX mapped to 0x%p, irq=%d\n",
-		(unsigned long long)r->start, xspi->regs, xspi->irq);
+		(unsigned long long)res->start, xspi->regs, xspi->irq);
 
 	if (pdata) {
 		for (i = 0; i < pdata->num_devices; i++)