From 347de6bab4bd0166115a5c90491a05bf9df508ee Mon Sep 17 00:00:00 2001 From: Krzysztof Kozlowski Date: Mon, 21 Oct 2013 15:42:49 +0200 Subject: spi/s3c64xx: Do not ignore return value of spi_master_resume/suspend 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 Signed-off-by: Kyungmin Park Reviewed-by: Sylwester Nawrocki Signed-off-by: Mark Brown --- drivers/spi/spi-s3c64xx.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'drivers/spi/spi-s3c64xx.c') diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c index 8e732a1b8a9b..435406b48fda 100644 --- a/drivers/spi/spi-s3c64xx.c +++ b/drivers/spi/spi-s3c64xx.c @@ -1477,7 +1477,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); @@ -1503,9 +1505,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 */ -- cgit v1.2.1 From 9d7fd21acb2094d38d8560b0b3c91fa31efa6a71 Mon Sep 17 00:00:00 2001 From: Krzysztof Kozlowski Date: Mon, 21 Oct 2013 15:42:50 +0200 Subject: spi/s3c64xx: Fix doubled clock disable on suspend 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 [] (unwind_backtrace+0x0/0x138) from [] (show_stack+0x10/0x14) [] (show_stack+0x10/0x14) from [] (warn_slowpath_common+0x4c/0x68) [] (warn_slowpath_common+0x4c/0x68) from [] (warn_slowpath_null+0x1c/0x24) [] (warn_slowpath_null+0x1c/0x24) from [] (clk_disable+0x18/0x24) [] (clk_disable+0x18/0x24) from [] (s3c64xx_spi_suspend+0x28/0x54) [] (s3c64xx_spi_suspend+0x28/0x54) from [] (platform_pm_suspend+0x2c/0x5c) [] (platform_pm_suspend+0x2c/0x5c) from [] (dpm_run_callback+0x44/0x7c) [] (dpm_run_callback+0x44/0x7c) from [] (__device_suspend+0x108/0x300) [] (__device_suspend+0x108/0x300) from [] (dpm_suspend+0x54/0x208) [] (dpm_suspend+0x54/0x208) from [] (suspend_devices_and_enter+0x98/0x458) [] (suspend_devices_and_enter+0x98/0x458) from [] (pm_suspend+0x1c4/0x25c) [] (pm_suspend+0x1c4/0x25c) from [] (state_store+0x6c/0xbc) [] (state_store+0x6c/0xbc) from [] (kobj_attr_store+0x14/0x20) [] (kobj_attr_store+0x14/0x20) from [] (sysfs_write_file+0xfc/0x164) [] (sysfs_write_file+0xfc/0x164) from [] (vfs_write+0xbc/0x1bc) [] (vfs_write+0xbc/0x1bc) from [] (SyS_write+0x40/0x68) [] (SyS_write+0x40/0x68) from [] (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 Signed-off-by: Kyungmin Park Reviewed-by: Sylwester Nawrocki Signed-off-by: Mark Brown --- drivers/spi/spi-s3c64xx.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'drivers/spi/spi-s3c64xx.c') diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c index 435406b48fda..1dbdcc7b9ea7 100644 --- a/drivers/spi/spi-s3c64xx.c +++ b/drivers/spi/spi-s3c64xx.c @@ -1481,9 +1481,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 */ @@ -1499,9 +1500,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); -- cgit v1.2.1