Skip to content

Commit 0ee5f15

Browse files
committed
mmc: sdhci: Separate out sdhci_reset_for_all()
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2144641 commit aa99072 Author: Adrian Hunter <adrian.hunter@intel.com> Date: Mon, 26 Sep 2022 22:20:19 +0300 Tidy sdhci_do_reset() slightly by separating out sdhci_reset_for_all() which removes the need to test the mask in sdhci_do_reset(). Signed-off-by: Adrian Hunter <adrian.hunter@intel.com> Reviewed-by: Thierry Reding <treding@nvidia.com> Link: https://lore.kernel.org/r/20220926192022.85660-2-adrian.hunter@intel.com Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> Signed-off-by: Mark Salter <msalter@redhat.com>
1 parent 3003cbf commit 0ee5f15

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

drivers/mmc/host/sdhci.c

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -232,23 +232,27 @@ void sdhci_reset(struct sdhci_host *host, u8 mask)
232232
}
233233
EXPORT_SYMBOL_GPL(sdhci_reset);
234234

235-
static void sdhci_do_reset(struct sdhci_host *host, u8 mask)
235+
static bool sdhci_do_reset(struct sdhci_host *host, u8 mask)
236236
{
237237
if (host->quirks & SDHCI_QUIRK_NO_CARD_NO_RESET) {
238238
struct mmc_host *mmc = host->mmc;
239239

240240
if (!mmc->ops->get_cd(mmc))
241-
return;
241+
return false;
242242
}
243243

244244
host->ops->reset(host, mask);
245245

246-
if (mask & SDHCI_RESET_ALL) {
246+
return true;
247+
}
248+
249+
static void sdhci_reset_for_all(struct sdhci_host *host)
250+
{
251+
if (sdhci_do_reset(host, SDHCI_RESET_ALL)) {
247252
if (host->flags & (SDHCI_USE_SDMA | SDHCI_USE_ADMA)) {
248253
if (host->ops->enable_dma)
249254
host->ops->enable_dma(host);
250255
}
251-
252256
/* Resetting the controller clears many */
253257
host->preset_enabled = false;
254258
}
@@ -324,7 +328,7 @@ static void sdhci_init(struct sdhci_host *host, int soft)
324328
if (soft)
325329
sdhci_do_reset(host, SDHCI_RESET_CMD | SDHCI_RESET_DATA);
326330
else
327-
sdhci_do_reset(host, SDHCI_RESET_ALL);
331+
sdhci_reset_for_all(host);
328332

329333
if (host->v4_mode)
330334
sdhci_do_enable_v4_mode(host);
@@ -4037,7 +4041,7 @@ void __sdhci_read_caps(struct sdhci_host *host, const u16 *ver,
40374041
if (debug_quirks2)
40384042
host->quirks2 = debug_quirks2;
40394043

4040-
sdhci_do_reset(host, SDHCI_RESET_ALL);
4044+
sdhci_reset_for_all(host);
40414045

40424046
if (host->v4_mode)
40434047
sdhci_do_enable_v4_mode(host);
@@ -4778,7 +4782,7 @@ int __sdhci_add_host(struct sdhci_host *host)
47784782
unled:
47794783
sdhci_led_unregister(host);
47804784
unirq:
4781-
sdhci_do_reset(host, SDHCI_RESET_ALL);
4785+
sdhci_reset_for_all(host);
47824786
sdhci_writel(host, 0, SDHCI_INT_ENABLE);
47834787
sdhci_writel(host, 0, SDHCI_SIGNAL_ENABLE);
47844788
free_irq(host->irq, host);
@@ -4836,7 +4840,7 @@ void sdhci_remove_host(struct sdhci_host *host, int dead)
48364840
sdhci_led_unregister(host);
48374841

48384842
if (!dead)
4839-
sdhci_do_reset(host, SDHCI_RESET_ALL);
4843+
sdhci_reset_for_all(host);
48404844

48414845
sdhci_writel(host, 0, SDHCI_INT_ENABLE);
48424846
sdhci_writel(host, 0, SDHCI_SIGNAL_ENABLE);

0 commit comments

Comments
 (0)