Skip to content

Commit e85fecc

Browse files
Linus WalleijUlf Hansson
authored andcommitted
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>
1 parent 7892497 commit e85fecc

1 file changed

Lines changed: 10 additions & 8 deletions

File tree

drivers/mmc/host/mmci.c

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -683,7 +683,7 @@ static bool ux500_busy_complete(struct mmci_host *host, u32 status, u32 err_msk)
683683
~host->variant->busy_detect_mask, base + MMCIMASK0);
684684
host->busy_state = MMCI_BUSY_DONE;
685685
host->busy_status = 0;
686-
return true;
686+
goto out_ret_state;
687687
}
688688

689689
/*
@@ -713,7 +713,7 @@ static bool ux500_busy_complete(struct mmci_host *host, u32 status, u32 err_msk)
713713
host->variant->busy_detect_mask,
714714
base + MMCIMASK0);
715715
host->busy_state = MMCI_BUSY_WAITING_FOR_START_IRQ;
716-
return false;
716+
goto out_ret_state;
717717
}
718718
retries--;
719719
}
@@ -722,8 +722,7 @@ static bool ux500_busy_complete(struct mmci_host *host, u32 status, u32 err_msk)
722722
writel(readl(base + MMCIMASK0) &
723723
~host->variant->busy_detect_mask, base + MMCIMASK0);
724724
host->busy_state = MMCI_BUSY_DONE;
725-
host->busy_status = 0;
726-
return true;
725+
goto out_ret_state;
727726
}
728727

729728
/*
@@ -742,7 +741,7 @@ static bool ux500_busy_complete(struct mmci_host *host, u32 status, u32 err_msk)
742741
host->busy_status |= status & (MCI_CMDSENT | MCI_CMDRESPEND);
743742
writel(host->variant->busy_detect_mask, base + MMCICLEAR);
744743
host->busy_state = MMCI_BUSY_WAITING_FOR_END_IRQ;
745-
return false;
744+
goto out_ret_state;
746745
} else {
747746
dev_dbg(mmc_dev(host->mmc),
748747
"lost busy status when waiting for busy start IRQ\n");
@@ -751,23 +750,26 @@ static bool ux500_busy_complete(struct mmci_host *host, u32 status, u32 err_msk)
751750
~host->variant->busy_detect_mask, base + MMCIMASK0);
752751
host->busy_state = MMCI_BUSY_DONE;
753752
host->busy_status = 0;
754-
return true;
753+
goto out_ret_state;
755754
}
756755
}
757756

758757
if (host->busy_state == MMCI_BUSY_WAITING_FOR_END_IRQ) {
759758
if (!(status & host->variant->busy_detect_flag)) {
760759
host->busy_status |= status & (MCI_CMDSENT | MCI_CMDRESPEND);
761760
host->busy_state = MMCI_BUSY_DONE;
762-
return true;
761+
goto out_ret_state;
763762
} else {
764763
dev_dbg(mmc_dev(host->mmc),
765764
"busy status still asserted when handling busy end IRQ - will keep waiting\n");
766-
return false;
765+
goto out_ret_state;
767766
}
768767
}
769768

770769
return true;
770+
771+
out_ret_state:
772+
return (host->busy_state == MMCI_BUSY_DONE);
771773
}
772774

773775
/*

0 commit comments

Comments
 (0)