diff mbox

mmc: core: do not abort if wp is disabled

Message ID 1426234133-5889-1-git-send-email-jun.nie@linaro.org
State New
Headers show

Commit Message

Jun Nie March 13, 2015, 8:08 a.m. UTC
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>

Comments

Ulf Hansson March 13, 2015, 9:50 a.m. UTC | #1
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
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Jun Nie March 13, 2015, 10:22 a.m. UTC | #2
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
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

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)