public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] spi/s3c64xx: Do not ignore return value of spi_master_resume/suspend
@ 2013-10-21 13:42 Krzysztof Kozlowski
  2013-10-21 13:42 ` [PATCH 2/2] spi/s3c64xx: Fix doubled clock disable on suspend Krzysztof Kozlowski
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Krzysztof Kozlowski @ 2013-10-21 13:42 UTC (permalink / raw)
  To: Ben Dooks, Kukjin Kim, Mark Brown
  Cc: linux-arm-kernel, linux-samsung-soc, linux-spi, linux-kernel,
	Sylwester Nawrocki, Krzysztof Kozlowski, Kyungmin Park

During PM resume and suspend do not ignore the return value of
spi_master_suspend() or spi_master_resume(). Instead pass it further.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
---
 drivers/spi/spi-s3c64xx.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c
index 512b889..59f4fd9 100644
--- a/drivers/spi/spi-s3c64xx.c
+++ b/drivers/spi/spi-s3c64xx.c
@@ -1480,7 +1480,9 @@ static int s3c64xx_spi_suspend(struct device *dev)
 	struct spi_master *master = dev_get_drvdata(dev);
 	struct s3c64xx_spi_driver_data *sdd = spi_master_get_devdata(master);
 
-	spi_master_suspend(master);
+	int ret = spi_master_suspend(master);
+	if (ret)
+		return ret;
 
 	/* Disable the clock */
 	clk_disable_unprepare(sdd->src_clk);
@@ -1506,9 +1508,7 @@ static int s3c64xx_spi_resume(struct device *dev)
 
 	s3c64xx_spi_hwinit(sdd, sdd->port_id);
 
-	spi_master_resume(master);
-
-	return 0;
+	return spi_master_resume(master);
 }
 #endif /* CONFIG_PM_SLEEP */
 
-- 
1.7.9.5


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

* [PATCH 2/2] spi/s3c64xx: Fix doubled clock disable on suspend
  2013-10-21 13:42 [PATCH 1/2] spi/s3c64xx: Do not ignore return value of spi_master_resume/suspend Krzysztof Kozlowski
@ 2013-10-21 13:42 ` Krzysztof Kozlowski
  2013-10-21 13:47   ` Sylwester Nawrocki
  2013-10-21 13:50 ` [PATCH 1/2] spi/s3c64xx: Do not ignore return value of spi_master_resume/suspend Sylwester Nawrocki
  2013-10-22  8:34 ` Mark Brown
  2 siblings, 1 reply; 5+ messages in thread
From: Krzysztof Kozlowski @ 2013-10-21 13:42 UTC (permalink / raw)
  To: Ben Dooks, Kukjin Kim, Mark Brown
  Cc: linux-arm-kernel, linux-samsung-soc, linux-spi, linux-kernel,
	Sylwester Nawrocki, Krzysztof Kozlowski, Kyungmin Park

Fix doubled clock disable and unprepare during PM suspend which triggered
the warnings:

WARNING: at drivers/clk/clk.c:800 clk_disable+0x18/0x24()
Modules linked in:
CPU: 0 PID: 1745 Comm: sh Not tainted 3.10.14-01211-ge2549bb-dirty #62
[<c0015980>] (unwind_backtrace+0x0/0x138) from [<c0012a44>] (show_stack+0x10/0x14)
[<c0012a44>] (show_stack+0x10/0x14) from [<c0022818>] (warn_slowpath_common+0x4c/0x68)
[<c0022818>] (warn_slowpath_common+0x4c/0x68) from [<c0022850>] (warn_slowpath_null+0x1c/0x24)
[<c0022850>] (warn_slowpath_null+0x1c/0x24) from [<c036e274>] (clk_disable+0x18/0x24)
[<c036e274>] (clk_disable+0x18/0x24) from [<c02d5f78>] (s3c64xx_spi_suspend+0x28/0x54)
[<c02d5f78>] (s3c64xx_spi_suspend+0x28/0x54) from [<c02b3a54>] (platform_pm_suspend+0x2c/0x5c)
[<c02b3a54>] (platform_pm_suspend+0x2c/0x5c) from [<c02b8a30>] (dpm_run_callback+0x44/0x7c)
[<c02b8a30>] (dpm_run_callback+0x44/0x7c) from [<c02b8b70>] (__device_suspend+0x108/0x300)
[<c02b8b70>] (__device_suspend+0x108/0x300) from [<c02ba4e0>] (dpm_suspend+0x54/0x208)
[<c02ba4e0>] (dpm_suspend+0x54/0x208) from [<c0066bcc>] (suspend_devices_and_enter+0x98/0x458)
[<c0066bcc>] (suspend_devices_and_enter+0x98/0x458) from [<c0067150>] (pm_suspend+0x1c4/0x25c)
[<c0067150>] (pm_suspend+0x1c4/0x25c) from [<c0066044>] (state_store+0x6c/0xbc)
[<c0066044>] (state_store+0x6c/0xbc) from [<c0203290>] (kobj_attr_store+0x14/0x20)
[<c0203290>] (kobj_attr_store+0x14/0x20) from [<c0157530>] (sysfs_write_file+0xfc/0x164)
[<c0157530>] (sysfs_write_file+0xfc/0x164) from [<c00fd6b0>] (vfs_write+0xbc/0x1bc)
[<c00fd6b0>] (vfs_write+0xbc/0x1bc) from [<c00fdaf0>] (SyS_write+0x40/0x68)
[<c00fdaf0>] (SyS_write+0x40/0x68) from [<c000ea80>] (ret_fast_syscall+0x0/0x3c)

The clocks may be already disabled before suspending. Check PM runtime
suspend status and disable clocks only if device is not suspended.
During resume do not enable the clocks if device is runtime suspended.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
---
 drivers/spi/spi-s3c64xx.c |   14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c
index 59f4fd9..8953178 100644
--- a/drivers/spi/spi-s3c64xx.c
+++ b/drivers/spi/spi-s3c64xx.c
@@ -1484,9 +1484,10 @@ static int s3c64xx_spi_suspend(struct device *dev)
 	if (ret)
 		return ret;
 
-	/* Disable the clock */
-	clk_disable_unprepare(sdd->src_clk);
-	clk_disable_unprepare(sdd->clk);
+	if (!pm_runtime_suspended(dev)) {
+		clk_disable_unprepare(sdd->clk);
+		clk_disable_unprepare(sdd->src_clk);
+	}
 
 	sdd->cur_speed = 0; /* Output Clock is stopped */
 
@@ -1502,9 +1503,10 @@ static int s3c64xx_spi_resume(struct device *dev)
 	if (sci->cfg_gpio)
 		sci->cfg_gpio();
 
-	/* Enable the clock */
-	clk_prepare_enable(sdd->src_clk);
-	clk_prepare_enable(sdd->clk);
+	if (!pm_runtime_suspended(dev)) {
+		clk_prepare_enable(sdd->src_clk);
+		clk_prepare_enable(sdd->clk);
+	}
 
 	s3c64xx_spi_hwinit(sdd, sdd->port_id);
 
-- 
1.7.9.5


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

* Re: [PATCH 2/2] spi/s3c64xx: Fix doubled clock disable on suspend
  2013-10-21 13:42 ` [PATCH 2/2] spi/s3c64xx: Fix doubled clock disable on suspend Krzysztof Kozlowski
