linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] spi: ti-qspi: Fix getting correct address for qspi
@ 2014-01-07 11:04 Axel Lin
  2014-01-07 11:05 ` Sourav Poddar
  2014-01-07 11:38 ` Mark Brown
  0 siblings, 2 replies; 5+ messages in thread
From: Axel Lin @ 2014-01-07 11:04 UTC (permalink / raw)
  To: Mark Brown; +Cc: Sourav Poddar, linux-spi-u79uwXL29TY76Z2rM5mHXA

Now platform_get_drvdata() returns the address of qspi rather than master.
Also drop unneeded spi_unregister_master() call in ti_qspi_remove() because
we use devm_spi_register_master() in probe.

commit cbcabb7a300b "spi/qspi: Fix qspi remove path" assumes 
platform_get_drvdata() returns address of master. However,
commit 160a061301c7 "spi/qspi: set correct platform drvdata in ti_qspi_probe()"
pass qspi to platform_set_drvdata().

Signed-off-by: Axel Lin <axel.lin-8E1dMatC8ynQT0dZR+AlfA@public.gmane.org>
---
v2: Update commit log, and drop fixes tag ( the fixes commit id is wrong).

 drivers/spi/spi-ti-qspi.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/drivers/spi/spi-ti-qspi.c b/drivers/spi/spi-ti-qspi.c
index 9190e03..4b413e9 100644
--- a/drivers/spi/spi-ti-qspi.c
+++ b/drivers/spi/spi-ti-qspi.c
@@ -563,13 +563,9 @@ free_master:
 
 static int ti_qspi_remove(struct platform_device *pdev)
 {
-	struct spi_master *master;
-	struct ti_qspi *qspi;
+	struct ti_qspi *qspi = platform_get_drvdata(pdev);
 	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");
@@ -581,8 +577,6 @@ static int ti_qspi_remove(struct platform_device *pdev)
 	pm_runtime_put(qspi->dev);
 	pm_runtime_disable(&pdev->dev);
 
-	spi_unregister_master(master);
-
 	return 0;
 }
 
-- 
1.8.1.2



--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] spi: ti-qspi: Fix getting correct address for qspi
  2014-01-07 11:04 [PATCH v2] spi: ti-qspi: Fix getting correct address for qspi Axel Lin
@ 2014-01-07 11:05 ` Sourav Poddar
       [not found]   ` <52CBDF90.3060107-l0cyMroinI0@public.gmane.org>
  2014-01-07 11:38 ` Mark Brown
  1 sibling, 1 reply; 5+ messages in thread
From: Sourav Poddar @ 2014-01-07 11:05 UTC (permalink / raw)
  To: Axel Lin; +Cc: Mark Brown, linux-spi-u79uwXL29TY76Z2rM5mHXA

On Tuesday 07 January 2014 04:34 PM, Axel Lin wrote:
> Now platform_get_drvdata() returns the address of qspi rather than master.
> Also drop unneeded spi_unregister_master() call in ti_qspi_remove() because
> we use devm_spi_register_master() in probe.
>
> commit cbcabb7a300b "spi/qspi: Fix qspi remove path" assumes
> platform_get_drvdata() returns address of master. However,
> commit 160a061301c7 "spi/qspi: set correct platform drvdata in ti_qspi_probe()"
> pass qspi to platform_set_drvdata().
>
> Signed-off-by: Axel Lin<axel.lin-8E1dMatC8ynQT0dZR+AlfA@public.gmane.org>
> ---
> v2: Update commit log, and drop fixes tag ( the fixes commit id is wrong).
>
>   drivers/spi/spi-ti-qspi.c | 8 +-------
>   1 file changed, 1 insertion(+), 7 deletions(-)
>
> diff --git a/drivers/spi/spi-ti-qspi.c b/drivers/spi/spi-ti-qspi.c
> index 9190e03..4b413e9 100644
> --- a/drivers/spi/spi-ti-qspi.c
> +++ b/drivers/spi/spi-ti-qspi.c
> @@ -563,13 +563,9 @@ free_master:
>
>   static int ti_qspi_remove(struct platform_device *pdev)
>   {
> -	struct spi_master *master;
> -	struct ti_qspi *qspi;
> +	struct ti_qspi *qspi = platform_get_drvdata(pdev);
>   	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");
> @@ -581,8 +577,6 @@ static int ti_qspi_remove(struct platform_device *pdev)
>   	pm_runtime_put(qspi->dev);
>   	pm_runtime_disable(&pdev->dev);
>
> -	spi_unregister_master(master);
> -
why this is removed?
>   	return 0;
>   }
>

--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] spi: ti-qspi: Fix getting correct address for qspi
       [not found]   ` <52CBDF90.3060107-l0cyMroinI0@public.gmane.org>
