All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mmc: core: do not abort if wp is disabled
@ 2015-03-13  8:08 Jun Nie
  2015-03-13  9:50 ` Ulf Hansson
  0 siblings, 1 reply; 3+ messages in thread
From: Jun Nie @ 2015-03-13  8:08 UTC (permalink / raw)
  To: linux-mmc, ulf.hansson, chris, shawn.guo, jun.nie

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)
-		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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] mmc: core: do not abort if wp is disabled
  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
  0 siblings, 1 reply; 3+ messages in thread
From: Ulf Hansson @ 2015-03-13  9:50 UTC (permalink / raw)
  To: Jun Nie; +Cc: linux-mmc, Chris Ball, Shawn Guo

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?

> -               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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] mmc: core: do not abort if wp is disabled
  2015-03-13  9:50 ` Ulf Hansson
@ 2015-03-13 10:22   ` Jun Nie
  0 siblings, 0 replies; 3+ messages in thread
From: Jun Nie @ 2015-03-13 10:22 UTC (permalink / raw)
  To: Ulf Hansson; +Cc: linux-mmc, Chris Ball, Shawn Guo

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-03-13 10:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 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.