diff options
author | Masahiro Yamada <yamada.masahiro@socionext.com> | 2017-08-23 00:15:01 -0400 |
---|---|---|
committer | Ulf Hansson <ulf.hansson@linaro.org> | 2017-08-30 09:03:44 -0400 |
commit | 3fd1d86f03cbcc7a894cf0e7a70e8758c5f12882 (patch) | |
tree | 4b783b0c6071d79fda22d65c48425d5dbd5a13d7 | |
parent | a232a8f2d10750733c54e92ad85da7f8223b1382 (diff) |
mmc: sdhci-pxav2: switch to managed clk and sdhci_pltfm_unregister()
The difference between sdhci_pxav2_remove() and sdhci_pltfm_unregister()
is clk_put(). It will go away by using the managed resource clk, then
sdhci_pltfm_unregister() can be reused.
Also, rename the jump labels to say what the goto does. (Coding style
suggested by Documentation/process/coding-style.rst)
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
-rw-r--r-- | drivers/mmc/host/sdhci-pxav2.c | 30 |
1 files changed, 7 insertions, 23 deletions
diff --git a/drivers/mmc/host/sdhci-pxav2.c b/drivers/mmc/host/sdhci-pxav2.c index 995083ce1c46..8986f9d9cf98 100644 --- a/drivers/mmc/host/sdhci-pxav2.c +++ b/drivers/mmc/host/sdhci-pxav2.c | |||
@@ -178,17 +178,17 @@ static int sdhci_pxav2_probe(struct platform_device *pdev) | |||
178 | 178 | ||
179 | pltfm_host = sdhci_priv(host); | 179 | pltfm_host = sdhci_priv(host); |
180 | 180 | ||
181 | clk = clk_get(dev, "PXA-SDHCLK"); | 181 | clk = devm_clk_get(dev, "PXA-SDHCLK"); |
182 | if (IS_ERR(clk)) { | 182 | if (IS_ERR(clk)) { |
183 | dev_err(dev, "failed to get io clock\n"); | 183 | dev_err(dev, "failed to get io clock\n"); |
184 | ret = PTR_ERR(clk); | 184 | ret = PTR_ERR(clk); |
185 | goto err_clk_get; | 185 | goto free; |
186 | } | 186 | } |
187 | pltfm_host->clk = clk; | 187 | pltfm_host->clk = clk; |
188 | ret = clk_prepare_enable(clk); | 188 | ret = clk_prepare_enable(clk); |
189 | if (ret) { | 189 | if (ret) { |
190 | dev_err(&pdev->dev, "failed to enable io clock\n"); | 190 | dev_err(&pdev->dev, "failed to enable io clock\n"); |
191 | goto err_clk_enable; | 191 | goto free; |
192 | } | 192 | } |
193 | 193 | ||
194 | host->quirks = SDHCI_QUIRK_BROKEN_ADMA | 194 | host->quirks = SDHCI_QUIRK_BROKEN_ADMA |
@@ -223,34 +223,18 @@ static int sdhci_pxav2_probe(struct platform_device *pdev) | |||
223 | ret = sdhci_add_host(host); | 223 | ret = sdhci_add_host(host); |
224 | if (ret) { | 224 | if (ret) { |
225 | dev_err(&pdev->dev, "failed to add host\n"); | 225 | dev_err(&pdev->dev, "failed to add host\n"); |
226 | goto err_add_host; | 226 | goto disable_clk; |
227 | } | 227 | } |
228 | 228 | ||
229 | return 0; | 229 | return 0; |
230 | 230 | ||
231 | err_add_host: | 231 | disable_clk: |
232 | clk_disable_unprepare(clk); | 232 | clk_disable_unprepare(clk); |
233 | err_clk_enable: | 233 | free: |
234 | clk_put(clk); | ||
235 | err_clk_get: | ||
236 | sdhci_pltfm_free(pdev); | 234 | sdhci_pltfm_free(pdev); |
237 | return ret; | 235 | return ret; |
238 | } | 236 | } |
239 | 237 | ||
240 | static int sdhci_pxav2_remove(struct platform_device *pdev) | ||
241 | { | ||
242 | struct sdhci_host *host = platform_get_drvdata(pdev); | ||
243 | struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); | ||
244 | |||
245 | sdhci_remove_host(host, 1); | ||
246 | |||
247 | clk_disable_unprepare(pltfm_host->clk); | ||
248 | clk_put(pltfm_host->clk); | ||
249 | sdhci_pltfm_free(pdev); | ||
250 | |||
251 | return 0; | ||
252 | } | ||
253 | |||
254 | static struct platform_driver sdhci_pxav2_driver = { | 238 | static struct platform_driver sdhci_pxav2_driver = { |
255 | .driver = { | 239 | .driver = { |
256 | .name = "sdhci-pxav2", | 240 | .name = "sdhci-pxav2", |
@@ -258,7 +242,7 @@ static struct platform_driver sdhci_pxav2_driver = { | |||
258 | .pm = &sdhci_pltfm_pmops, | 242 | .pm = &sdhci_pltfm_pmops, |
259 | }, | 243 | }, |
260 | .probe = sdhci_pxav2_probe, | 244 | .probe = sdhci_pxav2_probe, |
261 | .remove = sdhci_pxav2_remove, | 245 | .remove = sdhci_pltfm_unregister, |
262 | }; | 246 | }; |
263 | 247 | ||
264 | module_platform_driver(sdhci_pxav2_driver); | 248 | module_platform_driver(sdhci_pxav2_driver); |