@ 2014-01-07 11:18     ` Axel Lin
       [not found]       ` <CAFRkauC=5Ls=AUi4HWJPfu3uL2XVP5b6w8U+z8fnqVSTkXPE_A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Axel Lin @ 2014-01-07 11:18 UTC (permalink / raw)
  To: Sourav Poddar; +Cc: Mark Brown, linux-spi-u79uwXL29TY76Z2rM5mHXA

2014/1/7 Sourav Poddar <sourav.poddar-l0cyMroinI0@public.gmane.org>:
> On Tuesday 07 January 2014 04:34 PM, Axel Lin wrote:
>>
>> Now platform_get_drvdata() returns the address of qspi rather than master.
>> Also drop unneeded spi_unregister_master() call in ti_qspi_remove()
>> because
>> we use devm_spi_register_master() in probe.
>>
>> commit cbcabb7a300b "spi/qspi: Fix qspi remove path" assumes
>> platform_get_drvdata() returns address of master. However,
>> commit 160a061301c7 "spi/qspi: set correct platform drvdata in
>> ti_qspi_probe()"
>> pass qspi to platform_set_drvdata().
>>
>> Signed-off-by: Axel Lin<axel.lin-8E1dMatC8ynQT0dZR+AlfA@public.gmane.org>
>> ---
>> v2: Update commit log, and drop fixes tag ( the fixes commit id is wrong).
>>
>>   drivers/spi/spi-ti-qspi.c | 8 +-------
>>   1 file changed, 1 insertion(+), 7 deletions(-)
>>
>> diff --git a/drivers/spi/spi-ti-qspi.c b/drivers/spi/spi-ti-qspi.c
>> index 9190e03..4b413e9 100644
>> --- a/drivers/spi/spi-ti-qspi.c
>> +++ b/drivers/spi/spi-ti-qspi.c
>> @@ -563,13 +563,9 @@ free_master:
>>
>>   static int ti_qspi_remove(struct platform_device *pdev)
>>   {
>> -       struct spi_master *master;
>> -       struct ti_qspi *qspi;
>> +       struct ti_qspi *qspi = platform_get_drvdata(pdev);
>>         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");
>> @@ -581,8 +577,6 @@ static int ti_qspi_remove(struct platform_device
>> *pdev)
>>         pm_runtime_put(qspi->dev);
>>         pm_runtime_disable(&pdev->dev);
>>
>> -       spi_unregister_master(master);
>> -
>
> why this is removed?

If you use spi_register_master(), then you need to call spi_unregister_master()
in  ti_qspi_remove().
However, current code uses devm_spi_register_master(). So you don't need to
expilictly call spi_unregister_master(). It's done by devm_* APIs.

Regards,
Axel
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] spi: ti-qspi: Fix getting correct address for qspi
       [not found]       ` <CAFRkauC=5Ls=AUi4HWJPfu3uL2XVP5b6w8U+z8fnqVSTkXPE_A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2014-01-07 11:22         ` Sourav Poddar
  0 siblings, 0 replies; 5+ messages in thread
From: Sourav Poddar @ 2014-01-07 11:22 UTC (permalink / raw)
  To: Axel Lin; +Cc: Mark Brown, linux-spi-u79uwXL29TY76Z2rM5mHXA