@ 2013-10-21 13:47   ` Sylwester Nawrocki
  0 siblings, 0 replies; 5+ messages in thread
From: Sylwester Nawrocki @ 2013-10-21 13:47 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Kukjin Kim, Mark Brown
  Cc: linux-arm-kernel, linux-samsung-soc, linux-spi, linux-kernel,
	Kyungmin Park

On 21/10/13 15:42, Krzysztof Kozlowski wrote:
> Fix doubled clock disable and unprepare during PM suspend which triggered
> the warnings:

> The clocks may be already disabled before suspending. Check PM runtime
> suspend status and disable clocks only if device is not suspended.
> During resume do not enable the clocks if device is runtime suspended.
> 
> Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>

Reviewed-by: Sylwester Nawrocki <s.nawrocki@samsung.com>

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

* Re: [PATCH 1/2] spi/s3c64xx: Do not ignore return value of spi_master_resume/suspend
  2013-10-21 13:42 [PATCH 1/2] spi/s3c64xx: Do not ignore return value of spi_master_resume/suspend Krzysztof Kozlowski
  2013-10-21 13:42 ` [PATCH 2/2] spi/s3c64xx: Fix doubled clock disable on suspend Krzysztof Kozlowski
@ 2013-10-21 13:50 ` Sylwester Nawrocki
  2013-10-22  8:34 ` Mark Brown
  2 siblings, 0 replies; 5+ messages in thread
From: Sylwester Nawrocki @ 2013-10-21 13:50 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Kukjin Kim, Mark Brown
  Cc: linux-arm-kernel, linux-samsung-soc, linux-spi, linux-kernel,
	Kyungmin Park

On 21/10/13 15:42, Krzysztof Kozlowski wrote:
> During PM resume and suspend do not ignore the return value of
> spi_master_suspend() or spi_master_resume(). Instead pass it further.
> 
> Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>

Reviewed-by: Sylwester Nawrocki <s.nawrocki@samsung.com>

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

* Re: [PATCH 1/2] spi/s3c64xx: Do not ignore return value of spi_master_resume/suspend
  2013-10-21 13:42 [PATCH 1/2] spi/s3c64xx: Do not ignore return value of spi_master_resume/suspend Krzysztof Kozlowski
  2013-10-21 13:42 ` [PATCH 2/2] spi/s3c64xx: Fix doubled clock disable on suspend Krzysztof Kozlowski
  2013-10-21 13:50 ` [PATCH 1/2] spi/s3c64xx: Do not ignore return value of spi_master_resume/suspend Sylwester Nawrocki
@ 2013-10-22  8:34 ` Mark Brown
  2 siblings, 0 replies; 5+ messages in thread
From: Mark Brown @ 2013-10-22  8:34 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Ben Dooks, Kukjin Kim, linux-arm-kernel, linux-samsung-soc,
	linux-spi, linux-kernel, Sylwester Nawrocki, Kyungmin Park

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

On Mon, Oct 21, 2013 at 03:42:49PM +0200, Krzysztof Kozlowski wrote:
> During PM resume and suspend do not ignore the return value of
> spi_master_suspend() or spi_master_resume(). Instead pass it further.

Applied both, 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:[~2013-10-22  8:34 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-21 13:42 [PATCH 1/2] spi/s3c64xx: Do not ignore return value of spi_master_resume/suspend Krzysztof Kozlowski
2013-10-21 13:42 ` [PATCH 2/2] spi/s3c64xx: Fix doubled clock disable on suspend Krzysztof Kozlowski
2013-10-21 13:47   ` Sylwester Nawrocki
2013-10-21 13:50 ` [PATCH 1/2] spi/s3c64xx: Do not ignore return value of spi_master_resume/suspend Sylwester Nawrocki
2013-10-22  8:34 ` Mark Brown

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