From patchwork Tue Jun 16 15:35:41 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 188064 Delivered-To: patch@linaro.org Received: by 2002:a92:cf06:0:0:0:0:0 with SMTP id c6csp3773220ilo; Tue, 16 Jun 2020 08:55:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzP1H+N61arZDazOlMOl05hN++484YPnSEmlnyG62ug9OkpQEGPy25vXRqW0q17LMBdctQ6 X-Received: by 2002:a17:906:73db:: with SMTP id n27mr3339029ejl.16.1592322927791; Tue, 16 Jun 2020 08:55:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592322927; cv=none; d=google.com; s=arc-20160816; b=AQgD1WGE/+0pLB/1e/PauxHEiPAGA6UgR/lByStd0K2uFLQj1bPn0EOMid/Zgtms8u 68jFjV8GXfG7J6cJwcvHoiB6WcDc0v5WNMp8Py8X4yIcPuwTQ/E6gdgXavIu/jBW+ply g6uaViXEKc2FRFQV0JI36H5HH4cGCmZKE73mOtb0eHYsRtWqdJVTUB2zLebJwpLnUxzL aeLBVNZ7zWPCVqhBN1dhfPsUQtOgs+IrBo80v91HOqC7Ft2U8lMvC7B51HvNaa6wl45D NFs6CNLEXbTMcIlOTw0tCol/4X/igmMQfV/UxASwp+CYFd28T0rTmjxFTzlhYHyOSUvB wPww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=nv+FUJXr/72GCjtB5TcKuCCj+OAS5iLb1R5SU0uBKnE=; b=Sy9WrqjjPNXBJi8ITBlwZFis8ro/P2+sPCKz3sQNtiCv3bpH9oPTZzl9WFjRSI0NfY MLy7/KvaKapec/wib+PcpSOkcuxdqPmXr1xZpGyn+C2eMisicRH6ANvkVEFo6hiST8m/ GlkmUECA3tZgwtQ/Lcm5dqdhgY+3f6PSXy61StFPkWxy6RFMMLJMZQs2EWcVrfyOVP95 TpJBcZ+Z+ITumH3WJjNNGPLuyBF2XUhsA03nST/E+Ba5TPsA/xr1TJJ2489z1tU3fqGW C24aofEiEy8M0BFNHYO8qhmMkp36TmYw+EAyC73gnGjzqDIC6bt8x7zomP+EVWnQIeVy BpWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=CIxqqQgV; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id oz13si3896145ejb.567.2020.06.16.08.55.27; Tue, 16 Jun 2020 08:55:27 -0700 (PDT) Received-SPF: pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=CIxqqQgV; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732848AbgFPPz0 (ORCPT + 15 others); Tue, 16 Jun 2020 11:55:26 -0400 Received: from mail.kernel.org ([198.145.29.99]:55060 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1733047AbgFPPzK (ORCPT ); Tue, 16 Jun 2020 11:55:10 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 20EB0208D5; Tue, 16 Jun 2020 15:55:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592322910; bh=rD/bwrRxEpefQW38GRQL6xrFKiUVHbl4w5atnj3+/nA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CIxqqQgVSkrk+5fzIpTgvJ3gEAAc52ga7GaTa+rpUslbRmbSew4P1I7mQGxX1AEGH tj3r0BZCPlAMFCMzi5mH5vlcKrBNu8U1IRl93MyiL+4+1JXOZNzOVvoKU/IyPriIK4 jaqsDRImlkwexJ7i845cBWIpP/d3v4JYZ51i80mE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Geert Uytterhoeven , Wolfram Sang , Ulf Hansson Subject: [PATCH 5.6 151/161] mmc: tmio: Further fixup runtime PM management at remove Date: Tue, 16 Jun 2020 17:35:41 +0200 Message-Id: <20200616153113.534402978@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200616153106.402291280@linuxfoundation.org> References: <20200616153106.402291280@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Ulf Hansson commit 4bd784411aca022622e484eb262f5a0540ae732c upstream. 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. To solve the problem, let's make sure tmio_mmc_host_remove() leaves the device with clocks enabled, but also make sure to disable the IRQs, as we normally do at ->runtime_suspend(). Reported-by: Geert Uytterhoeven Reviewed-by: Wolfram Sang Tested-by: Wolfram Sang Signed-off-by: Ulf Hansson Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/20200519152434.6867-1-ulf.hansson@linaro.org Tested-by: Geert Uytterhoeven Signed-off-by: Greg Kroah-Hartman --- drivers/mmc/host/tmio_mmc_core.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) --- a/drivers/mmc/host/tmio_mmc_core.c +++ b/drivers/mmc/host/tmio_mmc_core.c @@ -1286,12 +1286,14 @@ void tmio_mmc_host_remove(struct tmio_mm 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);