On Tuesday 07 January 2014 04:48 PM, Axel Lin wrote:
> 2014/1/7 Sourav Poddar<sourav.poddar-l0cyMroinI0@public.gmane.org>:
>> On Tuesday 07 January 2014 04:34 PM, Axel Lin wrote:
>>> Now platform_get_drvdata() returns the address of qspi rather than master.
>>> Also drop unneeded spi_unregister_master() call in ti_qspi_remove()
>>> because
>>> we use devm_spi_register_master() in probe.
>>>
>>> commit cbcabb7a300b "spi/qspi: Fix qspi remove path" assumes
>>> platform_get_drvdata() returns address of master. However,
>>> commit 160a061301c7 "spi/qspi: set correct platform drvdata in
>>> ti_qspi_probe()"
>>> pass qspi to platform_set_drvdata().
>>>
>>> Signed-off-by: Axel Lin<axel.lin-8E1dMatC8ynQT0dZR+AlfA@public.gmane.org>
>>> ---
>>> v2: Update commit log, and drop fixes tag ( the fixes commit id is wrong).
>>>
>>>    drivers/spi/spi-ti-qspi.c | 8 +-------
>>>    1 file changed, 1 insertion(+), 7 deletions(-)
>>>
>>> diff --git a/drivers/spi/spi-ti-qspi.c b/drivers/spi/spi-ti-qspi.c
>>> index 9190e03..4b413e9 100644
>>> --- a/drivers/spi/spi-ti-qspi.c
>>> +++ b/drivers/spi/spi-ti-qspi.c
>>> @@ -563,13 +563,9 @@ free_master:
>>>
>>>    static int ti_qspi_remove(struct platform_device *pdev)
>>>    {
>>> -       struct spi_master *master;
>>> -       struct ti_qspi *qspi;
>>> +       struct ti_qspi *qspi = platform_get_drvdata(pdev);
>>>          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");
>>> @@ -581,8 +577,6 @@ static int ti_qspi_remove(struct platform_device
>>> *pdev)
>>>          pm_runtime_put(qspi->dev);
>>>          pm_runtime_disable(&pdev->dev);
>>>
>>> -       spi_unregister_master(master);
>>> -
>> why this is removed?
> If you use spi_register_master(), then you need to call spi_unregister_master()
> in  ti_qspi_remove().
> However, current code uses devm_spi_register_master(). So you don't need to
> expilictly call spi_unregister_master(). It's done by devm_* APIs.
>
> Regards,
> Axel

hmm..missed that point.
Reviewed-by: Sourav Poddar <sourav.poddar-l0cyMroinI0@public.gmane.org>
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] spi: ti-qspi: Fix getting correct address for qspi
  2014-01-07 11:04 [PATCH v2] spi: ti-qspi: Fix getting correct address for qspi Axel Lin
  2014-01-07 11:05 ` Sourav Poddar
@ 2014-01-07 11:38 ` Mark Brown
  1 sibling, 0 replies; 5+ messages in thread
From: Mark Brown @ 2014-01-07 11:38 UTC (permalink / raw)
  To: Axel Lin; +Cc: Sourav Poddar, linux-spi-u79uwXL29TY76Z2rM5mHXA

[-- Attachment #1: Type: text/plain, Size: 277 bytes --]

On Tue, Jan 07, 2014 at 07:04:03PM +0800, Axel Lin wrote:
> Now platform_get_drvdata() returns the address of qspi rather than master.
> Also drop unneeded spi_unregister_master() call in ti_qspi_remove() because
> we use devm_spi_register_master() in probe.

Applied, thanks.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-01-07 11:38 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-07 11:04 [PATCH v2] spi: ti-qspi: Fix getting correct address for qspi Axel Lin
2014-01-07 11:05 ` Sourav Poddar
     [not found]   ` <52CBDF90.3060107-l0cyMroinI0@public.gmane.org>
2014-01-07 11:18     ` Axel Lin
     [not found]       ` <CAFRkauC=5Ls=AUi4HWJPfu3uL2XVP5b6w8U+z8fnqVSTkXPE_A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-01-07 11:22         ` Sourav Poddar
2014-01-07 11:38 ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).