summaryrefslogtreecommitdiff
path: root/drivers/mmc
diff options
context:
space:
mode:
authorLinus Walleij <linus.walleij@linaro.org>2023-06-16 22:42:25 +0200
committerUlf Hansson <ulf.hansson@linaro.org>2023-06-19 13:14:26 +0200
commite85fecc386b98db890b869780573b33af49a7a7c (patch)
tree81d0ea4609124f332fc1b0134ad4ed934add58c0 /drivers/mmc
parent7892497f1f2d38b786cd80980c9f340988f662b5 (diff)
mmc: mmci: Use state machine state as exit condition
Return true if and only if we reached the state MMCI_BUSY_DONE in the ux500 ->busy_complete() callback. Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Link: https://lore.kernel.org/r/20230405-pl180-busydetect-fix-v7-7-69a7164f2a61@linaro.org Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Diffstat (limited to 'drivers/mmc')
-rw-r--r--drivers/mmc/host/mmci.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c
index 4c78783e5e1a..f59c6eb5258b 100644
--- a/drivers/mmc/host/mmci.c
+++ b/drivers/mmc/host/mmci.c
@@ -683,7 +683,7 @@ static bool ux500_busy_complete(struct mmci_host *host, u32 status, u32 err_msk)
~host->variant->busy_detect_mask, base + MMCIMASK0);
host->busy_state = MMCI_BUSY_DONE;
host->busy_status = 0;
- return true;
+ goto out_ret_state;
}
/*
@@ -713,7 +713,7 @@ static bool ux500_busy_complete(struct mmci_host *host, u32 status, u32 err_msk)
host->variant->busy_detect_mask,
base + MMCIMASK0);
host->busy_state = MMCI_BUSY_WAITING_FOR_START_IRQ;
- return false;
+ goto out_ret_state;
}
retries--;
}
@@ -722,8 +722,7 @@ static bool ux500_busy_complete(struct mmci_host *host, u32 status, u32 err_msk)
writel(readl(base + MMCIMASK0) &
~host->variant->busy_detect_mask, base + MMCIMASK0);
host->busy_state = MMCI_BUSY_DONE;
- host->busy_status = 0;
- return true;
+ goto out_ret_state;
}
/*
@@ -742,7 +741,7 @@ static bool ux500_busy_complete(struct mmci_host *host, u32 status, u32 err_msk)
host->busy_status |= status & (MCI_CMDSENT | MCI_CMDRESPEND);
writel(host->variant->busy_detect_mask, base + MMCICLEAR);
host->busy_state = MMCI_BUSY_WAITING_FOR_END_IRQ;
- return false;
+ goto out_ret_state;
} else {
dev_dbg(mmc_dev(host->mmc),
"lost busy status when waiting for busy start IRQ\n");
@@ -751,7 +750,7 @@ static bool ux500_busy_complete(struct mmci_host *host, u32 status, u32 err_msk)
~host->variant->busy_detect_mask, base + MMCIMASK0);
host->busy_state = MMCI_BUSY_DONE;
host->busy_status = 0;
- return true;
+ goto out_ret_state;
}
}
@@ -759,15 +758,18 @@ static bool ux500_busy_complete(struct mmci_host *host, u32 status, u32 err_msk)
if (!(status & host->variant->busy_detect_flag)) {
host->busy_status |= status & (MCI_CMDSENT | MCI_CMDRESPEND);
host->busy_state = MMCI_BUSY_DONE;
- return true;
+ goto out_ret_state;
} else {
dev_dbg(mmc_dev(host->mmc),
"busy status still asserted when handling busy end IRQ - will keep waiting\n");
- return false;
+ goto out_ret_state;
}
}
return true;
+
+out_ret_state:
+ return (host->busy_state == MMCI_BUSY_DONE);
}
/*