diff options
author | Mark Brown <broonie@linaro.org> | 2013-07-05 06:24:26 -0400 |
---|---|---|
committer | Mark Brown <broonie@linaro.org> | 2013-07-15 06:45:52 -0400 |
commit | 7cb2abd05fe1f9aea70b8ee38004b60bc882ffb5 (patch) | |
tree | eca9b338dad883404d6fc61fa3d4cb5ca6061c52 /drivers | |
parent | d81c0bbbf84086568b559bee59e4a93aba4a6e0f (diff) |
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: Mark Brown <broonie@linaro.org>
Acked-by: Michal Simek <michal.simek@xilinx.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/spi/spi-xilinx.c | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/drivers/spi/spi-xilinx.c b/drivers/spi/spi-xilinx.c index 038e59a8bf0a..3026efa5a59f 100644 --- a/drivers/spi/spi-xilinx.c +++ b/drivers/spi/spi-xilinx.c | |||
@@ -340,7 +340,7 @@ static const struct of_device_id xilinx_spi_of_match[] = { | |||
340 | }; | 340 | }; |
341 | MODULE_DEVICE_TABLE(of, xilinx_spi_of_match); | 341 | MODULE_DEVICE_TABLE(of, xilinx_spi_of_match); |
342 | 342 | ||
343 | static int xilinx_spi_probe(struct platform_device *dev) | 343 | static int xilinx_spi_probe(struct platform_device *pdev) |
344 | { | 344 | { |
345 | struct xilinx_spi *xspi; | 345 | struct xilinx_spi *xspi; |
346 | struct xspi_platform_data *pdata; | 346 | struct xspi_platform_data *pdata; |
@@ -350,19 +350,19 @@ static int xilinx_spi_probe(struct platform_device *dev) | |||
350 | u32 tmp; | 350 | u32 tmp; |
351 | u8 i; | 351 | u8 i; |
352 | 352 | ||
353 | pdata = dev->dev.platform_data; | 353 | pdata = pdev->dev.platform_data; |
354 | if (pdata) { | 354 | if (pdata) { |
355 | num_cs = pdata->num_chipselect; | 355 | num_cs = pdata->num_chipselect; |
356 | bits_per_word = pdata->bits_per_word; | 356 | bits_per_word = pdata->bits_per_word; |
357 | } | 357 | } |
358 | 358 | ||
359 | #ifdef CONFIG_OF | 359 | #ifdef CONFIG_OF |
360 | if (dev->dev.of_node) { | 360 | if (pdev->dev.of_node) { |
361 | const __be32 *prop; | 361 | const __be32 *prop; |
362 | int len; | 362 | int len; |
363 | 363 | ||
364 | /* number of slave select bits is required */ | 364 | /* number of slave select bits is required */ |
365 | prop = of_get_property(dev->dev.of_node, "xlnx,num-ss-bits", | 365 | prop = of_get_property(pdev->dev.of_node, "xlnx,num-ss-bits", |
366 | &len); | 366 | &len); |
367 | if (prop && len >= sizeof(*prop)) | 367 | if (prop && len >= sizeof(*prop)) |
368 | num_cs = __be32_to_cpup(prop); | 368 | num_cs = __be32_to_cpup(prop); |
@@ -370,19 +370,20 @@ static int xilinx_spi_probe(struct platform_device *dev) | |||
370 | #endif | 370 | #endif |
371 | 371 | ||
372 | if (!num_cs) { | 372 | if (!num_cs) { |
373 | dev_err(&dev->dev, "Missing slave select configuration data\n"); | 373 | dev_err(&pdev->dev, |
374 | "Missing slave select configuration data\n"); | ||
374 | return -EINVAL; | 375 | return -EINVAL; |
375 | } | 376 | } |
376 | 377 | ||
377 | r = platform_get_resource(dev, IORESOURCE_MEM, 0); | 378 | r = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
378 | if (!r) | 379 | if (!r) |
379 | return -ENODEV; | 380 | return -ENODEV; |
380 | 381 | ||
381 | irq = platform_get_irq(dev, 0); | 382 | irq = platform_get_irq(pdev, 0); |
382 | if (irq < 0) | 383 | if (irq < 0) |
383 | return -ENXIO; | 384 | return -ENXIO; |
384 | 385 | ||
385 | master = spi_alloc_master(&dev->dev, sizeof(struct xilinx_spi)); | 386 | master = spi_alloc_master(&pdev->dev, sizeof(struct xilinx_spi)); |
386 | if (!master) | 387 | if (!master) |
387 | return -ENODEV; | 388 | return -ENODEV; |
388 | 389 | ||
@@ -396,15 +397,15 @@ static int xilinx_spi_probe(struct platform_device *dev) | |||
396 | xspi->bitbang.txrx_bufs = xilinx_spi_txrx_bufs; | 397 | xspi->bitbang.txrx_bufs = xilinx_spi_txrx_bufs; |
397 | init_completion(&xspi->done); | 398 | init_completion(&xspi->done); |
398 | 399 | ||
399 | xspi->regs = devm_ioremap_resource(&dev->dev, r); | 400 | xspi->regs = devm_ioremap_resource(&pdev->dev, r); |
400 | if (IS_ERR(xspi->regs)) { | 401 | if (IS_ERR(xspi->regs)) { |
401 | ret = PTR_ERR(xspi->regs); | 402 | ret = PTR_ERR(xspi->regs); |
402 | goto put_master; | 403 | goto put_master; |
403 | } | 404 | } |
404 | 405 | ||
405 | master->bus_num = dev->dev.id; | 406 | master->bus_num = pdev->dev.id; |
406 | master->num_chipselect = num_cs; | 407 | master->num_chipselect = num_cs; |
407 | master->dev.of_node = dev->dev.of_node; | 408 | master->dev.of_node = pdev->dev.of_node; |
408 | 409 | ||
409 | xspi->mem = *r; | 410 | xspi->mem = *r; |
410 | xspi->irq = irq; | 411 | xspi->irq = irq; |
@@ -453,11 +454,11 @@ static int xilinx_spi_probe(struct platform_device *dev) | |||
453 | 454 | ||
454 | ret = spi_bitbang_start(&xspi->bitbang); | 455 | ret = spi_bitbang_start(&xspi->bitbang); |
455 | if (ret) { | 456 | if (ret) { |
456 | dev_err(&dev->dev, "spi_bitbang_start FAILED\n"); | 457 | dev_err(&pdev->dev, "spi_bitbang_start FAILED\n"); |
457 | goto free_irq; | 458 | goto free_irq; |
458 | } | 459 | } |
459 | 460 | ||
460 | dev_info(&dev->dev, "at 0x%08llX mapped to 0x%p, irq=%d\n", | 461 | dev_info(&pdev->dev, "at 0x%08llX mapped to 0x%p, irq=%d\n", |
461 | (unsigned long long)r->start, xspi->regs, xspi->irq); | 462 | (unsigned long long)r->start, xspi->regs, xspi->irq); |
462 | 463 | ||
463 | if (pdata) { | 464 | if (pdata) { |
@@ -465,7 +466,7 @@ static int xilinx_spi_probe(struct platform_device *dev) | |||
465 | spi_new_device(master, pdata->devices + i); | 466 | spi_new_device(master, pdata->devices + i); |
466 | } | 467 | } |
467 | 468 | ||
468 | platform_set_drvdata(dev, master); | 469 | platform_set_drvdata(pdev, master); |
469 | return 0; | 470 | return 0; |
470 | 471 | ||
471 | free_irq: | 472 | free_irq: |
@@ -476,9 +477,9 @@ put_master: | |||
476 | return ret; | 477 | return ret; |
477 | } | 478 | } |
478 | 479 | ||
479 | static int xilinx_spi_remove(struct platform_device *dev) | 480 | static int xilinx_spi_remove(struct platform_device *pdev) |
480 | { | 481 | { |
481 | struct spi_master *master = platform_get_drvdata(dev); | 482 | struct spi_master *master = platform_get_drvdata(pdev); |
482 | struct xilinx_spi *xspi = spi_master_get_devdata(master); | 483 | struct xilinx_spi *xspi = spi_master_get_devdata(master); |
483 | 484 | ||
484 | spi_bitbang_stop(&xspi->bitbang); | 485 | spi_bitbang_stop(&xspi->bitbang); |