linux-mmc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jun Nie <jun.nie@linaro.org>
To: Ulf Hansson <ulf.hansson@linaro.org>
Cc: linux-mmc <linux-mmc@vger.kernel.org>,
	Chris Ball <chris@printf.net>, Shawn Guo <shawn.guo@linaro.org>
Subject: Re: [PATCH] mmc: core: do not abort if wp is disabled
Date: Fri, 13 Mar 2015 18:22:58 +0800	[thread overview]
Message-ID: <5502BA82.8090604@linaro.org> (raw)
In-Reply-To: <CAPDyKFpU2rz4ZuDiyhFR=7BRS2HCySCukcSr-NN5A4gYnGiKYw@mail.gmail.com>

On 2015年03月13日 17:50, Ulf Hansson wrote:
> On 13 March 2015 at 09:08, Jun Nie <jun.nie@linaro.org> wrote:
>> Do not abort probe due to no detection to write protection pin,
>> if host specify disable-wp.
>>
>> Signed-off-by: Jun Nie <jun.nie@linaro.org>
>>
>> diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c
>> index 8be0df7..30ed253 100644
>> --- a/drivers/mmc/core/host.c
>> +++ b/drivers/mmc/core/host.c
>> @@ -394,11 +394,14 @@ int mmc_of_parse(struct mmc_host *host)
>>          /* Parse Write Protection */
>>          ro_cap_invert = of_property_read_bool(np, "wp-inverted");
>>
>> -       ret = mmc_gpiod_request_ro(host, "wp", 0, false, 0, &ro_gpio_invert);
>> -       if (!ret)
>> -               dev_info(host->parent, "Got WP GPIO\n");
>> -       else if (ret != -ENOENT)
>
> I thought this else statement already took care of your issue.
>
> The host driver shouldn't get an error code from mmc_of_parse() if the
> optional "wp-gpio" doesn't exist. Right?
>
Right, in GPIO lib built case. Just find I need enable GPIO_LIB config :)
Thanks for reminding!

>> -               return ret;
>> +       if (!of_get_property(np, "disable-wp", NULL)) {
>> +               ret = mmc_gpiod_request_ro(host, "wp", 0, false, 0,
>> +                                          &ro_gpio_invert);
>> +               if (!ret)
>> +                       dev_info(host->parent, "Got WP GPIO\n");
>> +               else if (ret != -ENOENT)
>> +                       return ret;
>> +       }
>>
>>          /* See the comment on CD inversion above */
>>          if (ro_cap_invert ^ ro_gpio_invert)
>> --
>> 1.9.1
>>
>
> Kind regards
> Uffe
>
B.R.
Jun

      reply	other threads:[~2015-03-13 10:23 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-13  8:08 [PATCH] mmc: core: do not abort if wp is disabled Jun Nie
2015-03-13  9:50 ` Ulf Hansson
2015-03-13 10:22   ` Jun Nie [this message]

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=5502BA82.8090604@linaro.org \
    --to=jun.nie@linaro.org \
    --cc=chris@printf.net \
    --cc=linux-mmc@vger.kernel.org \
    --cc=shawn.guo@linaro.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;
as well as URLs for NNTP newsgroup(s).