diff options
author | Axel Lin <axel.lin@ingics.com> | 2013-09-10 03:43:41 -0400 |
---|---|---|
committer | Mark Brown <broonie@linaro.org> | 2013-10-07 09:50:43 -0400 |
commit | 702a4879ec337463f858c8ab467482cce260bf18 (patch) | |
tree | e726356d57e6be815e201d12694a82c461a636e3 | |
parent | d0e639c9e06d44e713170031fe05fb60ebe680af (diff) |
spi: bitbang: Let spi_bitbang_start() take a reference to master
Many drivers that use bitbang library have a leak on probe error paths.
This is because once a spi_master_get() call succeeds, we need an additional
spi_master_put() call to free the memory.
Fix this issue by moving the code taking a reference to master to
spi_bitbang_start(), so spi_bitbang_start() will take a reference to master on
success. With this change, the caller is responsible for calling
spi_bitbang_stop() to decrement the reference and spi_master_put() as
counterpart of spi_alloc_master() to prevent a memory leak.
So now we have below patten for drivers using bitbang library:
probe:
spi_alloc_master -> Init reference count to 1
spi_bitbang_start -> Increment reference count
remove:
spi_bitbang_stop -> Decrement reference count
spi_master_put -> Decrement reference count (reference count reaches 0)
Fixup all users accordingly.
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Suggested-by: Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>
Acked-by: Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
-rw-r--r-- | drivers/spi/spi-altera.c | 2 | ||||
-rw-r--r-- | drivers/spi/spi-ath79.c | 2 | ||||
-rw-r--r-- | drivers/spi/spi-au1550.c | 2 | ||||
-rw-r--r-- | drivers/spi/spi-bitbang.c | 12 | ||||
-rw-r--r-- | drivers/spi/spi-butterfly.c | 2 | ||||
-rw-r--r-- | drivers/spi/spi-davinci.c | 10 | ||||
-rw-r--r-- | drivers/spi/spi-efm32.c | 2 | ||||
-rw-r--r-- | drivers/spi/spi-fsl-dspi.c | 2 | ||||
-rw-r--r-- | drivers/spi/spi-gpio.c | 5 | ||||
-rw-r--r-- | drivers/spi/spi-imx.c | 2 | ||||
-rw-r--r-- | drivers/spi/spi-lm70llp.c | 2 | ||||
-rw-r--r-- | drivers/spi/spi-nuc900.c | 3 | ||||
-rw-r--r-- | drivers/spi/spi-oc-tiny.c | 2 | ||||
-rw-r--r-- | drivers/spi/spi-ppc4xx.c | 3 | ||||
-rw-r--r-- | drivers/spi/spi-s3c24xx.c | 2 | ||||
-rw-r--r-- | drivers/spi/spi-sh-sci.c | 2 | ||||
-rw-r--r-- | drivers/spi/spi-sirf.c | 2 | ||||
-rw-r--r-- | drivers/spi/spi-xilinx.c | 2 |
18 files changed, 33 insertions, 26 deletions
diff --git a/drivers/spi/spi-altera.c b/drivers/spi/spi-altera.c index 9a64c3fee218..595b62cb545d 100644 --- a/drivers/spi/spi-altera.c +++ b/drivers/spi/spi-altera.c | |||
@@ -219,7 +219,7 @@ static int altera_spi_probe(struct platform_device *pdev) | |||
219 | platform_set_drvdata(pdev, hw); | 219 | platform_set_drvdata(pdev, hw); |
220 | 220 | ||
221 | /* setup the state for the bitbang driver */ | 221 | /* setup the state for the bitbang driver */ |
222 | hw->bitbang.master = spi_master_get(master); | 222 | hw->bitbang.master = master; |
223 | if (!hw->bitbang.master) | 223 | if (!hw->bitbang.master) |
224 | return err; | 224 | return err; |
225 | hw->bitbang.chipselect = altera_spi_chipsel; | 225 | hw->bitbang.chipselect = altera_spi_chipsel; |
diff --git a/drivers/spi/spi-ath79.c b/drivers/spi/spi-ath79.c index 37bad952ab38..821bf7ac218d 100644 --- a/drivers/spi/spi-ath79.c +++ b/drivers/spi/spi-ath79.c | |||
@@ -231,7 +231,7 @@ static int ath79_spi_probe(struct platform_device *pdev) | |||
231 | master->num_chipselect = pdata->num_chipselect; | 231 | master->num_chipselect = pdata->num_chipselect; |
232 | } | 232 | } |
233 | 233 | ||
234 | sp->bitbang.master = spi_master_get(master); | 234 | sp->bitbang.master = master; |
235 | sp->bitbang.chipselect = ath79_spi_chipselect; | 235 | sp->bitbang.chipselect = ath79_spi_chipselect; |
236 | sp->bitbang.txrx_word[SPI_MODE_0] = ath79_spi_txrx_mode0; | 236 | sp->bitbang.txrx_word[SPI_MODE_0] = ath79_spi_txrx_mode0; |
237 | sp->bitbang.setup_transfer = spi_bitbang_setup_transfer; | 237 | sp->bitbang.setup_transfer = spi_bitbang_setup_transfer; |
diff --git a/drivers/spi/spi-au1550.c b/drivers/spi/spi-au1550.c index 1d00d9b397dd..e06400a3a719 100644 --- a/drivers/spi/spi-au1550.c +++ b/drivers/spi/spi-au1550.c | |||
@@ -775,7 +775,7 @@ static int au1550_spi_probe(struct platform_device *pdev) | |||
775 | 775 | ||
776 | hw = spi_master_get_devdata(master); | 776 | hw = spi_master_get_devdata(master); |
777 | 777 | ||
778 | hw->master = spi_master_get(master); | 778 | hw->master = master; |
779 | hw->pdata = dev_get_platdata(&pdev->dev); | 779 | hw->pdata = dev_get_platdata(&pdev->dev); |
780 | hw->dev = &pdev->dev; | 780 | hw->dev = &pdev->dev; |
781 | 781 | ||
diff --git a/drivers/spi/spi-bitbang.c b/drivers/spi/spi-bitbang.c index 8c11355dec23..0056623dfc6b 100644 --- a/drivers/spi/spi-bitbang.c +++ b/drivers/spi/spi-bitbang.c | |||
@@ -414,10 +414,16 @@ static int spi_bitbang_unprepare_hardware(struct spi_master *spi) | |||
414 | * This routine registers the spi_master, which will process requests in a | 414 | * This routine registers the spi_master, which will process requests in a |
415 | * dedicated task, keeping IRQs unblocked most of the time. To stop | 415 | * dedicated task, keeping IRQs unblocked most of the time. To stop |
416 | * processing those requests, call spi_bitbang_stop(). | 416 | * processing those requests, call spi_bitbang_stop(). |
417 | * | ||
418 | * On success, this routine will take a reference to master. The caller is | ||
419 | * responsible for calling spi_bitbang_stop() to decrement the reference and | ||
420 | * spi_master_put() as counterpart of spi_alloc_master() to prevent a memory | ||
421 | * leak. | ||
417 | */ | 422 | */ |
418 | int spi_bitbang_start(struct spi_bitbang *bitbang) | 423 | int spi_bitbang_start(struct spi_bitbang *bitbang) |
419 | { | 424 | { |
420 | struct spi_master *master = bitbang->master; | 425 | struct spi_master *master = bitbang->master; |
426 | int ret; | ||
421 | 427 | ||
422 | if (!master || !bitbang->chipselect) | 428 | if (!master || !bitbang->chipselect) |
423 | return -EINVAL; | 429 | return -EINVAL; |
@@ -449,7 +455,11 @@ int spi_bitbang_start(struct spi_bitbang *bitbang) | |||
449 | /* driver may get busy before register() returns, especially | 455 | /* driver may get busy before register() returns, especially |
450 | * if someone registered boardinfo for devices | 456 | * if someone registered boardinfo for devices |
451 | */ | 457 | */ |
452 | return spi_register_master(master); | 458 | ret = spi_register_master(spi_master_get(master)); |
459 | if (ret) | ||
460 | spi_master_put(master); | ||
461 | |||
462 | return 0; | ||
453 | } | 463 | } |
454 | EXPORT_SYMBOL_GPL(spi_bitbang_start); | 464 | EXPORT_SYMBOL_GPL(spi_bitbang_start); |
455 | 465 | ||
diff --git a/drivers/spi/spi-butterfly.c b/drivers/spi/spi-butterfly.c index 5ed08e537433..b1ecea2d76b3 100644 --- a/drivers/spi/spi-butterfly.c +++ b/drivers/spi/spi-butterfly.c | |||
@@ -225,7 +225,7 @@ static void butterfly_attach(struct parport *p) | |||
225 | master->bus_num = 42; | 225 | master->bus_num = 42; |
226 | master->num_chipselect = 2; | 226 | master->num_chipselect = 2; |
227 | 227 | ||
228 | pp->bitbang.master = spi_master_get(master); | 228 | pp->bitbang.master = master; |
229 | pp->bitbang.chipselect = butterfly_chipselect; | 229 | pp->bitbang.chipselect = butterfly_chipselect; |
230 | pp->bitbang.txrx_word[SPI_MODE_0] = butterfly_txrx_word_mode0; | 230 | pp->bitbang.txrx_word[SPI_MODE_0] = butterfly_txrx_word_mode0; |
231 | 231 | ||
diff --git a/drivers/spi/spi-davinci.c b/drivers/spi/spi-davinci.c index 8fbfe2483ffd..af2bb73d0168 100644 --- a/drivers/spi/spi-davinci.c +++ b/drivers/spi/spi-davinci.c | |||
@@ -916,7 +916,7 @@ static int davinci_spi_probe(struct platform_device *pdev) | |||
916 | if (ret) | 916 | if (ret) |
917 | goto unmap_io; | 917 | goto unmap_io; |
918 | 918 | ||
919 | dspi->bitbang.master = spi_master_get(master); | 919 | dspi->bitbang.master = master; |
920 | if (dspi->bitbang.master == NULL) { | 920 | if (dspi->bitbang.master == NULL) { |
921 | ret = -ENODEV; | 921 | ret = -ENODEV; |
922 | goto irq_free; | 922 | goto irq_free; |
@@ -925,7 +925,7 @@ static int davinci_spi_probe(struct platform_device *pdev) | |||
925 | dspi->clk = clk_get(&pdev->dev, NULL); | 925 | dspi->clk = clk_get(&pdev->dev, NULL); |
926 | if (IS_ERR(dspi->clk)) { | 926 | if (IS_ERR(dspi->clk)) { |
927 | ret = -ENODEV; | 927 | ret = -ENODEV; |
928 | goto put_master; | 928 | goto irq_free; |
929 | } | 929 | } |
930 | clk_prepare_enable(dspi->clk); | 930 | clk_prepare_enable(dspi->clk); |
931 | 931 | ||
@@ -1015,8 +1015,6 @@ free_dma: | |||
1015 | free_clk: | 1015 | free_clk: |
1016 | clk_disable_unprepare(dspi->clk); | 1016 | clk_disable_unprepare(dspi->clk); |
1017 | clk_put(dspi->clk); | 1017 | clk_put(dspi->clk); |
1018 | put_master: | ||
1019 | spi_master_put(master); | ||
1020 | irq_free: | 1018 | irq_free: |
1021 | free_irq(dspi->irq, dspi); | 1019 | free_irq(dspi->irq, dspi); |
1022 | unmap_io: | 1020 | unmap_io: |
@@ -1024,7 +1022,7 @@ unmap_io: | |||
1024 | release_region: | 1022 | release_region: |
1025 | release_mem_region(dspi->pbase, resource_size(r)); | 1023 | release_mem_region(dspi->pbase, resource_size(r)); |
1026 | free_master: | 1024 | free_master: |
1027 | kfree(master); | 1025 | spi_master_put(master); |
1028 | err: | 1026 | err: |
1029 | return ret; | 1027 | return ret; |
1030 | } | 1028 | } |
@@ -1051,11 +1049,11 @@ static int davinci_spi_remove(struct platform_device *pdev) | |||
1051 | 1049 | ||
1052 | clk_disable_unprepare(dspi->clk); | 1050 | clk_disable_unprepare(dspi->clk); |
1053 | clk_put(dspi->clk); | 1051 | clk_put(dspi->clk); |
1054 | spi_master_put(master); | ||
1055 | free_irq(dspi->irq, dspi); | 1052 | free_irq(dspi->irq, dspi); |
1056 | iounmap(dspi->base); | 1053 | iounmap(dspi->base); |
1057 | r = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 1054 | r = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
1058 | release_mem_region(dspi->pbase, resource_size(r)); | 1055 | release_mem_region(dspi->pbase, resource_size(r)); |
1056 | spi_master_put(master); | ||
1059 | 1057 | ||
1060 | return 0; | 1058 | return 0; |
1061 | } | 1059 | } |
diff --git a/drivers/spi/spi-efm32.c b/drivers/spi/spi-efm32.c index 7d84418a01d8..d428a40778c1 100644 --- a/drivers/spi/spi-efm32.c +++ b/drivers/spi/spi-efm32.c | |||
@@ -347,7 +347,7 @@ static int efm32_spi_probe(struct platform_device *pdev) | |||
347 | 347 | ||
348 | ddata = spi_master_get_devdata(master); | 348 | ddata = spi_master_get_devdata(master); |
349 | 349 | ||
350 | ddata->bitbang.master = spi_master_get(master); | 350 | ddata->bitbang.master = master; |
351 | ddata->bitbang.chipselect = efm32_spi_chipselect; | 351 | ddata->bitbang.chipselect = efm32_spi_chipselect; |
352 | ddata->bitbang.setup_transfer = efm32_spi_setup_transfer; | 352 | ddata->bitbang.setup_transfer = efm32_spi_setup_transfer; |
353 | ddata->bitbang.txrx_bufs = efm32_spi_txrx_bufs; | 353 | ddata->bitbang.txrx_bufs = efm32_spi_txrx_bufs; |
diff --git a/drivers/spi/spi-fsl-dspi.c b/drivers/spi/spi-fsl-dspi.c index 6cd07d13ecab..d338b6722255 100644 --- a/drivers/spi/spi-fsl-dspi.c +++ b/drivers/spi/spi-fsl-dspi.c | |||
@@ -450,7 +450,7 @@ static int dspi_probe(struct platform_device *pdev) | |||
450 | 450 | ||
451 | dspi = spi_master_get_devdata(master); | 451 | dspi = spi_master_get_devdata(master); |
452 | dspi->pdev = pdev; | 452 | dspi->pdev = pdev; |
453 | dspi->bitbang.master = spi_master_get(master); | 453 | dspi->bitbang.master = master; |
454 | dspi->bitbang.chipselect = dspi_chipselect; | 454 | dspi->bitbang.chipselect = dspi_chipselect; |
455 | dspi->bitbang.setup_transfer = dspi_setup_transfer; | 455 | dspi->bitbang.setup_transfer = dspi_setup_transfer; |
456 | dspi->bitbang.txrx_bufs = dspi_txrx_transfer; | 456 | dspi->bitbang.txrx_bufs = dspi_txrx_transfer; |
diff --git a/drivers/spi/spi-gpio.c b/drivers/spi/spi-gpio.c index 68b69fec13a9..14c01b44ca7a 100644 --- a/drivers/spi/spi-gpio.c +++ b/drivers/spi/spi-gpio.c | |||
@@ -467,7 +467,7 @@ static int spi_gpio_probe(struct platform_device *pdev) | |||
467 | } | 467 | } |
468 | #endif | 468 | #endif |
469 | 469 | ||
470 | spi_gpio->bitbang.master = spi_master_get(master); | 470 | spi_gpio->bitbang.master = master; |
471 | spi_gpio->bitbang.chipselect = spi_gpio_chipselect; | 471 | spi_gpio->bitbang.chipselect = spi_gpio_chipselect; |
472 | 472 | ||
473 | if ((master_flags & (SPI_MASTER_NO_TX | SPI_MASTER_NO_RX)) == 0) { | 473 | if ((master_flags & (SPI_MASTER_NO_TX | SPI_MASTER_NO_RX)) == 0) { |
@@ -486,7 +486,6 @@ static int spi_gpio_probe(struct platform_device *pdev) | |||
486 | 486 | ||
487 | status = spi_bitbang_start(&spi_gpio->bitbang); | 487 | status = spi_bitbang_start(&spi_gpio->bitbang); |
488 | if (status < 0) { | 488 | if (status < 0) { |
489 | spi_master_put(spi_gpio->bitbang.master); | ||
490 | gpio_free: | 489 | gpio_free: |
491 | if (SPI_MISO_GPIO != SPI_GPIO_NO_MISO) | 490 | if (SPI_MISO_GPIO != SPI_GPIO_NO_MISO) |
492 | gpio_free(SPI_MISO_GPIO); | 491 | gpio_free(SPI_MISO_GPIO); |
@@ -510,13 +509,13 @@ static int spi_gpio_remove(struct platform_device *pdev) | |||
510 | 509 | ||
511 | /* stop() unregisters child devices too */ | 510 | /* stop() unregisters child devices too */ |
512 | status = spi_bitbang_stop(&spi_gpio->bitbang); | 511 | status = spi_bitbang_stop(&spi_gpio->bitbang); |
513 | spi_master_put(spi_gpio->bitbang.master); | ||
514 | 512 | ||
515 | if (SPI_MISO_GPIO != SPI_GPIO_NO_MISO) | 513 | if (SPI_MISO_GPIO != SPI_GPIO_NO_MISO) |
516 | gpio_free(SPI_MISO_GPIO); | 514 | gpio_free(SPI_MISO_GPIO); |
517 | if (SPI_MOSI_GPIO != SPI_GPIO_NO_MOSI) | 515 | if (SPI_MOSI_GPIO != SPI_GPIO_NO_MOSI) |
518 | gpio_free(SPI_MOSI_GPIO); | 516 | gpio_free(SPI_MOSI_GPIO); |
519 | gpio_free(SPI_SCK_GPIO); | 517 | gpio_free(SPI_SCK_GPIO); |
518 | spi_master_put(spi_gpio->bitbang.master); | ||
520 | 519 | ||
521 | return status; | 520 | return status; |
522 | } | 521 | } |
diff --git a/drivers/spi/spi-imx.c b/drivers/spi/spi-imx.c index 15323d8bd9cf..02d9f468b2b6 100644 --- a/drivers/spi/spi-imx.c +++ b/drivers/spi/spi-imx.c | |||
@@ -786,7 +786,7 @@ static int spi_imx_probe(struct platform_device *pdev) | |||
786 | master->num_chipselect = num_cs; | 786 | master->num_chipselect = num_cs; |
787 | 787 | ||
788 | spi_imx = spi_master_get_devdata(master); | 788 | spi_imx = spi_master_get_devdata(master); |
789 | spi_imx->bitbang.master = spi_master_get(master); | 789 | spi_imx->bitbang.master = master; |
790 | 790 | ||
791 | for (i = 0; i < master->num_chipselect; i++) { | 791 | for (i = 0; i < master->num_chipselect; i++) { |
792 | int cs_gpio = of_get_named_gpio(np, "cs-gpios", i); | 792 | int cs_gpio = of_get_named_gpio(np, "cs-gpios", i); |
diff --git a/drivers/spi/spi-lm70llp.c b/drivers/spi/spi-lm70llp.c index 0759b5db9883..41c5765be746 100644 --- a/drivers/spi/spi-lm70llp.c +++ b/drivers/spi/spi-lm70llp.c | |||
@@ -222,7 +222,7 @@ static void spi_lm70llp_attach(struct parport *p) | |||
222 | /* | 222 | /* |
223 | * SPI and bitbang hookup. | 223 | * SPI and bitbang hookup. |
224 | */ | 224 | */ |
225 | pp->bitbang.master = spi_master_get(master); | 225 | pp->bitbang.master = master; |
226 | pp->bitbang.chipselect = lm70_chipselect; | 226 | pp->bitbang.chipselect = lm70_chipselect; |
227 | pp->bitbang.txrx_word[SPI_MODE_0] = lm70_txrx; | 227 | pp->bitbang.txrx_word[SPI_MODE_0] = lm70_txrx; |
228 | pp->bitbang.flags = SPI_3WIRE; | 228 | pp->bitbang.flags = SPI_3WIRE; |
diff --git a/drivers/spi/spi-nuc900.c b/drivers/spi/spi-nuc900.c index 47a68b43bcd5..e0c32bc69ee2 100644 --- a/drivers/spi/spi-nuc900.c +++ b/drivers/spi/spi-nuc900.c | |||
@@ -349,7 +349,7 @@ static int nuc900_spi_probe(struct platform_device *pdev) | |||
349 | } | 349 | } |
350 | 350 | ||
351 | hw = spi_master_get_devdata(master); | 351 | hw = spi_master_get_devdata(master); |
352 | hw->master = spi_master_get(master); | 352 | hw->master = master; |
353 | hw->pdata = dev_get_platdata(&pdev->dev); | 353 | hw->pdata = dev_get_platdata(&pdev->dev); |
354 | hw->dev = &pdev->dev; | 354 | hw->dev = &pdev->dev; |
355 | 355 | ||
@@ -435,7 +435,6 @@ err_iomap: | |||
435 | kfree(hw->ioarea); | 435 | kfree(hw->ioarea); |
436 | err_pdata: | 436 | err_pdata: |
437 | spi_master_put(hw->master); | 437 | spi_master_put(hw->master); |
438 | |||
439 | err_nomem: | 438 | err_nomem: |
440 | return err; | 439 | return err; |
441 | } | 440 | } |
diff --git a/drivers/spi/spi-oc-tiny.c b/drivers/spi/spi-oc-tiny.c index 333cb1badcd7..91c668596202 100644 --- a/drivers/spi/spi-oc-tiny.c +++ b/drivers/spi/spi-oc-tiny.c | |||
@@ -306,7 +306,7 @@ static int tiny_spi_probe(struct platform_device *pdev) | |||
306 | platform_set_drvdata(pdev, hw); | 306 | platform_set_drvdata(pdev, hw); |
307 | 307 | ||
308 | /* setup the state for the bitbang driver */ | 308 | /* setup the state for the bitbang driver */ |
309 | hw->bitbang.master = spi_master_get(master); | 309 | hw->bitbang.master = master; |
310 | if (!hw->bitbang.master) | 310 | if (!hw->bitbang.master) |
311 | return err; | 311 | return err; |
312 | hw->bitbang.setup_transfer = tiny_spi_setup_transfer; | 312 | hw->bitbang.setup_transfer = tiny_spi_setup_transfer; |
diff --git a/drivers/spi/spi-ppc4xx.c b/drivers/spi/spi-ppc4xx.c index 0ee53c25ba58..c57740bb70d3 100644 --- a/drivers/spi/spi-ppc4xx.c +++ b/drivers/spi/spi-ppc4xx.c | |||
@@ -396,7 +396,7 @@ static int spi_ppc4xx_of_probe(struct platform_device *op) | |||
396 | master->dev.of_node = np; | 396 | master->dev.of_node = np; |
397 | platform_set_drvdata(op, master); | 397 | platform_set_drvdata(op, master); |
398 | hw = spi_master_get_devdata(master); | 398 | hw = spi_master_get_devdata(master); |
399 | hw->master = spi_master_get(master); | 399 | hw->master = master; |
400 | hw->dev = dev; | 400 | hw->dev = dev; |
401 | 401 | ||
402 | init_completion(&hw->done); | 402 | init_completion(&hw->done); |
@@ -558,6 +558,7 @@ static int spi_ppc4xx_of_remove(struct platform_device *op) | |||
558 | free_irq(hw->irqnum, hw); | 558 | free_irq(hw->irqnum, hw); |
559 | iounmap(hw->regs); | 559 | iounmap(hw->regs); |
560 | free_gpios(hw); | 560 | free_gpios(hw); |
561 | spi_master_put(master); | ||
561 | return 0; | 562 | return 0; |
562 | } | 563 | } |
563 | 564 | ||
diff --git a/drivers/spi/spi-s3c24xx.c b/drivers/spi/spi-s3c24xx.c index ce318d95a6ee..c9cfdfaf7523 100644 --- a/drivers/spi/spi-s3c24xx.c +++ b/drivers/spi/spi-s3c24xx.c | |||
@@ -524,7 +524,7 @@ static int s3c24xx_spi_probe(struct platform_device *pdev) | |||
524 | hw = spi_master_get_devdata(master); | 524 | hw = spi_master_get_devdata(master); |
525 | memset(hw, 0, sizeof(struct s3c24xx_spi)); | 525 | memset(hw, 0, sizeof(struct s3c24xx_spi)); |
526 | 526 | ||
527 | hw->master = spi_master_get(master); | 527 | hw->master = master; |
528 | hw->pdata = pdata = dev_get_platdata(&pdev->dev); | 528 | hw->pdata = pdata = dev_get_platdata(&pdev->dev); |
529 | hw->dev = &pdev->dev; | 529 | hw->dev = &pdev->dev; |
530 | 530 | ||
diff --git a/drivers/spi/spi-sh-sci.c b/drivers/spi/spi-sh-sci.c index 8eefeb6007df..38eb24df796c 100644 --- a/drivers/spi/spi-sh-sci.c +++ b/drivers/spi/spi-sh-sci.c | |||
@@ -133,7 +133,7 @@ static int sh_sci_spi_probe(struct platform_device *dev) | |||
133 | sp->info = dev_get_platdata(&dev->dev); | 133 | sp->info = dev_get_platdata(&dev->dev); |
134 | 134 | ||
135 | /* setup spi bitbang adaptor */ | 135 | /* setup spi bitbang adaptor */ |
136 | sp->bitbang.master = spi_master_get(master); | 136 | sp->bitbang.master = master; |
137 | sp->bitbang.master->bus_num = sp->info->bus_num; | 137 | sp->bitbang.master->bus_num = sp->info->bus_num; |
138 | sp->bitbang.master->num_chipselect = sp->info->num_chipselect; | 138 | sp->bitbang.master->num_chipselect = sp->info->num_chipselect; |
139 | sp->bitbang.chipselect = sh_sci_spi_chipselect; | 139 | sp->bitbang.chipselect = sh_sci_spi_chipselect; |
diff --git a/drivers/spi/spi-sirf.c b/drivers/spi/spi-sirf.c index a1f21b747733..592b4aff651f 100644 --- a/drivers/spi/spi-sirf.c +++ b/drivers/spi/spi-sirf.c | |||
@@ -632,7 +632,7 @@ static int spi_sirfsoc_probe(struct platform_device *pdev) | |||
632 | if (ret) | 632 | if (ret) |
633 | goto free_master; | 633 | goto free_master; |
634 | 634 | ||
635 | sspi->bitbang.master = spi_master_get(master); | 635 | sspi->bitbang.master = master; |
636 | sspi->bitbang.chipselect = spi_sirfsoc_chipselect; | 636 | sspi->bitbang.chipselect = spi_sirfsoc_chipselect; |
637 | sspi->bitbang.setup_transfer = spi_sirfsoc_setup_transfer; | 637 | sspi->bitbang.setup_transfer = spi_sirfsoc_setup_transfer; |
638 | sspi->bitbang.txrx_bufs = spi_sirfsoc_transfer; | 638 | sspi->bitbang.txrx_bufs = spi_sirfsoc_transfer; |
diff --git a/drivers/spi/spi-xilinx.c b/drivers/spi/spi-xilinx.c index 0bf1b2c457a1..ec3a83f52ea2 100644 --- a/drivers/spi/spi-xilinx.c +++ b/drivers/spi/spi-xilinx.c | |||
@@ -372,7 +372,7 @@ static int xilinx_spi_probe(struct platform_device *pdev) | |||
372 | master->mode_bits = SPI_CPOL | SPI_CPHA; | 372 | master->mode_bits = SPI_CPOL | SPI_CPHA; |
373 | 373 | ||
374 | xspi = spi_master_get_devdata(master); | 374 | xspi = spi_master_get_devdata(master); |
375 | xspi->bitbang.master = spi_master_get(master); | 375 | xspi->bitbang.master = master; |
376 | xspi->bitbang.chipselect = xilinx_spi_chipselect; | 376 | xspi->bitbang.chipselect = xilinx_spi_chipselect; |
377 | xspi->bitbang.setup_transfer = xilinx_spi_setup_transfer; | 377 | xspi->bitbang.setup_transfer = xilinx_spi_setup_transfer; |
378 | xspi->bitbang.txrx_bufs = xilinx_spi_txrx_bufs; | 378 | xspi->bitbang.txrx_bufs = xilinx_spi_txrx_bufs; |