From patchwork Wed Aug 19 20:00:09 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 7039161 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 AC41FC05AC for ; Wed, 19 Aug 2015 20:02:29 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DE0F4207C5 for ; Wed, 19 Aug 2015 20:02:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0B5ED207C0 for ; Wed, 19 Aug 2015 20:02:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752124AbbHSUCU (ORCPT ); Wed, 19 Aug 2015 16:02:20 -0400 Received: from mail-wi0-f177.google.com ([209.85.212.177]:38075 "EHLO mail-wi0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751574AbbHSUCU (ORCPT ); Wed, 19 Aug 2015 16:02:20 -0400 Received: by wicja10 with SMTP id ja10so17936318wic.1; Wed, 19 Aug 2015 13:02:18 -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=jzadvI4RUcTR9F2OmCsPtFOyMo4XeAiQ07POtTp/iNI=; b=k0p+wXzdlrcMtd7jIZfTCq3G/re71H5Y3fvJRKBFg4NvKaAwaiMD9PZUmarF/jqgpM zd/QdoDrRdLT0HXq3FAKMuDS5nZ++U1e+n6n+5min2VYylMQzlJSLNX+QzK+Q6NXKuH/ OXcl+cEJR+8SD1E690hBkGj18TU09puC3bJAmywDsS1s2ikosT5DuihoMc0UN/0B3R++ IO1g6Ji9F2rTCh5D2RFvG9Av5bMBN7GeY2I4R/yWlzm353mHDmT7PUjqSe6uEml5mINZ 57jSVdMnK6dWfc26kHuUY1j/hsueoI/O2+ssOu6mdTn/6kbg6ex0Ez+k3tZ+XmvGVKXH 3QtA== X-Received: by 10.180.37.164 with SMTP id z4mr3492590wij.28.1440014538949; Wed, 19 Aug 2015 13:02:18 -0700 (PDT) Received: from ?IPv6:2003:62:5f33:d300:53:9625:5fd5:1dea? (p200300625F33D300005396255FD51DEA.dip0.t-ipconnect.de. [2003:62:5f33:d300:53:9625:5fd5:1dea]) by smtp.googlemail.com with ESMTPSA id c3sm2442761wja.3.2015.08.19.13.02.18 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 19 Aug 2015 13:02:18 -0700 (PDT) Message-ID: <55D4E049.3090009@gmail.com> Date: Wed, 19 Aug 2015 22:00:09 +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: Krzysztof Kozlowski CC: linux-samsung-soc@vger.kernel.org, "linux-spi@vger.kernel.org" Subject: [PATCH 3/3] 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=-7.3 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, 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 --- 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 8365c88..56155bd 100644 --- a/drivers/spi/spi-s3c64xx.c +++ b/drivers/spi/spi-s3c64xx.c @@ -1244,10 +1244,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 */ @@ -1259,14 +1258,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);