From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
To: linux-mmc@vger.kernel.org, ulf.hansson@linaro.org, ian@mnementh.co.uk
Cc: linux-sh@vger.kernel.org
Subject: [PATCH] tmio_mmc_pio: test TMIO_MMC_WRPROTECT_DISABLE earlier
Date: Thu, 24 Sep 2015 02:58:23 +0300 [thread overview]
Message-ID: <1513691.2yatcrs42i@wasted.cogentembedded.com> (raw)
There seems to be no sense in the runtime PM calls when the actual register
read is suppressed by the TMIO_MMC_WRPROTECT_DISABLE flag. Check that flag
before trying to read the register and thus doing the runtime PM dance...
While at it, kill useless local variable and add empty line after declarations.
Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
---
The patch is against Ulf Hansson's 'mmc.git' repo's 'next' branch.
drivers/mmc/host/tmio_mmc_pio.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
Index: mmc/drivers/mmc/host/tmio_mmc_pio.c
===================================================================
--- mmc.orig/drivers/mmc/host/tmio_mmc_pio.c
+++ mmc/drivers/mmc/host/tmio_mmc_pio.c
@@ -988,14 +988,16 @@ static void tmio_mmc_set_ios(struct mmc_
static int tmio_mmc_get_ro(struct mmc_host *mmc)
{
struct tmio_mmc_host *host = mmc_priv(mmc);
- struct tmio_mmc_data *pdata = host->pdata;
int ret = mmc_gpio_get_ro(mmc);
+
if (ret >= 0)
return ret;
+ if (host->pdata->flags & TMIO_MMC_WRPROTECT_DISABLE)
+ return 0;
+
pm_runtime_get_sync(mmc_dev(mmc));
- ret = !((pdata->flags & TMIO_MMC_WRPROTECT_DISABLE) ||
- (sd_ctrl_read32(host, CTL_STATUS) & TMIO_STAT_WRPROTECT));
+ ret = !(sd_ctrl_read32(host, CTL_STATUS) & TMIO_STAT_WRPROTECT);
pm_runtime_mark_last_busy(mmc_dev(mmc));
pm_runtime_put_autosuspend(mmc_dev(mmc));
next reply other threads:[~2015-09-23 23:58 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-23 23:58 Sergei Shtylyov [this message]
2015-09-24 7:04 ` [PATCH] tmio_mmc_pio: test TMIO_MMC_WRPROTECT_DISABLE earlier Geert Uytterhoeven
2015-09-25 20:24 ` Ulf Hansson
2015-09-25 22:13 ` Sergei Shtylyov
2015-09-29 10:22 ` Ulf Hansson
2015-09-29 14:05 ` Sergei Shtylyov
2015-09-30 10:07 ` 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=1513691.2yatcrs42i@wasted.cogentembedded.com \
--to=sergei.shtylyov@cogentembedded.com \
--cc=ian@mnementh.co.uk \
--cc=linux-mmc@vger.kernel.org \
--cc=linux-sh@vger.kernel.org \
--cc=ulf.hansson@linaro.org \
/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: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox