From: Ulf Hansson <ulf.hansson@linaro.org> To: linux-mmc@vger.kernel.org, Ulf Hansson <ulf.hansson@linaro.org>, Adrian Hunter <adrian.hunter@intel.com>, Douglas Anderson <dianders@chromium.org> Cc: Brian Norris <briannorris@chromium.org>, Shawn Lin <shawn.lin@rock-chips.com>, Guenter Roeck <groeck@chromium.org>, Heiko Stuebner <heiko@sntech.de>, Kalle Valo <kvalo@codeaurora.org>, Arend Van Spriel <arend.vanspriel@broadcom.com>, linux-wireless@vger.kernel.org Subject: [PATCH 5/7] mmc: sdio: Don't re-initialize powered-on removable SDIO cards at resume Date: Tue, 18 Jun 2019 17:34:46 +0200 [thread overview] Message-ID: <20190618153448.27145-6-ulf.hansson@linaro.org> (raw) In-Reply-To: <20190618153448.27145-1-ulf.hansson@linaro.org> It looks like the original idea behind always doing a re-initialization of a removable SDIO card during system resume in mmc_sdio_resume(), is to try to play safe to detect whether the card has been removed. However, this seems like a really a bad idea as it will most likely screw things up, especially when the card is expected to remain powered on during system suspend by the SDIO func driver. Let's fix this, simply by trusting that the detect work checks if the card is alive and inserted, which is being scheduled at the PM_POST_SUSPEND notification anyway. Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> --- drivers/mmc/core/sdio.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/mmc/core/sdio.c b/drivers/mmc/core/sdio.c index a9bfcae8db5b..945416c53b56 100644 --- a/drivers/mmc/core/sdio.c +++ b/drivers/mmc/core/sdio.c @@ -982,7 +982,11 @@ static int mmc_sdio_resume(struct mmc_host *host) /* Basic card reinitialization. */ mmc_claim_host(host); - /* Restore power if needed */ + /* + * Restore power and reinitialize the card when needed. Note that a + * removable card is checked from a detect work later on in the resume + * process. + */ if (!mmc_card_keep_power(host)) { mmc_power_up(host, host->card->ocr); /* @@ -996,12 +1000,8 @@ static int mmc_sdio_resume(struct mmc_host *host) pm_runtime_set_active(&host->card->dev); pm_runtime_enable(&host->card->dev); } - } - - /* No need to reinitialize powered-resumed nonremovable cards */ - if (mmc_card_is_removable(host) || !mmc_card_keep_power(host)) { - err = mmc_sdio_reinit_card(host, mmc_card_keep_power(host)); - } else if (mmc_card_keep_power(host) && mmc_card_wake_sdio_irq(host)) { + err = mmc_sdio_reinit_card(host, 0); + } else if (mmc_card_wake_sdio_irq(host)) { /* We may have switched to 1-bit mode during suspend */ err = sdio_enable_4bit_bus(host->card); } -- 2.17.1
WARNING: multiple messages have this Message-ID (diff)
From: Ulf Hansson <ulf.hansson-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> To: linux-mmc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Ulf Hansson <ulf.hansson-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>, Adrian Hunter <adrian.hunter-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>, Douglas Anderson <dianders-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org> Cc: Brian Norris <briannorris-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>, Shawn Lin <shawn.lin-TNX95d0MmH7DzftRWevZcw@public.gmane.org>, Guenter Roeck <groeck-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>, Heiko Stuebner <heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org>, Kalle Valo <kvalo-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>, Arend Van Spriel <arend.vanspriel-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>, linux-wireless-u79uwXL29TY76Z2rM5mHXA@public.gmane.org Subject: [PATCH 5/7] mmc: sdio: Don't re-initialize powered-on removable SDIO cards at resume Date: Tue, 18 Jun 2019 17:34:46 +0200 [thread overview] Message-ID: <20190618153448.27145-6-ulf.hansson@linaro.org> (raw) In-Reply-To: <20190618153448.27145-1-ulf.hansson-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> It looks like the original idea behind always doing a re-initialization of a removable SDIO card during system resume in mmc_sdio_resume(), is to try to play safe to detect whether the card has been removed. However, this seems like a really a bad idea as it will most likely screw things up, especially when the card is expected to remain powered on during system suspend by the SDIO func driver. Let's fix this, simply by trusting that the detect work checks if the card is alive and inserted, which is being scheduled at the PM_POST_SUSPEND notification anyway. Signed-off-by: Ulf Hansson <ulf.hansson-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> --- drivers/mmc/core/sdio.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/mmc/core/sdio.c b/drivers/mmc/core/sdio.c index a9bfcae8db5b..945416c53b56 100644 --- a/drivers/mmc/core/sdio.c +++ b/drivers/mmc/core/sdio.c @@ -982,7 +982,11 @@ static int mmc_sdio_resume(struct mmc_host *host) /* Basic card reinitialization. */ mmc_claim_host(host); - /* Restore power if needed */ + /* + * Restore power and reinitialize the card when needed. Note that a + * removable card is checked from a detect work later on in the resume + * process. + */ if (!mmc_card_keep_power(host)) { mmc_power_up(host, host->card->ocr); /* @@ -996,12 +1000,8 @@ static int mmc_sdio_resume(struct mmc_host *host) pm_runtime_set_active(&host->card->dev); pm_runtime_enable(&host->card->dev); } - }
next prev parent reply other threads:[~2019-06-18 15:35 UTC|newest] Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-06-18 15:34 [PATCH 0/7] mmc: sdio: Various fixes/improvements for SDIO PM Ulf Hansson 2019-06-18 15:34 ` Ulf Hansson 2019-06-18 15:34 ` [PATCH 1/7] mmc: sdio: Turn sdio_run_irqs() into static Ulf Hansson 2019-06-18 15:34 ` Ulf Hansson 2019-06-19 0:17 ` Doug Anderson 2019-06-19 0:17 ` Doug Anderson 2019-06-18 15:34 ` [PATCH 2/7] mmc: sdio: Drop mmc_claim|release_host() in mmc_sdio_power_restore() Ulf Hansson 2019-06-18 15:34 ` Ulf Hansson 2019-07-09 21:25 ` Doug Anderson 2019-07-09 21:25 ` Doug Anderson 2019-06-18 15:34 ` [PATCH 3/7] mmc: sdio: Move comment about re-initialization to mmc_sdio_reinit_card() Ulf Hansson 2019-06-18 15:34 ` Ulf Hansson 2019-07-09 21:27 ` Doug Anderson 2019-07-09 21:27 ` Doug Anderson 2019-06-18 15:34 ` [PATCH 4/7] mmc: sdio: Drop powered-on re-init at runtime resume and HW reset Ulf Hansson 2019-06-18 15:34 ` Ulf Hansson 2019-07-04 0:01 ` Doug Anderson 2019-07-04 0:01 ` Doug Anderson 2019-07-08 10:53 ` Ulf Hansson 2019-07-08 10:53 ` Ulf Hansson 2019-07-08 21:12 ` Doug Anderson 2019-07-08 21:12 ` Doug Anderson 2019-07-09 12:01 ` Ulf Hansson 2019-07-09 12:01 ` Ulf Hansson 2019-07-09 23:35 ` Doug Anderson 2019-07-09 23:35 ` Doug Anderson 2019-06-18 15:34 ` Ulf Hansson [this message] 2019-06-18 15:34 ` [PATCH 5/7] mmc: sdio: Don't re-initialize powered-on removable SDIO cards at resume Ulf Hansson 2019-07-09 21:26 ` Doug Anderson 2019-07-09 21:26 ` Doug Anderson 2019-06-18 15:34 ` [PATCH 6/7] mmc: sdio: Drop unused in-parameter to mmc_sdio_reinit_card() Ulf Hansson 2019-06-18 15:34 ` Ulf Hansson 2019-07-09 21:29 ` Doug Anderson 2019-07-09 21:29 ` Doug Anderson 2019-06-18 15:34 ` [PATCH 7/7] mmc: sdio: Drop unused in-parameter from mmc_sdio_init_card() Ulf Hansson 2019-06-18 15:34 ` Ulf Hansson 2019-07-09 21:31 ` Doug Anderson 2019-07-09 21:31 ` Doug Anderson 2019-06-20 13:43 ` [PATCH 0/7] mmc: sdio: Various fixes/improvements for SDIO PM Ulf Hansson 2019-06-20 13:43 ` Ulf Hansson
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20190618153448.27145-6-ulf.hansson@linaro.org \ --to=ulf.hansson@linaro.org \ --cc=adrian.hunter@intel.com \ --cc=arend.vanspriel@broadcom.com \ --cc=briannorris@chromium.org \ --cc=dianders@chromium.org \ --cc=groeck@chromium.org \ --cc=heiko@sntech.de \ --cc=kvalo@codeaurora.org \ --cc=linux-mmc@vger.kernel.org \ --cc=linux-wireless@vger.kernel.org \ --cc=shawn.lin@rock-chips.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.