Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mmc: core: Don't return an error for CD/WP GPIOs when GPIOLIB is unset

When CONFIG_GPIOLIB is unset, its stubs will return -ENOSYS. That means
when the mmc core parses DT for CD/WP GPIOs via mmc_of_parse(), -ENOSYS
becomes propagated to the caller. Typically this means that the mmc host
driver fails to probe.

As the CD/WP GPIOs are already treated as optional, let's extend that to
cover the case when CONFIG_GPIOLIB is unset.

Reported-by: Michal Simek <michal.simek@xilinx.com>
Fixes: 16b23787fc70 ("mmc: sdhci-of-arasan: Call OF parsing for MMC")
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Tested-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Venu Byravarasu <vbyravarasu@nvidia.com>

+2 -2
+2 -2
drivers/mmc/core/host.c
··· 457 457 0, &cd_gpio_invert); 458 458 if (!ret) 459 459 dev_info(host->parent, "Got CD GPIO\n"); 460 - else if (ret != -ENOENT) 460 + else if (ret != -ENOENT && ret != -ENOSYS) 461 461 return ret; 462 462 463 463 /* ··· 481 481 ret = mmc_gpiod_request_ro(host, "wp", 0, false, 0, &ro_gpio_invert); 482 482 if (!ret) 483 483 dev_info(host->parent, "Got WP GPIO\n"); 484 - else if (ret != -ENOENT) 484 + else if (ret != -ENOENT && ret != -ENOSYS) 485 485 return ret; 486 486 487 487 if (of_property_read_bool(np, "disable-wp"))