From patchwork Sun Sep 8 10:12:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 173345 Delivered-To: patches@linaro.org Received: by 2002:a05:6e02:ce:0:0:0:0 with SMTP id r14csp3003163ilq; Sun, 8 Sep 2019 03:12:55 -0700 (PDT) X-Received: by 2002:ac2:46d8:: with SMTP id p24mr12365586lfo.58.1567937575498; Sun, 08 Sep 2019 03:12:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567937575; cv=none; d=google.com; s=arc-20160816; b=WB8gpMQexcooX0FpB+29epgBMud0GFeYHv+VnBAyBTAUq9SP0B4g/lo4SK5mJwDc5S qBecSUs89xVXcgT+R38tCgSRdquU1wWndsLygEUgjiKeNdo9Q6qqlrEuiF3EN7irYRqT 8o1sxng+aVXaqcYWXnFf9YrQGEH7r2QuFfO2B+s1QZ7wE4qT5UHksDmz4lVkrMPzp90h Dp2rcVZOUU46Czhd36sHxC5rk47xfRt5IVBgahMQ2S9OD+OEUqNGF10GW2Dr4S13CVhv H9eAto6estLG5bVIl+OInzo5AlhgQ1W0fTN0ppoNQoBDXOGGMRPMpIzELhRrWxumQVQT BoBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=5zrGMk6c5cb0M1x8zsNcOkvdniWaOPlcPy4iCtlrTl4=; b=wVwqT02KDmHxRtCHJpJGaf4ATQmvUjFo2aL2EjIEicu7MGFuZXx6rrOskBFr6IkVxh L5dH57EGgzBBjmY7TR7okL0F/L0HBVuXHNY07wA2HS+SQl/sgEm5Cb1+KZmyVcHAAtRC wTuGWUEy6UYi1HWpvbh5NpdLxVxUHkCzfulqmia57mXjDhHVmqDeYhCVAjSBM97IQDwT KyTbktZ0rqn3XUJt6zNRp82aER4DZm+0rY59y/e3yxV9iHpTncfcILofGkKBsXYfg5J1 bDvZhgJgQdvvb9Mt+Aq7uKcj9vC8ae6Zm6FnEC3pzKaTy7JsLqmcU5zN/dF5TFiEe28l Y2Mg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=vWwSgVO5; 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 b13sor5647503lji.28.2019.09.08.03.12.55 for (Google Transport Security); Sun, 08 Sep 2019 03:12: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=vWwSgVO5; 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:in-reply-to:references; bh=5zrGMk6c5cb0M1x8zsNcOkvdniWaOPlcPy4iCtlrTl4=; b=vWwSgVO5bQmVjTg9XGVOg1JwKfaGOeU5DoEK42mODEMxLoCclaYnnwIseOTMWWHbBh F3E4KzUNzR61+PXOwEw3flA+Ba9KM+Ar9b8d3f4yVvBGDDAcwTswppvM58oyvZ7YCW0+ sapWoQ4VfTRnxTy4UlDX6vFaMZVB6CKJEBlbwurWDpM//fCXRUYZR20x1dAWfSw9S8il QAYYHXScDT82khZgpuDsorpbZJpiyHh8gI1vJk/HkVPEhj80wK1Y0w+xYR1peDezLF4/ dAgMIj0+4xC3qZ0Sl93vDZ02RidwOj0tXOjC6NqKJ7ldmpoixvZ6UQcc/GYX6LILGu0X yXYA== 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:in-reply-to :references; bh=5zrGMk6c5cb0M1x8zsNcOkvdniWaOPlcPy4iCtlrTl4=; b=AGsozGrotb6q2HsBGGo6umD/UlweJ6qUVC/xa+ksUSRV4U6ue/xg/yOCuOPzLARTnk oMAswH2ORxhEaearnF4ylILbrN6+y4ZvwAmyjxnuOXcgJe1RiHacKv39lwReQbF7CFRm XHmR2Al0hAs58h7oafKPpNqQtbhIlhzHSVpOpKJFR/sd/w24bs2kr+Z26gsvyfVYROGO XH/kcpmuaIHMKCztonTt78cLneoRehdzbH2PBcZRcj2tWjch+McjxiX1OaKTZz9Rb3NL QAPOeoCBkYiApkgoU4xH8f6SUgzcqNmuvt6ul1/YUL5V9aM3GUlQupgL+7q6SRpQqlpy qVvQ== X-Gm-Message-State: APjAAAW63P+p6idl5i4oqVT3nbI9QRedefdu3OPA2bE4A3LBnmraudMA Os3738QME7X0PDb7vls1HplWcMX4 X-Google-Smtp-Source: APXvYqyFTCo8tbr+nsWc1VNOXSwNzLmkbiROCceBH4C65Lg3RihNh1XyaLzQ+MfTrmzCbU3uuFshKw== X-Received: by 2002:a2e:874a:: with SMTP id q10mr11554083ljj.187.1567937575164; Sun, 08 Sep 2019 03:12:55 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([185.122.190.73]) by smtp.gmail.com with ESMTPSA id h25sm2444849lfj.81.2019.09.08.03.12.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 Sep 2019 03:12:54 -0700 (PDT) From: Ulf Hansson To: linux-mmc@vger.kernel.org, Ulf Hansson , Adrian Hunter , Douglas Anderson , Matthias Kaehlcke Cc: Shawn Lin , Jaehoon Chung , Yong Mao , Chaotian Jing , linux-kernel@vger.kernel.org Subject: [PATCH v2 10/11] mmc: sdhci: Drop redundant code for SDIO IRQs Date: Sun, 8 Sep 2019 12:12:35 +0200 Message-Id: <20190908101236.2802-11-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190908101236.2802-1-ulf.hansson@linaro.org> References: <20190908101236.2802-1-ulf.hansson@linaro.org> Nowadays sdhci prevents runtime suspend when SDIO IRQs are enabled. However, some variants such as sdhci-esdhc-imx's, tries to allow runtime suspend while having the SDIO IRQs enabled, but without supporting remote wakeups. This support is a bit questionable, especially if the host device have a PM domain attached that can be power gated, but more importantly, the code have also become redundant (which was not the case when it was introduced). Rather than keeping the redundant code around, let's drop it and leave this to be revisited later on. Signed-off-by: Ulf Hansson --- drivers/mmc/host/sdhci-esdhc-imx.c | 34 +++++++++++++----------------- drivers/mmc/host/sdhci.c | 2 +- drivers/mmc/host/sdhci.h | 5 ----- 3 files changed, 16 insertions(+), 25 deletions(-) -- 2.17.1 diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c index 776a94216248..1c988d6a2433 100644 --- a/drivers/mmc/host/sdhci-esdhc-imx.c +++ b/drivers/mmc/host/sdhci-esdhc-imx.c @@ -1666,12 +1666,10 @@ static int sdhci_esdhc_runtime_suspend(struct device *dev) if (host->tuning_mode != SDHCI_TUNING_MODE_3) mmc_retune_needed(host->mmc); - if (!sdhci_sdio_irq_enabled(host)) { - imx_data->actual_clock = host->mmc->actual_clock; - esdhc_pltfm_set_clock(host, 0); - clk_disable_unprepare(imx_data->clk_per); - clk_disable_unprepare(imx_data->clk_ipg); - } + imx_data->actual_clock = host->mmc->actual_clock; + esdhc_pltfm_set_clock(host, 0); + clk_disable_unprepare(imx_data->clk_per); + clk_disable_unprepare(imx_data->clk_ipg); clk_disable_unprepare(imx_data->clk_ahb); if (imx_data->socdata->flags & ESDHC_FLAG_PMQOS) @@ -1695,15 +1693,15 @@ static int sdhci_esdhc_runtime_resume(struct device *dev) if (err) goto remove_pm_qos_request; - if (!sdhci_sdio_irq_enabled(host)) { - err = clk_prepare_enable(imx_data->clk_per); - if (err) - goto disable_ahb_clk; - err = clk_prepare_enable(imx_data->clk_ipg); - if (err) - goto disable_per_clk; - esdhc_pltfm_set_clock(host, imx_data->actual_clock); - } + err = clk_prepare_enable(imx_data->clk_per); + if (err) + goto disable_ahb_clk; + + err = clk_prepare_enable(imx_data->clk_ipg); + if (err) + goto disable_per_clk; + + esdhc_pltfm_set_clock(host, imx_data->actual_clock); err = sdhci_runtime_resume_host(host, 0); if (err) @@ -1715,11 +1713,9 @@ static int sdhci_esdhc_runtime_resume(struct device *dev) return err; disable_ipg_clk: - if (!sdhci_sdio_irq_enabled(host)) - clk_disable_unprepare(imx_data->clk_ipg); + clk_disable_unprepare(imx_data->clk_ipg); disable_per_clk: - if (!sdhci_sdio_irq_enabled(host)) - clk_disable_unprepare(imx_data->clk_per); + clk_disable_unprepare(imx_data->clk_per); disable_ahb_clk: clk_disable_unprepare(imx_data->clk_ahb); remove_pm_qos_request: diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index efa6cda8c991..4c4285387b47 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c @@ -3048,7 +3048,7 @@ static irqreturn_t sdhci_irq(int irq, void *dev_id) spin_lock(&host->lock); - if (host->runtime_suspended && !sdhci_sdio_irq_enabled(host)) { + if (host->runtime_suspended) { spin_unlock(&host->lock); return IRQ_NONE; } diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h index cf3d1ed91909..8effaac61c3a 100644 --- a/drivers/mmc/host/sdhci.h +++ b/drivers/mmc/host/sdhci.h @@ -753,11 +753,6 @@ static inline void sdhci_read_caps(struct sdhci_host *host) __sdhci_read_caps(host, NULL, NULL, NULL); } -static inline bool sdhci_sdio_irq_enabled(struct sdhci_host *host) -{ - return !!(host->flags & SDHCI_SDIO_IRQ_ENABLED); -} - u16 sdhci_calc_clk(struct sdhci_host *host, unsigned int clock, unsigned int *actual_clock); void sdhci_set_clock(struct sdhci_host *host, unsigned int clock);