Skip to content

Commit e1a2485

Browse files
Linus WalleijUlf Hansson
authored andcommitted
mmc: mmci: Break out error check in busy detect
The busy detect callback for Ux500 checks for an error in the status in the first if() clause. The only practical reason is that if an error occurs, the if()-clause is not executed, and the code falls through to the last if()-clause if (host->busy_status) which will clear and disable the irq. Make this explicit instead: it is easier to read. Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Link: https://lore.kernel.org/r/20230405-pl180-busydetect-fix-v7-4-69a7164f2a61@linaro.org Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
1 parent 8a6a9e7 commit e1a2485

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

drivers/mmc/host/mmci.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -675,6 +675,15 @@ static bool ux500_busy_complete(struct mmci_host *host, u32 status, u32 err_msk)
675675
{
676676
void __iomem *base = host->base;
677677

678+
if (status & err_msk) {
679+
/* Stop any ongoing busy detection if an error occurs */
680+
writel(host->variant->busy_detect_mask, base + MMCICLEAR);
681+
writel(readl(base + MMCIMASK0) &
682+
~host->variant->busy_detect_mask, base + MMCIMASK0);
683+
host->busy_status = 0;
684+
return true;
685+
}
686+
678687
/*
679688
* Before unmasking for the busy end IRQ, confirm that the
680689
* command was sent successfully. To keep track of having a
@@ -688,7 +697,7 @@ static bool ux500_busy_complete(struct mmci_host *host, u32 status, u32 err_msk)
688697
* while, to allow it to be set, but tests indicates that it
689698
* isn't needed.
690699
*/
691-
if (!host->busy_status && !(status & err_msk)) {
700+
if (!host->busy_status) {
692701
status = readl(base + MMCISTATUS);
693702
if (status & host->variant->busy_detect_flag) {
694703
writel(readl(base + MMCIMASK0) |

0 commit comments

Comments
 (0)