diff options
author | Martin Fuzzey <mfuzzey@parkeon.com> | 2016-01-20 10:08:03 -0500 |
---|---|---|
committer | Ulf Hansson <ulf.hansson@linaro.org> | 2016-01-21 07:52:27 -0500 |
commit | 64a67d4762ce3ce4c9466eadd152d825fbf84967 (patch) | |
tree | 69f2d3c4ae10cf67c400813c5ea12f8a9050cbbb | |
parent | 07cbeea5412fa82543cbdba94ca94799fdb7bf55 (diff) |
mmc: pwrseq_simple: Make reset-gpios optional to match doc
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>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
-rw-r--r-- | drivers/mmc/core/pwrseq_simple.c | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/drivers/mmc/core/pwrseq_simple.c b/drivers/mmc/core/pwrseq_simple.c index 2b16263458af..aba786daebca 100644 --- a/drivers/mmc/core/pwrseq_simple.c +++ b/drivers/mmc/core/pwrseq_simple.c | |||
@@ -29,15 +29,18 @@ struct mmc_pwrseq_simple { | |||
29 | static void mmc_pwrseq_simple_set_gpios_value(struct mmc_pwrseq_simple *pwrseq, | 29 | static void mmc_pwrseq_simple_set_gpios_value(struct mmc_pwrseq_simple *pwrseq, |
30 | int value) | 30 | int value) |
31 | { | 31 | { |
32 | int i; | ||
33 | struct gpio_descs *reset_gpios = pwrseq->reset_gpios; | 32 | struct gpio_descs *reset_gpios = pwrseq->reset_gpios; |
34 | int values[reset_gpios->ndescs]; | ||
35 | 33 | ||
36 | for (i = 0; i < reset_gpios->ndescs; i++) | 34 | if (!IS_ERR(reset_gpios)) { |
37 | values[i] = value; | 35 | int i; |
36 | int values[reset_gpios->ndescs]; | ||
38 | 37 | ||
39 | gpiod_set_array_value_cansleep(reset_gpios->ndescs, reset_gpios->desc, | 38 | for (i = 0; i < reset_gpios->ndescs; i++) |
40 | values); | 39 | values[i] = value; |
40 | |||
41 | gpiod_set_array_value_cansleep( | ||
42 | reset_gpios->ndescs, reset_gpios->desc, values); | ||
43 | } | ||
41 | } | 44 | } |
42 | 45 | ||
43 | static void mmc_pwrseq_simple_pre_power_on(struct mmc_host *host) | 46 | 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) | |||
79 | struct mmc_pwrseq_simple *pwrseq = container_of(host->pwrseq, | 82 | struct mmc_pwrseq_simple *pwrseq = container_of(host->pwrseq, |
80 | struct mmc_pwrseq_simple, pwrseq); | 83 | struct mmc_pwrseq_simple, pwrseq); |
81 | 84 | ||
82 | gpiod_put_array(pwrseq->reset_gpios); | 85 | if (!IS_ERR(pwrseq->reset_gpios)) |
86 | gpiod_put_array(pwrseq->reset_gpios); | ||
83 | 87 | ||
84 | if (!IS_ERR(pwrseq->ext_clk)) | 88 | if (!IS_ERR(pwrseq->ext_clk)) |
85 | clk_put(pwrseq->ext_clk); | 89 | clk_put(pwrseq->ext_clk); |
@@ -112,7 +116,9 @@ struct mmc_pwrseq *mmc_pwrseq_simple_alloc(struct mmc_host *host, | |||
112 | } | 116 | } |
113 | 117 | ||
114 | pwrseq->reset_gpios = gpiod_get_array(dev, "reset", GPIOD_OUT_HIGH); | 118 | pwrseq->reset_gpios = gpiod_get_array(dev, "reset", GPIOD_OUT_HIGH); |
115 | if (IS_ERR(pwrseq->reset_gpios)) { | 119 | if (IS_ERR(pwrseq->reset_gpios) && |
120 | PTR_ERR(pwrseq->reset_gpios) != -ENOENT && | ||
121 | PTR_ERR(pwrseq->reset_gpios) != -ENOSYS) { | ||
116 | ret = PTR_ERR(pwrseq->reset_gpios); | 122 | ret = PTR_ERR(pwrseq->reset_gpios); |
117 | goto clk_put; | 123 | goto clk_put; |
118 | } | 124 | } |