diff mbox

spi: fsl-dspi: Fix getting correct address for master

Message ID 1392353352.19487.1.camel@phoenix (mailing list archive)
State Accepted
Commit 017145fef567430789e40f6a22a90ce2a766370b
Delegated to: Mark Brown
Headers show

Commit Message

Axel Lin Feb. 14, 2014, 4:49 a.m. UTC
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@ingics.com>
---
 drivers/spi/spi-fsl-dspi.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Axel Lin March 2, 2014, 3:09 p.m. UTC | #1
2014-02-14 12:49 GMT+08:00 Axel Lin <axel.lin@ingics.com>:
> 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.


Hi Mark,
I guess this one is for 3.14.

In dspi_probe(),
current code has:
        platform_set_drvdata(pdev, dspi);

However, in dspi_suspend() and dspi_resume(),
current code has:
        struct spi_master *master = dev_get_drvdata(dev);

Regards,
Axel
>
> Signed-off-by: Axel Lin <axel.lin@ingics.com>
> ---
>  drivers/spi/spi-fsl-dspi.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/spi/spi-fsl-dspi.c b/drivers/spi/spi-fsl-dspi.c
> index ec79f72..a253920 100644
> --- a/drivers/spi/spi-fsl-dspi.c
> +++ b/drivers/spi/spi-fsl-dspi.c
> @@ -420,7 +420,6 @@ static int dspi_suspend(struct device *dev)
>
>  static int dspi_resume(struct device *dev)
>  {
> -
>         struct spi_master *master = dev_get_drvdata(dev);
>         struct fsl_dspi *dspi = spi_master_get_devdata(master);
>
> @@ -504,7 +503,7 @@ static int dspi_probe(struct platform_device *pdev)
>         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) {
> @@ -525,7 +524,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);
> --
> 1.8.1.2
>
>
>
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Mark Brown March 3, 2014, 1:46 a.m. UTC | #2
On Sun, Mar 02, 2014 at 11:09:41PM +0800, Axel Lin wrote:
> 2014-02-14 12:49 GMT+08:00 Axel Lin <axel.lin@ingics.com>:
> > 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.

> Hi Mark,
> I guess this one is for 3.14.

> In dspi_probe(),
> current code has:
>         platform_set_drvdata(pdev, dspi);

> However, in dspi_suspend() and dspi_resume(),
> current code has:
>         struct spi_master *master = dev_get_drvdata(dev);

The patch doesn't seem to have been appleid at all?
Axel Lin March 3, 2014, 8:42 a.m. UTC | #3
2014-03-03 9:46 GMT+08:00 Mark Brown <broonie@kernel.org>:
> On Sun, Mar 02, 2014 at 11:09:41PM +0800, Axel Lin wrote:
>> 2014-02-14 12:49 GMT+08:00 Axel Lin <axel.lin@ingics.com>:
>> > 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.
>
>> Hi Mark,
>> I guess this one is for 3.14.
>
>> In dspi_probe(),
>> current code has:
>>         platform_set_drvdata(pdev, dspi);
>
>> However, in dspi_suspend() and dspi_resume(),
>> current code has:
>>         struct spi_master *master = dev_get_drvdata(dev);
>
> The patch doesn't seem to have been appleid at all?

Ah, right , this one is not yet in your tree.

And I think a similar patch for coldfire-qspi needs for 3.14 to make
runtime suspend/resume work.

commit  80467f761b01a2df5284661e9bf9876eee6a9573
spi: coldfire-qspi: Fix getting correct address for *mcfqspi

dev_get_drvdata() returns the address of master rather than mcfqspi.

Regards,
Axel
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Mark Brown March 5, 2014, 3:49 a.m. UTC | #4
On Fri, Feb 14, 2014 at 12:49:12PM +0800, Axel Lin wrote:
> 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.

Applied, thanks.
Mark Brown March 5, 2014, 3:54 a.m. UTC | #5
On Mon, Mar 03, 2014 at 04:42:19PM +0800, Axel Lin wrote:

> And I think a similar patch for coldfire-qspi needs for 3.14 to make
> runtime suspend/resume work.

> commit  80467f761b01a2df5284661e9bf9876eee6a9573
> spi: coldfire-qspi: Fix getting correct address for *mcfqspi

> dev_get_drvdata() returns the address of master rather than mcfqspi.

Yes, looks like it.
diff mbox

Patch

diff --git a/drivers/spi/spi-fsl-dspi.c b/drivers/spi/spi-fsl-dspi.c
index ec79f72..a253920 100644
--- a/drivers/spi/spi-fsl-dspi.c
+++ b/drivers/spi/spi-fsl-dspi.c
@@ -420,7 +420,6 @@  static int dspi_suspend(struct device *dev)
 
 static int dspi_resume(struct device *dev)
 {
-
 	struct spi_master *master = dev_get_drvdata(dev);
 	struct fsl_dspi *dspi = spi_master_get_devdata(master);
 
@@ -504,7 +503,7 @@  static int dspi_probe(struct platform_device *pdev)
 	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) {
@@ -525,7 +524,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);