From patchwork Thu Sep 3 20:40:11 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 7119291 Return-Path: X-Original-To: patchwork-linux-spi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 986D2BEEC1 for ; Thu, 3 Sep 2015 20:43:20 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B98AA20801 for ; Thu, 3 Sep 2015 20:43:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9F93720808 for ; Thu, 3 Sep 2015 20:43:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757205AbbICUnS (ORCPT ); Thu, 3 Sep 2015 16:43:18 -0400 Received: from mail-wi0-f173.google.com ([209.85.212.173]:35513 "EHLO mail-wi0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757175AbbICUnR (ORCPT ); Thu, 3 Sep 2015 16:43:17 -0400 Received: by wicge5 with SMTP id ge5so567197wic.0 for ; Thu, 03 Sep 2015 13:43:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :content-type:content-transfer-encoding; bh=NNpSAr6WUTK6tzShTQhgPkSV0bpBDYar3LlsgIQcLTg=; b=Dyo/9hCGZqVGtak0SCmFz9AUzbsZ+lOKTfzzLsoU7tMR/bNx5twX3DMt4vz7w0dgfu D8NApO95zH0HCylEhFFN/bx3bjjIq+15xpJDFuwW5SvczXeQ3LsiyiQj4WJG2/2LcIUC X217Sc2TuzU/brFlkmTTuar5YBVexo+Q+uzZoB9K7rhzxcH3ciTDQ0ZYD/GMiZbafRIc 8fLYN3oDtNzg9EZZF84fci89EeNWK/gjd9tPNFSd0WxjQ4fgn5FMVr3OtUGqDZj9ofHc Y65EVGIspbwUeZd4yp3v6UGaY8VywStDY9BvS+Ydo+no9pa9lpOl8vAjnWviKqVYilCK VkRg== X-Received: by 10.180.106.66 with SMTP id gs2mr223352wib.14.1441312996708; Thu, 03 Sep 2015 13:43:16 -0700 (PDT) Received: from ?IPv6:2003:62:5f33:d300:bd9c:1f82:410c:b71c? (p200300625F33D300BD9C1F82410CB71C.dip0.t-ipconnect.de. [2003:62:5f33:d300:bd9c:1f82:410c:b71c]) by smtp.googlemail.com with ESMTPSA id kx6sm51489wjb.5.2015.09.03.13.43.15 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 03 Sep 2015 13:43:15 -0700 (PDT) Message-ID: <55E8B02B.8000905@gmail.com> Date: Thu, 03 Sep 2015 22:40:11 +0200 From: Heiner Kallweit User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: Mark Brown CC: Krzysztof Kozlowski , "linux-spi@vger.kernel.org" Subject: [PATCH 3/4 RESEND v2] spi: s3c64xx: simplify suspend / resume handlers Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The runtime PM suspend / resume handlers take care of the enabling/ disabling the clocks already. Therefore replace the duplicated clock handling with pm_runtime_force_suspend/resume. Signed-off-by: Heiner Kallweit Reviewed-by: Krzysztof Kozlowski --- Changed: - Replaced pm_runtime_suspend/resume calls with their .._force_.. equivalents. v2: - Added "Reviewed-by" drivers/spi/spi-s3c64xx.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c index edeac06..735b7f5 100644 --- a/drivers/spi/spi-s3c64xx.c +++ b/drivers/spi/spi-s3c64xx.c @@ -1246,10 +1246,9 @@ static int s3c64xx_spi_suspend(struct device *dev) if (ret) return ret; - if (!pm_runtime_suspended(dev)) { - clk_disable_unprepare(sdd->clk); - clk_disable_unprepare(sdd->src_clk); - } + ret = pm_runtime_force_suspend(dev); + if (ret < 0) + return ret; sdd->cur_speed = 0; /* Output Clock is stopped */ @@ -1261,14 +1260,14 @@ static int s3c64xx_spi_resume(struct device *dev) struct spi_master *master = dev_get_drvdata(dev); struct s3c64xx_spi_driver_data *sdd = spi_master_get_devdata(master); struct s3c64xx_spi_info *sci = sdd->cntrlr_info; + int ret; if (sci->cfg_gpio) sci->cfg_gpio(); - if (!pm_runtime_suspended(dev)) { - clk_prepare_enable(sdd->src_clk); - clk_prepare_enable(sdd->clk); - } + ret = pm_runtime_force_resume(dev); + if (ret < 0) + return ret; s3c64xx_spi_hwinit(sdd, sdd->port_id);