On 13/10/2018 09:20, Chaotian Jing wrote: > the tuning code is becoming more and more bloated, let's make the > set cmd/data delay to inline function to avoid too much redundant code. > > Signed-off-by: Chaotian Jing <chaotian.jing@xxxxxxxxxxxx> > --- > drivers/mmc/host/mtk-sd.c | 133 +++++++++++++--------------------------------- > 1 file changed, 38 insertions(+), 95 deletions(-) > > diff --git a/drivers/mmc/host/mtk-sd.c b/drivers/mmc/host/mtk-sd.c [...]> @@ -1923,17 +1898,8 @@ static int msdc_tune_together(struct mmc_host *mmc, u32 opcode) > sdr_clr_bits(host->base + MSDC_IOCON, > MSDC_IOCON_DSPL | MSDC_IOCON_W_DSPL); > for (i = 0 ; i < PAD_DELAY_MAX; i++) { > - if (host->top_base) { > - sdr_set_field(host->top_base + EMMC_TOP_CMD, > - PAD_CMD_RXDLY, i); > - sdr_set_field(host->top_base + EMMC_TOP_CONTROL, > - PAD_DAT_RD_RXDLY, i); > - } else { > - sdr_set_field(host->base + tune_reg, > - MSDC_PAD_TUNE_CMDRDLY, i); > - sdr_set_field(host->base + tune_reg, > - MSDC_PAD_TUNE_DATRRDLY, i); > - } > + msdc_set_cmd_delay(host, i); > + msdc_set_data_delay(host, i); Put the clean-up before introducing msdc_tune_together, that makes the series much easier to read. Thanks, Matthias