From patchwork Fri May 15 14:04:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 186828 Delivered-To: patches@linaro.org Received: by 2002:a92:5b0a:0:0:0:0:0 with SMTP id p10csp468237ilb; Fri, 15 May 2020 07:04:55 -0700 (PDT) X-Received: by 2002:a2e:b0c8:: with SMTP id g8mr125947ljl.270.1589551495318; Fri, 15 May 2020 07:04:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589551495; cv=none; d=google.com; s=arc-20160816; b=dDax8r7K54/qyDlwOFu2QPjj/BJfbm50WPHd+a0ytQwQokg+rjlmD9YUUQT8KvRsL5 lPV8YX1nkimCvhfm3ZWFjC9uOke0Qfh7gJYgsMlFIVHtm3aIw87bdJzaurGmfVpu2SK8 1JYN7uQlLVpZIq5zCjz7UVNSbjipMleLkkfZLFRS/PbJWLgojtUmB+tqxrziLE5SDDaT hWYIWmyGeG2YOijW3c110M77OkoV9DmhUl7IS3XfTVsRj1qeai3HelldPfmXHq5S/ezZ 7tt5KxWkTCYpM0YK3Hb+/1GHlmyOuPReaqBWuFNWbneL9vydFgMvhma8yo/eGp0r/JhU mZKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:dkim-signature; bh=KqMvS6Pwv6qwK7ezeFo5bAq4FbNQAaDLk8gZGW9T6as=; b=nnerew6IVfSMdMbj1VuuI+joZSfjydHggtcSbpCDOeYU218SVk6tpJKUYtrWTApDK0 QQX74Y6Y2tLgwIADnY44h145T6d+uHrNhU+C7gh7AjQBkFkStyngffRHlGbpQiPitLbl 53j9sxpoPyvB8mk+mh2afH6Xm8/sUc4mhSiNQIrQuR/vR2Prip/Nci2nmXx1SJu2nTSe XGSfAe1dcsAIPh8+fFVt8c1go4ozC233R5NM+/FbFI4+ugxR2plpzOmvwGX/rKNSX2fO egcg/qfBpVTc2TNvrsknn23fIgcOE28hidX5RPdbzXMV8gG/JB+YDksRfPjvaIwMqpEZ GlGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=aX8u4ajF; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id t204sor886165lff.7.2020.05.15.07.04.55 for (Google Transport Security); Fri, 15 May 2020 07:04:55 -0700 (PDT) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=aX8u4ajF; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=KqMvS6Pwv6qwK7ezeFo5bAq4FbNQAaDLk8gZGW9T6as=; b=aX8u4ajFiW391041HpRcD7gqgJfPAZ/hJVoyWEEUaZsOnxW/NcXwN+EP9hbJck9lLH WDjTLqSnvRdOScIHXz0y+IBj5FybBPu1wchgIGEn/3IEiKao7HzyrKmf/G4hVoi7NNWb IPeRDmM186Y88s49kG7u0h8mS9W6ca3w4wRNbFKAwUz3ZFb7y9BzuueL9PWOj+XGazv0 tOFcmxK4RueEOop4uFOwyOLHJPLzMKedGWodstvusmZwisrbLg5M/5rtpcy5EnacqsZk CU3TCrmqzDVd6bQzneNAvp/KVozlKkU20ehMcnqfYKerAr/tPgdLCo+d5bojHWfP6EYt kwzA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=KqMvS6Pwv6qwK7ezeFo5bAq4FbNQAaDLk8gZGW9T6as=; b=SI03vrSN/rtCDXDLICIS6ZVUqJcn/8Vza6dwyG2sK5pDE6uWxEPDkmqapyojDPeWjW 0p7DyST1h2O/vw6Mvh+vxxOjR/xpbWiVLmfmuN3Vc671V5BXBzMEdCVp8b9UVXpAQvzQ uG/ihlvIuO6DG69oWCjDFHcFPoltPntDzSZt2E05TfBxmJX+T8dO0Ma7YqbDQEu0hz13 Kd4l7PePXam1crev+m3mH5GX50uZbb0AwpWlvg1E/LihzYMGoaej9J+y/gdCIrfifIWl 3ByCRaTVbyZrr9b0FRNDfzf7B8gvGRqUrdnD1Gs1Y1D3WERQlajx+w3M81zdD1ObK1go lHoA== X-Gm-Message-State: AOAM530TZtAMWTejlRvdMlH4L0DNRxMp3ZEhnjz399AoRHaab7qgOLHO LJGT/FYXWaoKRqk2bcgFQvR6//x+ X-Google-Smtp-Source: ABdhPJwD6NGbv8QK0RiAWkvYC0Di8KBIOeOG9AwX2UOFScSP2rYJA8jKEFuP52XOClUvMPOa2FvGJw== X-Received: by 2002:a19:505b:: with SMTP id z27mr2401339lfj.123.1589551494656; Fri, 15 May 2020 07:04:54 -0700 (PDT) Return-Path: Received: from localhost.localdomain (h-98-128-181-7.NA.cust.bahnhof.se. [98.128.181.7]) by smtp.gmail.com with ESMTPSA id q17sm1281448lfa.28.2020.05.15.07.04.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 May 2020 07:04:53 -0700 (PDT) From: Ulf Hansson To: linux-mmc@vger.kernel.org, Ulf Hansson , Masahiro Yamada , Wolfram Sang Cc: Ulrich Hecht , Simon Horman , Niklas Soderlund , Geert Uytterhoeven Subject: [PATCH 1/2] mmc: tmio: Further fixup runtime PM management at remove Date: Fri, 15 May 2020 16:04:45 +0200 Message-Id: <20200515140445.15218-1-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Before calling tmio_mmc_host_probe(), the caller is required to enable clocks for its device, as to make it accessible when reading/writing registers during probe. Therefore, the responsibility to disable these clocks, in the error path of ->probe() and during ->remove(), is better managed outside tmio_mmc_host_remove(). As a matter of fact, callers of tmio_mmc_host_remove() already expects this to be the behaviour. However, there's a problem with tmio_mmc_host_remove() when the Kconfig option, CONFIG_PM, is set. More precisely, tmio_mmc_host_remove() may then disable the clock via runtime PM, which leads to clock enable/disable imbalance problems, when the caller of tmio_mmc_host_remove() also tries to disable the same clocks. Reported-by: Geert Uytterhoeven Signed-off-by: Ulf Hansson --- drivers/mmc/host/tmio_mmc_core.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) -- 2.20.1 Reviewed-by: Wolfram Sang Tested-by: Wolfram Sang diff --git a/drivers/mmc/host/tmio_mmc_core.c b/drivers/mmc/host/tmio_mmc_core.c index f31afd1c2671..ba301fb7656b 100644 --- a/drivers/mmc/host/tmio_mmc_core.c +++ b/drivers/mmc/host/tmio_mmc_core.c @@ -1231,12 +1231,14 @@ void tmio_mmc_host_remove(struct tmio_mmc_host *host) cancel_work_sync(&host->done); cancel_delayed_work_sync(&host->delayed_reset_work); tmio_mmc_release_dma(host); + tmio_mmc_disable_mmc_irqs(host, TMIO_MASK_ALL); - pm_runtime_dont_use_autosuspend(&pdev->dev); if (host->native_hotplug) pm_runtime_put_noidle(&pdev->dev); - pm_runtime_put_sync(&pdev->dev); + pm_runtime_disable(&pdev->dev); + pm_runtime_dont_use_autosuspend(&pdev->dev); + pm_runtime_put_noidle(&pdev->dev); } EXPORT_SYMBOL_GPL(tmio_mmc_host_remove);