public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] spi: s3c64xx: Fix pm_runtime_get_sync() return value check
@ 2013-05-27 14:56 Sylwester Nawrocki
  2013-06-10 16:10 ` Sylwester Nawrocki
  0 siblings, 1 reply; 2+ messages in thread
From: Sylwester Nawrocki @ 2013-05-27 14:56 UTC (permalink / raw)
  To: broonie
  Cc: grant.likely, linux-kernel, linux-samsung-soc, Sylwester Nawrocki,
	Kyungmin Park

If the device is already in a runtime PM enabled state
pm_runtime_get_sync() will return 1, so a test for negative
value should be used to check for errors.

Without this patch there are seen errors like:

[    8.540000] s3c64xx-spi 13930000.spi: Failed to enable device: 1
[    8.545000] spi_master spi1: failed to prepare transfer hardware

Likely because the driver uses synchronous API to runtime enable
the device and asychronous one to disable it.

Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
---
 drivers/spi/spi-s3c64xx.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c
index 5000586..71cc3e6 100644
--- a/drivers/spi/spi-s3c64xx.c
+++ b/drivers/spi/spi-s3c64xx.c
@@ -444,7 +444,7 @@ static int s3c64xx_spi_prepare_transfer(struct spi_master *spi)
 	}
 
 	ret = pm_runtime_get_sync(&sdd->pdev->dev);
-	if (ret != 0) {
+	if (ret < 0) {
 		dev_err(dev, "Failed to enable device: %d\n", ret);
 		goto out_tx;
 	}
-- 
1.7.9.5


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

* Re: [PATCH] spi: s3c64xx: Fix pm_runtime_get_sync() return value check
  2013-05-27 14:56 [PATCH] spi: s3c64xx: Fix pm_runtime_get_sync() return value check Sylwester Nawrocki
@ 2013-06-10 16:10 ` Sylwester Nawrocki
  0 siblings, 0 replies; 2+ messages in thread
From: Sylwester Nawrocki @ 2013-06-10 16:10 UTC (permalink / raw)
  To: broonie; +Cc: grant.likely, linux-kernel, linux-samsung-soc, Kyungmin Park

On 05/27/2013 04:56 PM, Sylwester Nawrocki wrote:
> If the device is already in a runtime PM enabled state
> pm_runtime_get_sync() will return 1, so a test for negative
> value should be used to check for errors.
> 
> Without this patch there are seen errors like:
> 
> [    8.540000] s3c64xx-spi 13930000.spi: Failed to enable device: 1
> [    8.545000] spi_master spi1: failed to prepare transfer hardware
> 
> Likely because the driver uses synchronous API to runtime enable
> the device and asychronous one to disable it.

Is there anything wrong with this patch ? I still can't see it in
Linus' tree.

> Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
> ---
>  drivers/spi/spi-s3c64xx.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c
> index 5000586..71cc3e6 100644
> --- a/drivers/spi/spi-s3c64xx.c
> +++ b/drivers/spi/spi-s3c64xx.c
> @@ -444,7 +444,7 @@ static int s3c64xx_spi_prepare_transfer(struct spi_master *spi)
>  	}
>  
>  	ret = pm_runtime_get_sync(&sdd->pdev->dev);
> -	if (ret != 0) {
> +	if (ret < 0) {
>  		dev_err(dev, "Failed to enable device: %d\n", ret);
>  		goto out_tx;
>  	}
> 

Thanks,
Sylwester

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

end of thread, other threads:[~2013-06-10 16:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-27 14:56 [PATCH] spi: s3c64xx: Fix pm_runtime_get_sync() return value check Sylwester Nawrocki
2013-06-10 16:10 ` Sylwester Nawrocki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox