diff options
author | Florian Fainelli <florian@openwrt.org> | 2012-04-20 09:37:34 -0400 |
---|---|---|
committer | Grant Likely <grant.likely@secretlab.ca> | 2012-04-27 13:16:46 -0400 |
commit | 1e41dc0ee2f3807328db95e4f87ff1333245190f (patch) | |
tree | 1f6539f37b28cf99d63805d0a9f81f730a4146c5 /drivers/spi/spi-bcm63xx.c | |
parent | cde4384e1037c15e5dd04c68d19c75798b6281dd (diff) |
spi/bcm63xx: don't use the stopping state
We do not need to use a flag to indicate if the master driver is stopping
it is sufficient to perform spi master unregistering in the platform
driver's remove function.
Signed-off-by: Florian Fainelli <florian@openwrt.org>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Diffstat (limited to 'drivers/spi/spi-bcm63xx.c')
-rw-r--r-- | drivers/spi/spi-bcm63xx.c | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/drivers/spi/spi-bcm63xx.c b/drivers/spi/spi-bcm63xx.c index 63b0028a8bd3..80e5ed34e0d9 100644 --- a/drivers/spi/spi-bcm63xx.c +++ b/drivers/spi/spi-bcm63xx.c | |||
@@ -39,8 +39,6 @@ | |||
39 | #define DRV_VER "0.1.2" | 39 | #define DRV_VER "0.1.2" |
40 | 40 | ||
41 | struct bcm63xx_spi { | 41 | struct bcm63xx_spi { |
42 | spinlock_t lock; | ||
43 | int stopping; | ||
44 | struct completion done; | 42 | struct completion done; |
45 | 43 | ||
46 | void __iomem *regs; | 44 | void __iomem *regs; |
@@ -161,9 +159,6 @@ static int bcm63xx_spi_setup(struct spi_device *spi) | |||
161 | 159 | ||
162 | bs = spi_master_get_devdata(spi->master); | 160 | bs = spi_master_get_devdata(spi->master); |
163 | 161 | ||
164 | if (bs->stopping) | ||
165 | return -ESHUTDOWN; | ||
166 | |||
167 | if (!spi->bits_per_word) | 162 | if (!spi->bits_per_word) |
168 | spi->bits_per_word = 8; | 163 | spi->bits_per_word = 8; |
169 | 164 | ||
@@ -410,10 +405,8 @@ static int __devinit bcm63xx_spi_probe(struct platform_device *pdev) | |||
410 | master->unprepare_transfer_hardware = bcm63xx_spi_unprepare_transfer; | 405 | master->unprepare_transfer_hardware = bcm63xx_spi_unprepare_transfer; |
411 | master->transfer_one_message = bcm63xx_spi_transfer_one; | 406 | master->transfer_one_message = bcm63xx_spi_transfer_one; |
412 | bs->speed_hz = pdata->speed_hz; | 407 | bs->speed_hz = pdata->speed_hz; |
413 | bs->stopping = 0; | ||
414 | bs->tx_io = (u8 *)(bs->regs + bcm63xx_spireg(SPI_MSG_DATA)); | 408 | bs->tx_io = (u8 *)(bs->regs + bcm63xx_spireg(SPI_MSG_DATA)); |
415 | bs->rx_io = (const u8 *)(bs->regs + bcm63xx_spireg(SPI_RX_DATA)); | 409 | bs->rx_io = (const u8 *)(bs->regs + bcm63xx_spireg(SPI_RX_DATA)); |
416 | spin_lock_init(&bs->lock); | ||
417 | 410 | ||
418 | /* Initialize hardware */ | 411 | /* Initialize hardware */ |
419 | clk_enable(bs->clk); | 412 | clk_enable(bs->clk); |
@@ -447,18 +440,16 @@ static int __devexit bcm63xx_spi_remove(struct platform_device *pdev) | |||
447 | struct spi_master *master = platform_get_drvdata(pdev); | 440 | struct spi_master *master = platform_get_drvdata(pdev); |
448 | struct bcm63xx_spi *bs = spi_master_get_devdata(master); | 441 | struct bcm63xx_spi *bs = spi_master_get_devdata(master); |
449 | 442 | ||
443 | spi_unregister_master(master); | ||
444 | |||
450 | /* reset spi block */ | 445 | /* reset spi block */ |
451 | bcm_spi_writeb(bs, 0, SPI_INT_MASK); | 446 | bcm_spi_writeb(bs, 0, SPI_INT_MASK); |
452 | spin_lock(&bs->lock); | ||
453 | bs->stopping = 1; | ||
454 | 447 | ||
455 | /* HW shutdown */ | 448 | /* HW shutdown */ |
456 | clk_disable(bs->clk); | 449 | clk_disable(bs->clk); |
457 | clk_put(bs->clk); | 450 | clk_put(bs->clk); |
458 | 451 | ||
459 | spin_unlock(&bs->lock); | ||
460 | platform_set_drvdata(pdev, 0); | 452 | platform_set_drvdata(pdev, 0); |
461 | spi_unregister_master(master); | ||
462 | 453 | ||
463 | return 0; | 454 | return 0; |
464 | } | 455 | } |