Commit 7cb2abd0 authored by Mark Brown's avatar Mark Brown

spi/xilinx: Refer to platform device as pdev in probe() and remove()

This is a more traditional name and makes things a bit clearer when
referring to actual struct devices as we do frequently during probe().
Signed-off-by: default avatarMark Brown <broonie@linaro.org>
Acked-by: default avatarMichal Simek <michal.simek@xilinx.com>
parent d81c0bbb
...@@ -340,7 +340,7 @@ static const struct of_device_id xilinx_spi_of_match[] = { ...@@ -340,7 +340,7 @@ static const struct of_device_id xilinx_spi_of_match[] = {
}; };
MODULE_DEVICE_TABLE(of, xilinx_spi_of_match); MODULE_DEVICE_TABLE(of, xilinx_spi_of_match);
static int xilinx_spi_probe(struct platform_device *dev) static int xilinx_spi_probe(struct platform_device *pdev)
{ {
struct xilinx_spi *xspi; struct xilinx_spi *xspi;
struct xspi_platform_data *pdata; struct xspi_platform_data *pdata;
...@@ -350,19 +350,19 @@ static int xilinx_spi_probe(struct platform_device *dev) ...@@ -350,19 +350,19 @@ static int xilinx_spi_probe(struct platform_device *dev)
u32 tmp; u32 tmp;
u8 i; u8 i;
pdata = dev->dev.platform_data; pdata = pdev->dev.platform_data;
if (pdata) { if (pdata) {
num_cs = pdata->num_chipselect; num_cs = pdata->num_chipselect;
bits_per_word = pdata->bits_per_word; bits_per_word = pdata->bits_per_word;
} }
#ifdef CONFIG_OF #ifdef CONFIG_OF
if (dev->dev.of_node) { if (pdev->dev.of_node) {
const __be32 *prop; const __be32 *prop;
int len; int len;
/* number of slave select bits is required */ /* number of slave select bits is required */
prop = of_get_property(dev->dev.of_node, "xlnx,num-ss-bits", prop = of_get_property(pdev->dev.of_node, "xlnx,num-ss-bits",
&len); &len);
if (prop && len >= sizeof(*prop)) if (prop && len >= sizeof(*prop))
num_cs = __be32_to_cpup(prop); num_cs = __be32_to_cpup(prop);
...@@ -370,19 +370,20 @@ static int xilinx_spi_probe(struct platform_device *dev) ...@@ -370,19 +370,20 @@ static int xilinx_spi_probe(struct platform_device *dev)
#endif #endif
if (!num_cs) { if (!num_cs) {
dev_err(&dev->dev, "Missing slave select configuration data\n"); dev_err(&pdev->dev,
"Missing slave select configuration data\n");
return -EINVAL; return -EINVAL;
} }
r = platform_get_resource(dev, IORESOURCE_MEM, 0); r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!r) if (!r)
return -ENODEV; return -ENODEV;
irq = platform_get_irq(dev, 0); irq = platform_get_irq(pdev, 0);
if (irq < 0) if (irq < 0)
return -ENXIO; return -ENXIO;
master = spi_alloc_master(&dev->dev, sizeof(struct xilinx_spi)); master = spi_alloc_master(&pdev->dev, sizeof(struct xilinx_spi));
if (!master) if (!master)
return -ENODEV; return -ENODEV;
...@@ -396,15 +397,15 @@ static int xilinx_spi_probe(struct platform_device *dev) ...@@ -396,15 +397,15 @@ static int xilinx_spi_probe(struct platform_device *dev)
xspi->bitbang.txrx_bufs = xilinx_spi_txrx_bufs; xspi->bitbang.txrx_bufs = xilinx_spi_txrx_bufs;
init_completion(&xspi->done); init_completion(&xspi->done);
xspi->regs = devm_ioremap_resource(&dev->dev, r); xspi->regs = devm_ioremap_resource(&pdev->dev, r);
if (IS_ERR(xspi->regs)) { if (IS_ERR(xspi->regs)) {
ret = PTR_ERR(xspi->regs); ret = PTR_ERR(xspi->regs);
goto put_master; goto put_master;
} }
master->bus_num = dev->dev.id; master->bus_num = pdev->dev.id;
master->num_chipselect = num_cs; master->num_chipselect = num_cs;
master->dev.of_node = dev->dev.of_node; master->dev.of_node = pdev->dev.of_node;
xspi->mem = *r; xspi->mem = *r;
xspi->irq = irq; xspi->irq = irq;
...@@ -453,11 +454,11 @@ static int xilinx_spi_probe(struct platform_device *dev) ...@@ -453,11 +454,11 @@ static int xilinx_spi_probe(struct platform_device *dev)
ret = spi_bitbang_start(&xspi->bitbang); ret = spi_bitbang_start(&xspi->bitbang);
if (ret) { if (ret) {
dev_err(&dev->dev, "spi_bitbang_start FAILED\n"); dev_err(&pdev->dev, "spi_bitbang_start FAILED\n");
goto free_irq; goto free_irq;
} }
dev_info(&dev->dev, "at 0x%08llX mapped to 0x%p, irq=%d\n", 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)r->start, xspi->regs, xspi->irq);
if (pdata) { if (pdata) {
...@@ -465,7 +466,7 @@ static int xilinx_spi_probe(struct platform_device *dev) ...@@ -465,7 +466,7 @@ static int xilinx_spi_probe(struct platform_device *dev)
spi_new_device(master, pdata->devices + i); spi_new_device(master, pdata->devices + i);
} }
platform_set_drvdata(dev, master); platform_set_drvdata(pdev, master);
return 0; return 0;
free_irq: free_irq:
...@@ -476,9 +477,9 @@ static int xilinx_spi_probe(struct platform_device *dev) ...@@ -476,9 +477,9 @@ static int xilinx_spi_probe(struct platform_device *dev)
return ret; return ret;
} }
static int xilinx_spi_remove(struct platform_device *dev) static int xilinx_spi_remove(struct platform_device *pdev)
{ {
struct spi_master *master = platform_get_drvdata(dev); struct spi_master *master = platform_get_drvdata(pdev);
struct xilinx_spi *xspi = spi_master_get_devdata(master); struct xilinx_spi *xspi = spi_master_get_devdata(master);
spi_bitbang_stop(&xspi->bitbang); spi_bitbang_stop(&xspi->bitbang);
......
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