Skip to contentSkip to conversation

mmc: core: do not abort if wp is disabled

PATCH In review Jun Nie 2 participants 3 messages Mar 13, 2015 MMC, SD and SDIO

lore
Share & tools
lore

Jun Nie

author
#0 lore raw

PATCH 1/1 mmc: core: do not abort if wp is disabled

Do not abort probe due to no detection to write protection pin, if host specify disable-wp.

drivers/mmc/core/host.c +8 -5
index 8be0df7..30ed253 100644
@@ -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)
Signature · 1 line
1.9.1
#1 lore raw
Quoted 10 lines · Jun Nie

Do not abort probe due to no detection to write protection pin, if host specify disable-wp.

drivers/mmc/core/host.c +0 -0
index 8be0df7..30ed253 100644

drivers/mmc/core/host.c int mmc_of_parse(struct mmc_host *host) · line 400

Quoted 7 lines
drivers/mmc/core/host.c +0 -4
@@ -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?

Quoted 13 lines
drivers/mmc/core/host.c +8 -2
-               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)
--
Quoted 2 lines

1.9.1

Kind regards
Uffe

author
#2 lore raw
Quoted 21 lines · Ulf Hansson
Quoted 10 lines · Jun Nie

Do not abort probe due to no detection to write protection pin, if host specify disable-wp.

drivers/mmc/core/host.c +0 -0
index 8be0df7..30ed253 100644

drivers/mmc/core/host.c int mmc_of_parse(struct mmc_host *host) · line 400

Quoted 7 lines
drivers/mmc/core/host.c +0 -4
@@ -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.

Quoted 3 lines

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!

Quoted 10 lines
Quoted 10 lines
drivers/mmc/core/host.c +8 -1
-               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;
+       }
 
Quoted 9 lines
Quoted 5 lines
drivers/mmc/core/host.c +0 -1
         /* See the comment on CD inversion above */
         if (ro_cap_invert ^ ro_gpio_invert)
--

1.9.1

Kind regards
Uffe

B.R.
Jun