[PATCH 3.13 082/149] spi: fsl-dspi: Fix getting correct address for master

From: Greg Kroah-Hartman
Date: Thu Mar 20 2014 - 21:09:24 EST


3.13-stable review patch. If anyone has any objections, please let me know.

------------------

From: Axel Lin <axel.lin@xxxxxxxxxx>

commit 017145fef567430789e40f6a22a90ce2a766370b upstream.

Current code set platform drvdata to dspi. However, the code in dspi_suspend()
and dspi_resume() assumes the drvdata is the address of master.
Fix it by setting platform drvdata to master.

Signed-off-by: Axel Lin <axel.lin@xxxxxxxxxx>
Signed-off-by: Mark Brown <broonie@xxxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>

---
drivers/spi/spi-fsl-dspi.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

--- a/drivers/spi/spi-fsl-dspi.c
+++ b/drivers/spi/spi-fsl-dspi.c
@@ -421,7 +421,6 @@ static int dspi_suspend(struct device *d

static int dspi_resume(struct device *dev)
{
-
struct spi_master *master = dev_get_drvdata(dev);
struct fsl_dspi *dspi = spi_master_get_devdata(master);

@@ -505,7 +504,7 @@ static int dspi_probe(struct platform_de
clk_prepare_enable(dspi->clk);

init_waitqueue_head(&dspi->waitq);
- platform_set_drvdata(pdev, dspi);
+ platform_set_drvdata(pdev, master);

ret = spi_bitbang_start(&dspi->bitbang);
if (ret != 0) {
@@ -526,7 +525,8 @@ out_master_put:

static int dspi_remove(struct platform_device *pdev)
{
- struct fsl_dspi *dspi = platform_get_drvdata(pdev);
+ struct spi_master *master = platform_get_drvdata(pdev);
+ struct fsl_dspi *dspi = spi_master_get_devdata(master);

/* Disconnect from the SPI framework */
spi_bitbang_stop(&dspi->bitbang);


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/