From patchwork Thu Sep 3 20:40:53 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 7119301 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 A552BBF036 for ; Thu, 3 Sep 2015 20:43:21 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C6267205B1 for ; Thu, 3 Sep 2015 20:43:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DB6AA2073D for ; Thu, 3 Sep 2015 20:43:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757244AbbICUnT (ORCPT ); Thu, 3 Sep 2015 16:43:19 -0400 Received: from mail-wi0-f173.google.com ([209.85.212.173]:34219 "EHLO mail-wi0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757175AbbICUnT (ORCPT ); Thu, 3 Sep 2015 16:43:19 -0400 Received: by wicfx3 with SMTP id fx3so2671854wic.1 for ; Thu, 03 Sep 2015 13:43: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=zE8cB37cdxcjL/1qxQFjLMfPv9OkWoriktduknTQL7A=; b=Fwf7wdcAwwtYwvhYx45XiAL6DNpugs5X2JnOXS4N/OMzvzE7Y20AYYZNCHnAcfYiHw aKY0tw6nH43gXwvybi2LmZxAL1hA9c55Jz30KoO/pjfFEh0gWlYDUcP/pPtsSz0W4/26 06lY4TINK/HNzOj/h3Mqaq6F7qEdVKtO6QnxVbooHk57ITZ9cfcXj+oB2MQXeLyswgdk P4qTt/avqfN0EBlsmuZ+DAzRM4sX7XXTTqWU8hxqaf6fD/n/NBPH5fztKVpqC14Ne0ZP Crj9Gcz7ZWToVMlvTetCGtrwW0SjFeL4psRkpUCawk3Pw9q3h7qF6DvJZNfaxog3vxcQ 7AEA== X-Received: by 10.194.85.163 with SMTP id i3mr54633257wjz.75.1441312998038; Thu, 03 Sep 2015 13:43:18 -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 p3sm120879wib.16.2015.09.03.13.43.17 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 03 Sep 2015 13:43:17 -0700 (PDT) Message-ID: <55E8B055.5040102@gmail.com> Date: Thu, 03 Sep 2015 22:40:53 +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 4/4 RESEND v2] spi: s3c64xx: replace clock disabling with runtime PM suspend call in remove function 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 Simplify s3c64xx_spi_remove by replacing the clock disabling with calling runtime PM suspend which does the same. Waking up the device if it was suspended wouldn't be strictly needed for this driver but using pm_runtime_get_sync is cleaner and makes s3c64xx_spi_remove more consistent with the runtime PM handling in s3c64xx_spi_setup. pm_runtime_force_suspend does most of the work for us: disabling the clocks, disabling runtime PM and setting it to "suspended" state. Signed-off-by: Heiner Kallweit Reviewed-by: Krzysztof Kozlowski --- Changed: - Added to the patch set v2: - Don't use runtime_pm_force_suspend. Technically it works but it's not intuitive as we don't intend to suspend here. drivers/spi/spi-s3c64xx.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c index 4e5931c..dee82e1 100644 --- a/drivers/spi/spi-s3c64xx.c +++ b/drivers/spi/spi-s3c64xx.c @@ -1225,7 +1225,7 @@ static int s3c64xx_spi_remove(struct platform_device *pdev) struct spi_master *master = spi_master_get(platform_get_drvdata(pdev)); struct s3c64xx_spi_driver_data *sdd = spi_master_get_devdata(master); - pm_runtime_disable(&pdev->dev); + pm_runtime_get_sync(&pdev->dev); writel(0, sdd->regs + S3C64XX_SPI_INT_EN); @@ -1233,6 +1233,10 @@ static int s3c64xx_spi_remove(struct platform_device *pdev) clk_disable_unprepare(sdd->clk); + pm_runtime_put_noidle(&pdev->dev); + pm_runtime_disable(&pdev->dev); + pm_runtime_set_suspended(&pdev->dev); + return 0; }