From patchwork Thu Aug 7 16:07:07 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartlomiej Zolnierkiewicz X-Patchwork-Id: 4691881 Return-Path: X-Original-To: patchwork-linux-samsung-soc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id AF7AAC0338 for ; Thu, 7 Aug 2014 16:07:20 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id BF7472017D for ; Thu, 7 Aug 2014 16:07:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 57FC720114 for ; Thu, 7 Aug 2014 16:07:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932082AbaHGQHR (ORCPT ); Thu, 7 Aug 2014 12:07:17 -0400 Received: from mailout1.samsung.com ([203.254.224.24]:43977 "EHLO mailout1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757488AbaHGQHP (ORCPT ); Thu, 7 Aug 2014 12:07:15 -0400 Received: from epcpsbgm1.samsung.com (epcpsbgm1 [203.254.230.26]) by mailout1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0N9Y000Y5241E690@mailout1.samsung.com>; Fri, 08 Aug 2014 01:07:13 +0900 (KST) X-AuditID: cbfee61a-f79e46d00000134f-78-53e3a431bff2 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id C4.4F.04943.134A3E35; Fri, 08 Aug 2014 01:07:13 +0900 (KST) Received: from amdc1032.localnet ([106.116.147.136]) by mmp2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0N9Y00DYP23XI970@mmp2.samsung.com>; Fri, 08 Aug 2014 01:07:13 +0900 (KST) From: Bartlomiej Zolnierkiewicz To: Chris Ball Cc: Ulf Hansson , Mark Brown , Jaehoon Chung , Ben Dooks , Kyungmin Park , linux-mmc@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] mmc: sdhci-s3c: fix runtime PM handling on sdhci_add_host() failure Date: Thu, 07 Aug 2014 18:07:07 +0200 Message-id: <5567000.WJnOP5ckul@amdc1032> User-Agent: KMail/4.8.4 (Linux/3.2.0-54-generic-pae; KDE/4.8.5; i686; ; ) MIME-version: 1.0 Content-transfer-encoding: 7Bit Content-type: text/plain; charset=us-ascii X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrMLMWRmVeSWpSXmKPExsVy+t9jQV3DJY+DDfZ2K1tMWneAyeLf7FNs FhMub2e0uPGrjdXibNMbdovLu+awWRz5389oMeP8PiaL42vDHTg9/q56wexx59oeNo+XE3+z edx4tZDJo2/LKkaPz5vkAtiiuGxSUnMyy1KL9O0SuDLuTNnJWPBPsWLJ3RXMDYwrZbsYOTkk BEwk9h38xARhi0lcuLeerYuRi0NIYDqjxIlnDcwQTguTxKy9i5lBqtgErCQmtq9iBLFFBBQl ji+dww5SxCywiUni89GNYEXCAmESj86vYQOxWQRUJU40vgOL8wpoSmyZ8wAsLirgKbFj+0o2 iLigxI/J91hAbGYBeYl9+6eyQthaEut3HmeawMg3C0nZLCRls5CULWBkXsUomlqQXFCclJ5r qFecmFtcmpeul5yfu4kRHNTPpHYwrmywOMQowMGoxMMr0P04WIg1say4MvcQowQHs5IIry5I iDclsbIqtSg/vqg0J7X4EKM0B4uSOO+BVutAIYH0xJLU7NTUgtQimCwTB6dUA6Ne5NQlL5J3 G9w8t6PmVME/zf0r+WMNhS9L5ugs1uoWz70p8K1KYuE869ObbUOW2U08OkFns9XdK/szztiI SLy5XPhwb8qGEhFbD4OYx3u35/3rj919cGXmg4zaf9XyJ29Nv3Swfu6v9m9Tfi4MV/yucahu 0/RP2hF7TWZdPxHZu3i55eyta536lViKMxINtZiLihMBLezETGYCAAA= Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 Runtime Power Management handling for the sdhci_add_host() failure case in sdhci_s3c_probe() should match the code in sdhci_s3c_remove() (which uses pm_runtime_disable() call which matches the earlier pm_runtime_enable() one). Fix it. This patch fixes "BUG: spinlock bad magic on CPU#0, swapper/0/1" and "Unbalanced pm_runtime_enable!" warnings. From the kernel log: ... [ 1.659631] s3c-sdhci 12530000.sdhci: sdhci_add_host() failed [ 1.665096] BUG: spinlock bad magic on CPU#0, swapper/0/1 [ 1.670433] lock: 0xea01e484, .magic: 00000000, .owner: /-1, .owner_cpu: 0 [ 1.677895] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 3.16.0-next-20140804-00008-ga59480f-dirty #707 [ 1.687037] [] (unwind_backtrace) from [] (show_stack+0x10/0x14) [ 1.694740] [] (show_stack) from [] (dump_stack+0x68/0xb8) [ 1.701948] [] (dump_stack) from [] (do_raw_spin_lock+0x15c/0x1a4) [ 1.709848] [] (do_raw_spin_lock) from [] (_raw_spin_lock_irqsave+0x20/0x28) [ 1.718619] [] (_raw_spin_lock_irqsave) from [] (sdhci_do_set_ios+0x1c/0x5cc) [ 1.727464] [] (sdhci_do_set_ios) from [] (sdhci_runtime_resume_host+0x50/0x104) [ 1.736574] [] (sdhci_runtime_resume_host) from [] (pm_generic_runtime_resume+0x2c/0x40) [ 1.746383] [] (pm_generic_runtime_resume) from [] (__rpm_callback+0x34/0x70) [ 1.755233] [] (__rpm_callback) from [] (rpm_callback+0x28/0x88) [ 1.762958] [] (rpm_callback) from [] (rpm_resume+0x384/0x4ec) [ 1.770511] [] (rpm_resume) from [] (pm_runtime_forbid+0x58/0x64) [ 1.778325] [] (pm_runtime_forbid) from [] (sdhci_s3c_probe+0x4a4/0x540) [ 1.786749] [] (sdhci_s3c_probe) from [] (platform_drv_probe+0x2c/0x5c) [ 1.795076] [] (platform_drv_probe) from [] (driver_probe_device+0x114/0x234) [ 1.803929] [] (driver_probe_device) from [] (__driver_attach+0x8c/0x90) [ 1.812347] [] (__driver_attach) from [] (bus_for_each_dev+0x54/0x88) [ 1.820506] [] (bus_for_each_dev) from [] (bus_add_driver+0xd8/0x1cc) [ 1.828665] [] (bus_add_driver) from [] (driver_register+0x78/0xf4) [ 1.836652] [] (driver_register) from [] (do_one_initcall+0x80/0x1d0) [ 1.844816] [] (do_one_initcall) from [] (kernel_init_freeable+0x108/0x1d4) [ 1.853503] [] (kernel_init_freeable) from [] (kernel_init+0x8/0xe4) [ 1.861568] [] (kernel_init) from [] (ret_from_fork+0x14/0x3c) [ 1.869582] platform 12530000.sdhci: Driver s3c-sdhci requests probe deferral ... [ 1.997047] s3c-sdhci 12530000.sdhci: Unbalanced pm_runtime_enable! ... [ 2.027235] s3c-sdhci 12530000.sdhci: sdhci_add_host() failed [ 2.032884] platform 12530000.sdhci: Driver s3c-sdhci requests probe deferral ... Tested on Hardkernel's Exynos4412 based ODROID-U3 board. Fixes: 9f4e8151dbbc ("mmc: sdhci-s3c: Enable runtime power management") Cc: Mark Brown Cc: Jaehoon Chung Cc: Ben Dooks Signed-off-by: Bartlomiej Zolnierkiewicz Acked-by: Kyungmin Park --- patch is against next-20140804 branch of linux-next kernel drivers/mmc/host/sdhci-s3c.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/mmc/host/sdhci-s3c.c b/drivers/mmc/host/sdhci-s3c.c index fa5954a..1e47903 100644 --- a/drivers/mmc/host/sdhci-s3c.c +++ b/drivers/mmc/host/sdhci-s3c.c @@ -606,8 +606,6 @@ static int sdhci_s3c_probe(struct platform_device *pdev) ret = sdhci_add_host(host); if (ret) { dev_err(dev, "sdhci_add_host() failed\n"); - pm_runtime_forbid(&pdev->dev); - pm_runtime_get_noresume(&pdev->dev); goto err_req_regs; } @@ -618,6 +616,8 @@ static int sdhci_s3c_probe(struct platform_device *pdev) return 0; err_req_regs: + pm_runtime_disable(&pdev->dev); + err_no_busclks: clk_disable_unprepare(sc->clk_io);