Skip to content

Commit

Permalink
spi/qspi: Fix qspi remove path.
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Sourav Poddar authored and Mark Brown committed Nov 24, 2013
1 parent 05b9667 commit cbcabb7
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion drivers/spi/spi-ti-qspi.c
Original file line number Diff line number Diff line change
Expand Up @@ -516,10 +516,26 @@ static int ti_qspi_probe(struct platform_device *pdev)

static int ti_qspi_remove(struct platform_device *pdev)
{
struct ti_qspi *qspi = platform_get_drvdata(pdev);
struct spi_master *master;
struct ti_qspi *qspi;
int ret;

master = platform_get_drvdata(pdev);
qspi = spi_master_get_devdata(master);

ret = pm_runtime_get_sync(qspi->dev);
if (ret < 0) {
dev_err(qspi->dev, "pm_runtime_get_sync() failed\n");
return ret;
}

ti_qspi_write(qspi, QSPI_WC_INT_DISABLE, QSPI_INTR_ENABLE_CLEAR_REG);

pm_runtime_put(qspi->dev);
pm_runtime_disable(&pdev->dev);

spi_unregister_master(master);

return 0;
}

Expand Down

0 comments on commit cbcabb7

Please sign in to comment.