Re: [PATCH 2/2] mwifiex: Try waking the firmware until we get an interrupt

From: Andy Shevchenko
Date: Mon Aug 30 2021 - 08:56:24 EST


On Mon, Aug 30, 2021 at 3:51 PM Andy Shevchenko
<andy.shevchenko@xxxxxxxxx> wrote:
> On Mon, Aug 30, 2021 at 3:39 PM Jonas Dreßler <verdre@xxxxxxx> wrote:

...

> > + do {
> > + if (mwifiex_write_reg(adapter, reg->fw_status, FIRMWARE_READY_PCIE)) {
> > + mwifiex_dbg(adapter, ERROR,
> > + "Writing fw_status register failed\n");

> > + return -1;

Please, use proper code. -EIO or so.

> > + }
> > +
> > + n_tries++;
> > +
> > + if (n_tries <= 15)
> > + usleep_range(400, 700);
> > + else
> > + msleep(10);
> > + } while (n_tries <= 50 && READ_ONCE(adapter->int_status) == 0);

Can you use definitions for 15 and 50?

> NIH read_poll_timeout() from iopoll.h.

On the second thought it might be not optimal to use it (requires
anyway an additional function and doesn't provide an abortion on
error). Just see above.

--
With Best Regards,
Andy Shevchenko