RE: [PATCH 3/3] mmc: block: ioctl: Add error aggregation flag

From: Avri Altman
Date: Mon May 15 2023 - 11:03:41 EST


> > + */
> > + else if (idata->ic.write_flag & MMC_AGGREGATE_PROG_ERRORS) {
> > + unsigned long timeout = jiffies +
> > + msecs_to_jiffies(busy_timeout_ms);
> > + bool done = false;
> > + unsigned long delay_ms = 1;
> > + u32 status;
> > +
> > + do {
> > + done = time_after(jiffies, timeout);
> > + msleep(delay_ms++);
> > + err = __mmc_send_status(card, &status, 1);
> > + if (err)
> > + return err;
> > + idata->ic.response[1] |= status;
> > + } while (R1_CURRENT_STATE(status) != R1_STATE_TRAN &&
> !done);
> > + if (done)
> > + return -ETIMEDOUT;
> > + }
>
> We have moved away from open-coding polling loops. Let's not introduce a
> new one. In fact, it looks a bit like we could re-use the
> mmc_blk_busy_cb() for this, as it seems to be collecting the error codes too.
>
> In any case, let's at least make use of __mmc_poll_for_busy() to avoid the
> open-coding.
Or maybe use read_poll_timeout()?

Thanks,
Avri