From patchwork Fri Aug 21 17:35:08 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 7052851 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 109C9C05AC for ; Fri, 21 Aug 2015 17:40:30 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 39A5520576 for ; Fri, 21 Aug 2015 17:40:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4042720504 for ; Fri, 21 Aug 2015 17:40:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751769AbbHURkY (ORCPT ); Fri, 21 Aug 2015 13:40:24 -0400 Received: from mail-wi0-f169.google.com ([209.85.212.169]:38299 "EHLO mail-wi0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752110AbbHURkU (ORCPT ); Fri, 21 Aug 2015 13:40:20 -0400 Received: by wicja10 with SMTP id ja10so21592048wic.1; Fri, 21 Aug 2015 10:40:19 -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=V3s54K1iA4gwxDCJ0l61CuHUAwFkg7l9Q0fs0kVlgGg=; b=xINJccXol3VN2y5RfHr41LyZaGQnquEtvBvn9pYfynf5a0cPQJupiBdXN/LeG7WODm sowFyva3s1SAdDqR8vZW1sND+o9tl1ChzBlgkFLsEp3RqPnR8E0a/SM+5XopL/kkRwgb Z/ygOy5vTq2WArrugc3jP0vUfsU87GouS3c/ftns/DdpxlPm4L9wgXSz6ZG9KKgV/WT4 gErJXUhhGU6eiddNVYO/7lfgKpi4KaYTmwze+ErYfJMC5jL/UQJAr4FnZvJ1nhJMJ54o unKN4OkPQm3r136cOedQCGy2eMRKbLFL1hdP2D6C7a5wPxAhUhWv3EPx3bX7I9ngi05L OYog== X-Received: by 10.180.39.229 with SMTP id s5mr8207654wik.70.1440178819264; Fri, 21 Aug 2015 10:40:19 -0700 (PDT) Received: from ?IPv6:2003:62:5f33:d300:4526:b663:4b92:a3e2? (p200300625F33D3004526B6634B92A3E2.dip0.t-ipconnect.de. [2003:62:5f33:d300:4526:b663:4b92:a3e2]) by smtp.googlemail.com with ESMTPSA id go5sm3854203wib.5.2015.08.21.10.40.18 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 21 Aug 2015 10:40:18 -0700 (PDT) Message-ID: <55D7614C.6040309@gmail.com> Date: Fri, 21 Aug 2015 19:35:08 +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 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=-7.6 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 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; }