Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mmc: core: Factor out some of the code in mmc_go_idle()

Move some part out from mmc_go_idle() into a new function called
__mmc_go_idle(), allowing it to be re-used, which is shown from a
subsequent change.

Signed-off-by: Victor Shih <victor.shih@genesyslogic.com.tw>
Link: https://lore.kernel.org/r/20240913102836.6144-7-victorshihgli@gmail.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>

authored by

Victor Shih and committed by
Ulf Hansson
acbf2f3c a9a75f9d

+17 -8
+16 -8
drivers/mmc/core/mmc_ops.c
··· 144 144 return mmc_wait_for_cmd(host, &cmd, MMC_CMD_RETRIES); 145 145 } 146 146 147 + int __mmc_go_idle(struct mmc_host *host) 148 + { 149 + struct mmc_command cmd = {}; 150 + int err; 151 + 152 + cmd.opcode = MMC_GO_IDLE_STATE; 153 + cmd.arg = 0; 154 + cmd.flags = MMC_RSP_SPI_R1 | MMC_RSP_NONE | MMC_CMD_BC; 155 + 156 + err = mmc_wait_for_cmd(host, &cmd, 0); 157 + mmc_delay(1); 158 + 159 + return err; 160 + } 161 + 147 162 int mmc_go_idle(struct mmc_host *host) 148 163 { 149 164 int err; 150 - struct mmc_command cmd = {}; 151 165 152 166 /* 153 167 * Non-SPI hosts need to prevent chipselect going active during ··· 177 163 mmc_delay(1); 178 164 } 179 165 180 - cmd.opcode = MMC_GO_IDLE_STATE; 181 - cmd.arg = 0; 182 - cmd.flags = MMC_RSP_SPI_R1 | MMC_RSP_NONE | MMC_CMD_BC; 183 - 184 - err = mmc_wait_for_cmd(host, &cmd, 0); 185 - 186 - mmc_delay(1); 166 + err = __mmc_go_idle(host); 187 167 188 168 if (!mmc_host_is_spi(host)) { 189 169 mmc_set_chip_select(host, MMC_CS_DONTCARE);
+1
drivers/mmc/core/mmc_ops.h
··· 25 25 int mmc_select_card(struct mmc_card *card); 26 26 int mmc_deselect_cards(struct mmc_host *host); 27 27 int mmc_set_dsr(struct mmc_host *host); 28 + int __mmc_go_idle(struct mmc_host *host); 28 29 int mmc_go_idle(struct mmc_host *host); 29 30 int mmc_send_op_cond(struct mmc_host *host, u32 ocr, u32 *rocr); 30 31 int mmc_set_relative_addr(struct mmc_card *card);