* [PATCH V2] mmc: pwrseq_simple: Make reset-gpios optional to match doc
@ 2016-01-20 15:08 Martin Fuzzey
2016-01-21 13:23 ` Ulf Hansson
0 siblings, 1 reply; 2+ messages in thread
From: Martin Fuzzey @ 2016-01-20 15:08 UTC (permalink / raw)
To: linux-arm-kernel
The DT binding doc says reset-gpios is an optional property but the code
currently bails out if it is omitted.
This is a regression since it breaks previously working device trees.
Fix it by restoring the original documented behaviour.
Fixes: ce037275861e ("mmc: pwrseq_simple: use GPIO descriptors array API")
Tested-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Martin Fuzzey <mfuzzey@parkeon.com>
---
V2:
Fix review comments by Ulf Hansson:
* Handle -ENOSYS case when CONFIG_GPIOLIB not selected
This causes checkpatch to complain with
"WARNING: ENOSYS means 'invalid syscall nr' and nothing else"
but I guess that's ok here.
* Update patch description to make it clear this is a regression fix
* Add Fixes tag
Add Tested-by tag from Tony Lingdren
---
drivers/mmc/core/pwrseq_simple.c | 22 ++++++++++++++--------
1 file changed, 14 insertions(+), 8 deletions(-)
diff --git a/drivers/mmc/core/pwrseq_simple.c b/drivers/mmc/core/pwrseq_simple.c
index d10538b..96f45ca 100644
--- a/drivers/mmc/core/pwrseq_simple.c
+++ b/drivers/mmc/core/pwrseq_simple.c
@@ -29,15 +29,18 @@ struct mmc_pwrseq_simple {
static void mmc_pwrseq_simple_set_gpios_value(struct mmc_pwrseq_simple *pwrseq,
int value)
{
- int i;
struct gpio_descs *reset_gpios = pwrseq->reset_gpios;
- int values[reset_gpios->ndescs];
- for (i = 0; i < reset_gpios->ndescs; i++)
- values[i] = value;
+ if (!IS_ERR(reset_gpios)) {
+ int i;
+ int values[reset_gpios->ndescs];
- gpiod_set_array_value_cansleep(reset_gpios->ndescs, reset_gpios->desc,
- values);
+ for (i = 0; i < reset_gpios->ndescs; i++)
+ values[i] = value;
+
+ gpiod_set_array_value_cansleep(
+ reset_gpios->ndescs, reset_gpios->desc, values);
+ }
}
static void mmc_pwrseq_simple_pre_power_on(struct mmc_host *host)
@@ -79,7 +82,8 @@ static void mmc_pwrseq_simple_free(struct mmc_host *host)
struct mmc_pwrseq_simple *pwrseq = container_of(host->pwrseq,
struct mmc_pwrseq_simple, pwrseq);
- gpiod_put_array(pwrseq->reset_gpios);
+ if (!IS_ERR(pwrseq->reset_gpios))
+ gpiod_put_array(pwrseq->reset_gpios);
if (!IS_ERR(pwrseq->ext_clk))
clk_put(pwrseq->ext_clk);
@@ -112,7 +116,9 @@ struct mmc_pwrseq *mmc_pwrseq_simple_alloc(struct mmc_host *host,
}
pwrseq->reset_gpios = gpiod_get_array(dev, "reset", GPIOD_OUT_HIGH);
- if (IS_ERR(pwrseq->reset_gpios)) {
+ if (IS_ERR(pwrseq->reset_gpios) &&
+ PTR_ERR(pwrseq->reset_gpios) != -ENOENT &&
+ PTR_ERR(pwrseq->reset_gpios) != -ENOSYS) {
ret = PTR_ERR(pwrseq->reset_gpios);
goto clk_put;
}
^ permalink raw reply related [flat|nested] 2+ messages in thread* [PATCH V2] mmc: pwrseq_simple: Make reset-gpios optional to match doc
2016-01-20 15:08 [PATCH V2] mmc: pwrseq_simple: Make reset-gpios optional to match doc Martin Fuzzey
@ 2016-01-21 13:23 ` Ulf Hansson
0 siblings, 0 replies; 2+ messages in thread
From: Ulf Hansson @ 2016-01-21 13:23 UTC (permalink / raw)
To: linux-arm-kernel
On 20 January 2016 at 16:08, Martin Fuzzey <mfuzzey@parkeon.com> wrote:
> The DT binding doc says reset-gpios is an optional property but the code
> currently bails out if it is omitted.
>
> This is a regression since it breaks previously working device trees.
> Fix it by restoring the original documented behaviour.
>
> Fixes: ce037275861e ("mmc: pwrseq_simple: use GPIO descriptors array API")
> Tested-by: Tony Lindgren <tony@atomide.com>
> Signed-off-by: Martin Fuzzey <mfuzzey@parkeon.com>
Thanks, applied for fixes!
Kind regards
Uffe
>
> ---
> V2:
> Fix review comments by Ulf Hansson:
> * Handle -ENOSYS case when CONFIG_GPIOLIB not selected
> This causes checkpatch to complain with
> "WARNING: ENOSYS means 'invalid syscall nr' and nothing else"
> but I guess that's ok here.
> * Update patch description to make it clear this is a regression fix
> * Add Fixes tag
>
> Add Tested-by tag from Tony Lingdren
> ---
> drivers/mmc/core/pwrseq_simple.c | 22 ++++++++++++++--------
> 1 file changed, 14 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/mmc/core/pwrseq_simple.c b/drivers/mmc/core/pwrseq_simple.c
> index d10538b..96f45ca 100644
> --- a/drivers/mmc/core/pwrseq_simple.c
> +++ b/drivers/mmc/core/pwrseq_simple.c
> @@ -29,15 +29,18 @@ struct mmc_pwrseq_simple {
> static void mmc_pwrseq_simple_set_gpios_value(struct mmc_pwrseq_simple *pwrseq,
> int value)
> {
> - int i;
> struct gpio_descs *reset_gpios = pwrseq->reset_gpios;
> - int values[reset_gpios->ndescs];
>
> - for (i = 0; i < reset_gpios->ndescs; i++)
> - values[i] = value;
> + if (!IS_ERR(reset_gpios)) {
> + int i;
> + int values[reset_gpios->ndescs];
>
> - gpiod_set_array_value_cansleep(reset_gpios->ndescs, reset_gpios->desc,
> - values);
> + for (i = 0; i < reset_gpios->ndescs; i++)
> + values[i] = value;
> +
> + gpiod_set_array_value_cansleep(
> + reset_gpios->ndescs, reset_gpios->desc, values);
> + }
> }
>
> static void mmc_pwrseq_simple_pre_power_on(struct mmc_host *host)
> @@ -79,7 +82,8 @@ static void mmc_pwrseq_simple_free(struct mmc_host *host)
> struct mmc_pwrseq_simple *pwrseq = container_of(host->pwrseq,
> struct mmc_pwrseq_simple, pwrseq);
>
> - gpiod_put_array(pwrseq->reset_gpios);
> + if (!IS_ERR(pwrseq->reset_gpios))
> + gpiod_put_array(pwrseq->reset_gpios);
>
> if (!IS_ERR(pwrseq->ext_clk))
> clk_put(pwrseq->ext_clk);
> @@ -112,7 +116,9 @@ struct mmc_pwrseq *mmc_pwrseq_simple_alloc(struct mmc_host *host,
> }
>
> pwrseq->reset_gpios = gpiod_get_array(dev, "reset", GPIOD_OUT_HIGH);
> - if (IS_ERR(pwrseq->reset_gpios)) {
> + if (IS_ERR(pwrseq->reset_gpios) &&
> + PTR_ERR(pwrseq->reset_gpios) != -ENOENT &&
> + PTR_ERR(pwrseq->reset_gpios) != -ENOSYS) {
> ret = PTR_ERR(pwrseq->reset_gpios);
> goto clk_put;
> }
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-01-21 13:23 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-20 15:08 [PATCH V2] mmc: pwrseq_simple: Make reset-gpios optional to match doc Martin Fuzzey
2016-01-21 13:23 ` Ulf Hansson
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).