diff mbox

spi: atmel: add missing spi_master_{resume,suspend} calls to PM callbacks

Message ID 1393990141-3157-1-git-send-email-wenyou.yang@atmel.com (mailing list archive)
State New, archived
Delegated to: Mark Brown
Headers show

Commit Message

Wenyou Yang March 5, 2014, 3:29 a.m. UTC
The PM callbacks implemented by the spi-atmel driver don't call
spi_master_{resume,suspend}, fix that.

Signed-off-by: Wenyou Yang <wenyou.yang@atmel.com>
---
Hi Mark, 

The patch is based on the branch: for-next
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git

Best Regards,
Wenyou Yang

 drivers/spi/spi-atmel.c |   17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

Comments

Mark Brown March 5, 2014, 4 a.m. UTC | #1
On Wed, Mar 05, 2014 at 11:29:01AM +0800, Wenyou Yang wrote:
> The PM callbacks implemented by the spi-atmel driver don't call
> spi_master_{resume,suspend}, fix that.

Applied, thanks.
diff mbox

Patch

diff --git a/drivers/spi/spi-atmel.c b/drivers/spi/spi-atmel.c
index 47e7aeb..bda961e 100644
--- a/drivers/spi/spi-atmel.c
+++ b/drivers/spi/spi-atmel.c
@@ -1440,6 +1440,14 @@  static int atmel_spi_suspend(struct device *dev)
 {
 	struct spi_master	*master = dev_get_drvdata(dev);
 	struct atmel_spi	*as = spi_master_get_devdata(master);
+	int ret;
+
+	/* Stop the queue running */
+	ret = spi_master_suspend(master);
+	if (ret) {
+		dev_warn(dev, "cannot suspend master\n");
+		return ret;
+	}
 
 	clk_disable_unprepare(as->clk);
 
@@ -1452,11 +1460,18 @@  static int atmel_spi_resume(struct device *dev)
 {
 	struct spi_master	*master = dev_get_drvdata(dev);
 	struct atmel_spi	*as = spi_master_get_devdata(master);
+	int ret;
 
 	pinctrl_pm_select_default_state(dev);
 
 	clk_prepare_enable(as->clk);
-	return 0;
+
+	/* Start the queue running */
+	ret = spi_master_resume(master);
+	if (ret)
+		dev_err(dev, "problem starting queue (%d)\n", ret);
+
+	return ret;
 }
 
 static SIMPLE_DEV_PM_OPS(atmel_spi_pm_ops, atmel_spi_suspend, atmel_spi_resume);