From patchwork Fri Sep 13 09:40:53 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 173743 Delivered-To: patches@linaro.org Received: by 2002:ac9:19ad:0:0:0:0:0 with SMTP id d45csp464469oce; Fri, 13 Sep 2019 02:40:58 -0700 (PDT) X-Received: by 2002:a19:c3d3:: with SMTP id t202mr31678454lff.48.1568367658550; Fri, 13 Sep 2019 02:40:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568367658; cv=none; d=google.com; s=arc-20160816; b=EularVPc8nPlwlg9RktzSXzMHtpv3IY8fpiLPcwH3lCp7ioMNSHwFOLuQYOnRKQS5O KnlGkTTrWDvnCCrMX1f3REvc0xLKY6TC8xYcENGyvk/sHVrftloaDHIhJyZi3NldjGi6 26VhIFpXRjxnWFhnvSc5j9sqGLjUge8m7h9/FKAn94zIcIesY24dupB59OaiHO6wTOYZ XG5CUrzgploqzj3Dji+lqAPKlr0wcEYsfaGZIwYxndidZwlXUC6n+7JMyRfNgQWFmWIq pUz0jbeIuaG0Ca3Acv/L/dsCRDn4GxtZDmrc9iM0QErjiUa2mxQ1alIDmHwMNcPX3vWb d5oA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:date:subject:cc:to:from:dkim-signature; bh=cnHaKGcMzTZrMV9+DycpQtbjSI9gqCpzF+WM5KDAOYI=; b=PullthgP+6pbPJa1Fh11YD+D4H4onpqrRz8DLN2gKHh8vGB9H3xLzV477Kgh/5MR6g EdN1inG9QGRuKrOLlI2/6IH+kHpOmEqYflObIs8+7/5Uc+eQ8tM5Ov+bECbJRp14S8Fq PwPFeuAf9Ne8BClNoIpo7plNLp0GAkEENBiWgTXW85cSOLGsOyLfe73rAnyybsPafTta LicO4A6/5ZAqT99+9OdVODnpsL7YGiucMKyHt94zSdDQ3dJdwNWYJubplJyKVoRVd/O9 44JfZUIrn8sJv5eh44PPzIzkbanbXKxS1cvGu+2BTxuHkNzYffS4bD/bf3qB2YRRmrUm 03TQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=mdidwElC; 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 w7sor8808138lfn.2.2019.09.13.02.40.58 for (Google Transport Security); Fri, 13 Sep 2019 02:40:58 -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=mdidwElC; 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; bh=cnHaKGcMzTZrMV9+DycpQtbjSI9gqCpzF+WM5KDAOYI=; b=mdidwElC8ipcbQxW/mPtNfu0vZY4TgHVrd3CNdL05yVYt9Lu77V+SZgbcEh87oEj7t gkLldHdYEKEK06Fc+cZqP2I5MK7PrKHFf900QCERYDJNbKvModF4UfEzyA9/RkDX0WaI SJHrbh0A/ebWMzJzgdAL/7wS7xRVVjYng9uolBqjzY+4IgDkI+iApBGAKRoU+g7BTgHP oXflWjRSzo7cjca5l98vN4G5cmz8MUZGpy2viBXMqx+fHTLL+NECNr+yfj0nN+yFBwXb TZxJCjC6I7KpNKLSNhb/hcD6L7Vo3PS3c8Yu/ndzVGYexUP+v1YOD+w5D8Dz96F1gL5m 1m0Q== 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; bh=cnHaKGcMzTZrMV9+DycpQtbjSI9gqCpzF+WM5KDAOYI=; b=dRRUw4XTfYP9jEFI3J7tOE5AjTL0XClW1lSpfRJVizz7pceex0OC9VeA6K1kRxDFP0 NYp1Og4zp21nER2Sd5S/UaJroDlTY/C8Sx/1MQvWI2Lno4RH3W96eS2V/1bzGrH+Fh6l ZQbdbBcQ2J+TJLviU8M/29kfPnr5rdV/VpV3paw+9q1GsugfAkm84a80sVNGr8llSGbi c6ml9M+h1FRgdRqjKUgCQRzIAVcIOMvbrqIyvhG5H+OzSzn8Q97ODNFUJRbKbV2v2+dI egR5ZZgsp/yclaV+x2YtgPhySTOA4YqlD99xe3rrLUGmIK/Z4Oq+keefc51yPI1IrMmv 3DrQ== X-Gm-Message-State: APjAAAXccfgHEYigYMfuwkg4hP6/7BCAe9nwzvik8r6aeFC84eDA7zuD 6Orm/pCIyKe0XABHi4S3Z6QwtcB4 X-Google-Smtp-Source: APXvYqwEiWp/yNjzuQzjQoTmrkabJNoCTsTHyjiRt4f7PpRE9siDiHU3jHYq2MuhjIpOrvFqdSrDzw== X-Received: by 2002:a19:2207:: with SMTP id i7mr30863016lfi.185.1568367658137; Fri, 13 Sep 2019 02:40:58 -0700 (PDT) Return-Path: Received: from localhost.localdomain (h-158-174-22-210.NA.cust.bahnhof.se. [158.174.22.210]) by smtp.gmail.com with ESMTPSA id l9sm6183358ljg.79.2019.09.13.02.40.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Sep 2019 02:40:57 -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/3] Revert "mmc: tmio: move runtime PM enablement to the driver implementations" Date: Fri, 13 Sep 2019 11:40:53 +0200 Message-Id: <20190913094053.20753-1-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.17.1 This reverts commit 7ff213193310ef8d0ee5f04f79d791210787ac2c. It turns out that the above commit introduces other problems. For example, calling pm_runtime_set_active() must not be done prior calling pm_runtime_enable() as that makes it fail. This leads to additional problems, such as clock enables being wrongly balanced. Rather than fixing the problem on top, let's start over by doing a revert. Fixes: 7ff213193310 ("mmc: tmio: move runtime PM enablement to the driver implementations") Signed-off-by: Ulf Hansson --- drivers/mmc/host/renesas_sdhi_core.c | 6 ------ drivers/mmc/host/tmio_mmc.c | 5 ----- drivers/mmc/host/tmio_mmc_core.c | 11 ++--------- drivers/mmc/host/uniphier-sd.c | 3 --- 4 files changed, 2 insertions(+), 23 deletions(-) -- 2.17.1 Tested-by: Wolfram Sang diff --git a/drivers/mmc/host/renesas_sdhi_core.c b/drivers/mmc/host/renesas_sdhi_core.c index 64d3b5fb7fe5..4a2872f49a60 100644 --- a/drivers/mmc/host/renesas_sdhi_core.c +++ b/drivers/mmc/host/renesas_sdhi_core.c @@ -774,8 +774,6 @@ int renesas_sdhi_probe(struct platform_device *pdev, /* All SDHI have SDIO status bits which must be 1 */ mmc_data->flags |= TMIO_MMC_SDIO_STATUS_SETBITS; - pm_runtime_enable(&pdev->dev); - ret = renesas_sdhi_clk_enable(host); if (ret) goto efree; @@ -856,8 +854,6 @@ int renesas_sdhi_probe(struct platform_device *pdev, efree: tmio_mmc_host_free(host); - pm_runtime_disable(&pdev->dev); - return ret; } EXPORT_SYMBOL_GPL(renesas_sdhi_probe); @@ -869,8 +865,6 @@ int renesas_sdhi_remove(struct platform_device *pdev) tmio_mmc_host_remove(host); renesas_sdhi_clk_disable(host); - pm_runtime_disable(&pdev->dev); - return 0; } EXPORT_SYMBOL_GPL(renesas_sdhi_remove); diff --git a/drivers/mmc/host/tmio_mmc.c b/drivers/mmc/host/tmio_mmc.c index 8539e10784b4..93e83ad25976 100644 --- a/drivers/mmc/host/tmio_mmc.c +++ b/drivers/mmc/host/tmio_mmc.c @@ -172,8 +172,6 @@ static int tmio_mmc_probe(struct platform_device *pdev) host->mmc->f_max = pdata->hclk; host->mmc->f_min = pdata->hclk / 512; - pm_runtime_enable(&pdev->dev); - ret = tmio_mmc_host_probe(host); if (ret) goto host_free; @@ -193,7 +191,6 @@ static int tmio_mmc_probe(struct platform_device *pdev) tmio_mmc_host_remove(host); host_free: tmio_mmc_host_free(host); - pm_runtime_disable(&pdev->dev); cell_disable: if (cell->disable) cell->disable(pdev); @@ -210,8 +207,6 @@ static int tmio_mmc_remove(struct platform_device *pdev) if (cell->disable) cell->disable(pdev); - pm_runtime_disable(&pdev->dev); - return 0; } diff --git a/drivers/mmc/host/tmio_mmc_core.c b/drivers/mmc/host/tmio_mmc_core.c index 2cb3f951c3e2..8b299c1f0069 100644 --- a/drivers/mmc/host/tmio_mmc_core.c +++ b/drivers/mmc/host/tmio_mmc_core.c @@ -1153,15 +1153,6 @@ void tmio_mmc_host_free(struct tmio_mmc_host *host) } EXPORT_SYMBOL_GPL(tmio_mmc_host_free); -/** - * tmio_mmc_host_probe() - Common probe for all implementations - * @_host: Host to probe - * - * Perform tasks common to all implementations probe functions. - * - * The caller should have called pm_runtime_enable() prior to calling - * the common probe function. - */ int tmio_mmc_host_probe(struct tmio_mmc_host *_host) { struct platform_device *pdev = _host->pdev; @@ -1260,6 +1251,7 @@ int tmio_mmc_host_probe(struct tmio_mmc_host *_host) pm_runtime_set_active(&pdev->dev); pm_runtime_set_autosuspend_delay(&pdev->dev, 50); pm_runtime_use_autosuspend(&pdev->dev); + pm_runtime_enable(&pdev->dev); ret = mmc_add_host(mmc); if (ret) @@ -1295,6 +1287,7 @@ void tmio_mmc_host_remove(struct tmio_mmc_host *host) pm_runtime_dont_use_autosuspend(&pdev->dev); pm_runtime_put_sync(&pdev->dev); + pm_runtime_disable(&pdev->dev); } EXPORT_SYMBOL_GPL(tmio_mmc_host_remove); diff --git a/drivers/mmc/host/uniphier-sd.c b/drivers/mmc/host/uniphier-sd.c index 49aad9a79c18..91a2be41edf6 100644 --- a/drivers/mmc/host/uniphier-sd.c +++ b/drivers/mmc/host/uniphier-sd.c @@ -631,7 +631,6 @@ static int uniphier_sd_probe(struct platform_device *pdev) host->clk_disable = uniphier_sd_clk_disable; host->set_clock = uniphier_sd_set_clock; - pm_runtime_enable(&pdev->dev); ret = uniphier_sd_clk_enable(host); if (ret) goto free_host; @@ -653,7 +652,6 @@ static int uniphier_sd_probe(struct platform_device *pdev) free_host: tmio_mmc_host_free(host); - pm_runtime_disable(&pdev->dev); return ret; } @@ -664,7 +662,6 @@ static int uniphier_sd_remove(struct platform_device *pdev) tmio_mmc_host_remove(host); uniphier_sd_clk_disable(host); - pm_runtime_disable(&pdev->dev); return 0; }