diff options
author | Sourav Poddar <sourav.poddar@ti.com> | 2013-11-19 08:07:16 -0500 |
---|---|---|
committer | Mark Brown <broonie@linaro.org> | 2013-11-24 09:15:11 -0500 |
commit | cbcabb7a300bf5ab868c632048889a933e7cdae5 (patch) | |
tree | a608e2a5c839263798beaa0d6bf6dad68c23806e /drivers/spi | |
parent | 05b96675dbfc97fbb66d58cacbf2c8def020375e (diff) |
spi/qspi: Fix qspi remove path.
There is a bug in qspi removal path, as a result of which
qspi cannot be removed when used as a module. The patch
solves the bug and qspi can be removed cleanly.
The bugs fixed are:
-pm_runtime used around register access.
- pm_runtime_disable need to be done before removal.
- spi_unregister_master need to be called to unregister
the spi device.
Tested on DRA7 board.
Signed-off-by: Sourav Poddar <sourav.poddar@ti.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'drivers/spi')
-rw-r--r-- | drivers/spi/spi-ti-qspi.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/drivers/spi/spi-ti-qspi.c b/drivers/spi/spi-ti-qspi.c index f3c3c3f7aaed..4396bd448540 100644 --- a/drivers/spi/spi-ti-qspi.c +++ b/drivers/spi/spi-ti-qspi.c | |||
@@ -516,10 +516,26 @@ free_master: | |||
516 | 516 | ||
517 | static int ti_qspi_remove(struct platform_device *pdev) | 517 | static int ti_qspi_remove(struct platform_device *pdev) |
518 | { | 518 | { |
519 | struct ti_qspi *qspi = platform_get_drvdata(pdev); | 519 | struct spi_master *master; |
520 | struct ti_qspi *qspi; | ||
521 | int ret; | ||
522 | |||
523 | master = platform_get_drvdata(pdev); | ||
524 | qspi = spi_master_get_devdata(master); | ||
525 | |||
526 | ret = pm_runtime_get_sync(qspi->dev); | ||
527 | if (ret < 0) { | ||
528 | dev_err(qspi->dev, "pm_runtime_get_sync() failed\n"); | ||
529 | return ret; | ||
530 | } | ||
520 | 531 | ||
521 | ti_qspi_write(qspi, QSPI_WC_INT_DISABLE, QSPI_INTR_ENABLE_CLEAR_REG); | 532 | ti_qspi_write(qspi, QSPI_WC_INT_DISABLE, QSPI_INTR_ENABLE_CLEAR_REG); |
522 | 533 | ||
534 | pm_runtime_put(qspi->dev); | ||
535 | pm_runtime_disable(&pdev->dev); | ||
536 | |||
537 | spi_unregister_master(master); | ||
538 | |||
523 | return 0; | 539 | return 0; |
524 | } | 540 | } |
525 | 541 | ||