Re: [PATCH] mmc: core: do not abort if wp is disabled

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2015年03月13日 17:50, Ulf Hansson wrote:
On 13 March 2015 at 09:08, Jun Nie <jun.nie@xxxxxxxxxx> 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@xxxxxxxxxx>

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@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux