From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
To: Ulf Hansson <ulf.hansson@linaro.org>
Cc: linux-mmc <linux-mmc@vger.kernel.org>,
Ian Molton <ian@mnementh.co.uk>,
Linux-sh list <linux-sh@vger.kernel.org>
Subject: Re: [PATCH] tmio_mmc_pio: test TMIO_MMC_WRPROTECT_DISABLE earlier
Date: Tue, 29 Sep 2015 17:05:01 +0300 [thread overview]
Message-ID: <560A9A8D.1080808@cogentembedded.com> (raw)
In-Reply-To: <CAPDyKFrFfN9ty25=rGrQ_TuaSDG-qtM8Dd_HxhB4oW+mhNM4vQ@mail.gmail.com>
Hello.
On 09/29/2015 01:22 PM, Ulf Hansson wrote:
> [...]
>>> Actually this change won't have the desired effect, as the mmc core
>>> already done a pm_runtime_get_sync() since it has claimed the mmc
>>> host[1].
>>
>>> I do realize that most drivers are still maintaining the
>>> pm_runtime_get|put() calls, but in most cases that's not needed any
>>> more.
>>
>> Hm, OK. Should be OK to remove the RPM dances from at least this
>> particular driver, right?
>
> In most cases, yes.
>
> There may be corner cases where the host is accessed without having
> the mmc core involved (and thus the host hasn't been claimed).
OK, I'll try to look into this further...
>>> [1]
>>> commit 9250aea76bfc ("mmc: core: Enable runtime PM management of host
>>> devices")
>>
>> Looking at the code, the following fragment of mmc_attach_sd() doesn't
>> make much sense to me:
>>
>> mmc_release_host(host);
>> err = mmc_add_card(host->card);
>> mmc_claim_host(host);
>> if (err)
>> goto remove_card;
>>
>> return 0;
>>
>> remove_card:
>> mmc_release_host(host);
>> mmc_remove_card(host->card);
>> host->card = NULL;
>> mmc_claim_host(host);
>>
>> Why claim the host and immediately release it on mmc_add_card() error?
>> Can we only claim on success and save a call here?
> You are right, we can simplify the sequence!
OK, what about calling mmc_remove_card() on mmc_add_card() failure?
Isn't it also superfluous?
> Do you want to send a patch?
Yes, I have it almost ready...
> Actually, it's similar for mmc_attach_mmc()...
Hm, will look into this case as well...
> Kind regards
> Uffe
MBR, Sergei
WARNING: multiple messages have this Message-ID (diff)
From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
To: Ulf Hansson <ulf.hansson@linaro.org>
Cc: linux-mmc <linux-mmc@vger.kernel.org>,
Ian Molton <ian@mnementh.co.uk>,
Linux-sh list <linux-sh@vger.kernel.org>
Subject: Re: [PATCH] tmio_mmc_pio: test TMIO_MMC_WRPROTECT_DISABLE earlier
Date: Tue, 29 Sep 2015 14:05:01 +0000 [thread overview]
Message-ID: <560A9A8D.1080808@cogentembedded.com> (raw)
In-Reply-To: <CAPDyKFrFfN9ty25=rGrQ_TuaSDG-qtM8Dd_HxhB4oW+mhNM4vQ@mail.gmail.com>
Hello.
On 09/29/2015 01:22 PM, Ulf Hansson wrote:
> [...]
>>> Actually this change won't have the desired effect, as the mmc core
>>> already done a pm_runtime_get_sync() since it has claimed the mmc
>>> host[1].
>>
>>> I do realize that most drivers are still maintaining the
>>> pm_runtime_get|put() calls, but in most cases that's not needed any
>>> more.
>>
>> Hm, OK. Should be OK to remove the RPM dances from at least this
>> particular driver, right?
>
> In most cases, yes.
>
> There may be corner cases where the host is accessed without having
> the mmc core involved (and thus the host hasn't been claimed).
OK, I'll try to look into this further...
>>> [1]
>>> commit 9250aea76bfc ("mmc: core: Enable runtime PM management of host
>>> devices")
>>
>> Looking at the code, the following fragment of mmc_attach_sd() doesn't
>> make much sense to me:
>>
>> mmc_release_host(host);
>> err = mmc_add_card(host->card);
>> mmc_claim_host(host);
>> if (err)
>> goto remove_card;
>>
>> return 0;
>>
>> remove_card:
>> mmc_release_host(host);
>> mmc_remove_card(host->card);
>> host->card = NULL;
>> mmc_claim_host(host);
>>
>> Why claim the host and immediately release it on mmc_add_card() error?
>> Can we only claim on success and save a call here?
> You are right, we can simplify the sequence!
OK, what about calling mmc_remove_card() on mmc_add_card() failure?
Isn't it also superfluous?
> Do you want to send a patch?
Yes, I have it almost ready...
> Actually, it's similar for mmc_attach_mmc()...
Hm, will look into this case as well...
> Kind regards
> Uffe
MBR, Sergei
next prev parent reply other threads:[~2015-09-29 14:05 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-23 23:58 [PATCH] tmio_mmc_pio: test TMIO_MMC_WRPROTECT_DISABLE earlier Sergei Shtylyov
2015-09-23 23:58 ` Sergei Shtylyov
2015-09-24 7:04 ` Geert Uytterhoeven
2015-09-24 7:04 ` Geert Uytterhoeven
2015-09-25 20:24 ` Ulf Hansson
2015-09-25 20:24 ` Ulf Hansson
2015-09-25 22:13 ` Sergei Shtylyov
2015-09-25 22:13 ` Sergei Shtylyov
2015-09-29 10:22 ` Ulf Hansson
2015-09-29 10:22 ` Ulf Hansson
2015-09-29 14:05 ` Sergei Shtylyov [this message]
2015-09-29 14:05 ` Sergei Shtylyov
2015-09-30 10:07 ` Ulf Hansson
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=560A9A8D.1080808@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 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.