linux-mmc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mmc: core: Don't return an error for CD/WP GPIOs when GPIOLIB is unset
@ 2015-09-14  8:56 Ulf Hansson
  2015-09-14  9:53 ` Venu Byravarasu
  0 siblings, 1 reply; 3+ messages in thread
From: Ulf Hansson @ 2015-09-14  8:56 UTC (permalink / raw)
  To: linux-mmc, Ulf Hansson; +Cc: Michal Simek

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>
---
 drivers/mmc/core/host.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c
index abd933b..ad11425 100644
--- a/drivers/mmc/core/host.c
+++ b/drivers/mmc/core/host.c
@@ -457,7 +457,7 @@ int mmc_of_parse(struct mmc_host *host)
 					   0, &cd_gpio_invert);
 		if (!ret)
 			dev_info(host->parent, "Got CD GPIO\n");
-		else if (ret != -ENOENT)
+		else if (ret != -ENOENT && ret != ENOSYS)
 			return ret;
 
 		/*
@@ -481,7 +481,7 @@ int mmc_of_parse(struct mmc_host *host)
 	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)
+	else if (ret != -ENOENT && ret != ENOSYS)
 		return ret;
 
 	if (of_property_read_bool(np, "disable-wp"))
-- 
1.9.1


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

* RE: [PATCH] mmc: core: Don't return an error for CD/WP GPIOs when GPIOLIB is unset
  2015-09-14  8:56 [PATCH] mmc: core: Don't return an error for CD/WP GPIOs when GPIOLIB is unset Ulf Hansson
@ 2015-09-14  9:53 ` Venu Byravarasu
  2015-09-14 10:19   ` Michal Simek
  0 siblings, 1 reply; 3+ messages in thread
From: Venu Byravarasu @ 2015-09-14  9:53 UTC (permalink / raw)
  To: Ulf Hansson, linux-mmc@vger.kernel.org; +Cc: Michal Simek, Venu Byravarasu



> -----Original Message-----
> From: linux-mmc-owner@vger.kernel.org [mailto:linux-mmc-
> owner@vger.kernel.org] On Behalf Of Ulf Hansson
> Sent: Monday, September 14, 2015 2:27 PM
> To: linux-mmc@vger.kernel.org; Ulf Hansson
> Cc: Michal Simek
> Subject: [PATCH] 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>
> ---
>  drivers/mmc/core/host.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c index
> abd933b..ad11425 100644
> --- a/drivers/mmc/core/host.c
> +++ b/drivers/mmc/core/host.c
> @@ -457,7 +457,7 @@ int mmc_of_parse(struct mmc_host *host)
>  					   0, &cd_gpio_invert);
>  		if (!ret)
>  			dev_info(host->parent, "Got CD GPIO\n");
> -		else if (ret != -ENOENT)
> +		else if (ret != -ENOENT && ret != ENOSYS)

Seems "-" is missing before "ENOSYS".

>  			return ret;
> 
>  		/*
> @@ -481,7 +481,7 @@ int mmc_of_parse(struct mmc_host *host)
>  	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)
> +	else if (ret != -ENOENT && ret != ENOSYS)

Same here.

>  		return ret;
> 
>  	if (of_property_read_bool(np, "disable-wp"))
> --
> 1.9.1
> 
> --
> 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
-----------------------------------------------------------------------------------
This email message is for the sole use of the intended recipient(s) and may contain
confidential information.  Any unauthorized review, use, disclosure or distribution
is prohibited.  If you are not the intended recipient, please contact the sender by
reply email and destroy all copies of the original message.
-----------------------------------------------------------------------------------

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

* Re: [PATCH] mmc: core: Don't return an error for CD/WP GPIOs when GPIOLIB is unset
  2015-09-14  9:53 ` Venu Byravarasu
@ 2015-09-14 10:19   ` Michal Simek
  0 siblings, 0 replies; 3+ messages in thread
From: Michal Simek @ 2015-09-14 10:19 UTC (permalink / raw)
  To: Venu Byravarasu, Ulf Hansson, linux-mmc@vger.kernel.org; +Cc: Michal Simek

On 09/14/2015 11:53 AM, Venu Byravarasu wrote:
> 
> 
>> -----Original Message-----
>> From: linux-mmc-owner@vger.kernel.org [mailto:linux-mmc-
>> owner@vger.kernel.org] On Behalf Of Ulf Hansson
>> Sent: Monday, September 14, 2015 2:27 PM
>> To: linux-mmc@vger.kernel.org; Ulf Hansson
>> Cc: Michal Simek
>> Subject: [PATCH] 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>
>> ---
>>  drivers/mmc/core/host.c | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c index
>> abd933b..ad11425 100644
>> --- a/drivers/mmc/core/host.c
>> +++ b/drivers/mmc/core/host.c
>> @@ -457,7 +457,7 @@ int mmc_of_parse(struct mmc_host *host)
>>  					   0, &cd_gpio_invert);
>>  		if (!ret)
>>  			dev_info(host->parent, "Got CD GPIO\n");
>> -		else if (ret != -ENOENT)
>> +		else if (ret != -ENOENT && ret != ENOSYS)
> 
> Seems "-" is missing before "ENOSYS".
> 
>>  			return ret;
>>
>>  		/*
>> @@ -481,7 +481,7 @@ int mmc_of_parse(struct mmc_host *host)
>>  	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)
>> +	else if (ret != -ENOENT && ret != ENOSYS)
> 
> Same here.


yes. With -ENOSYS it is working fine.

For v2 with this fix here is my
Tested-by: Michal Simek <michal.simek@xilinx.com>

Thanks,
Michal


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

end of thread, other threads:[~2015-09-14 10:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-14  8:56 [PATCH] mmc: core: Don't return an error for CD/WP GPIOs when GPIOLIB is unset Ulf Hansson
2015-09-14  9:53 ` Venu Byravarasu
2015-09-14 10:19   ` Michal Simek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).