On Tue, 14 Nov 2023 at 12:21, Avri Altman <Avri.Altman@xxxxxxx> wrote: > > > > > } > > > > @@ -1032,6 +1044,28 @@ static inline void > > > > mmc_blk_reset_success(struct > > > mmc_blk_data *md, int type) > > > > md->reset_done &= ~type; > > > > } > > > > > > > > +/* close-ended ffu */ > > > > +static void mmc_blk_check_ce_ffu(struct mmc_queue_req *mq_rq) { > > > > + struct mmc_blk_ioc_data **idata = mq_rq->drv_op_data; > > > > + > > > > + if (mq_rq->ioc_count != 4) > > > > + return; > > > > + > > > > + if (idata[0]->ic.opcode != MMC_SWITCH) > > > > + return; > > > > + > > > > + if (MMC_EXTRACT_INDEX_FROM_ARG(idata[0]->ic.arg) != > > > > + EXT_CSD_MODE_CONFIG) > > > > + return; > > > > + > > > > + if (idata[1]->ic.opcode == MMC_SET_BLOCK_COUNT && > > > > + idata[2]->ic.opcode == MMC_WRITE_MULTIPLE_BLOCK) { > > > > + idata[1]->flags |= MMC_BLK_IOC_DROP; > > > > + idata[2]->flags |= MMC_BLK_IOC_SBC; > > > > + } > > > > > > Could this be more generic e.g. simply > > > > > > for (i = 1; i < mq_rq->ioc_count; i++) > > > if (idata[i - 1]->ic.opcode == MMC_SET_BLOCK_COUNT && > > > mmc_op_multi(idata[i + 1]->ic.opcode)) { > > I guess you meant (idata[i] > > > > > idata[i - 1]->flags |= MMC_BLK_IOC_DROP; > > > idata[i]->flags |= MMC_BLK_IOC_SBC; > > > } > > > > > > with no need to check for 4 cmds, MMC_SWITCH or > > EXT_CSD_MODE_CONFIG > > Ditto > Or, I can follow your proposal. > Will send a v3. Please do! I think it's better to solve this in a generic way, rather than making it specific for FFU. Kind regards Uffe