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

- From: Andy Shevchenko \<hidden\>
- Date: 2021-08-30 12:56:24 
- List: netdev
- Page: https://ratatoskr.run/netdev/2021/08/1492193
- Thread: https://ratatoskr.run/linux-wireless/2021/08/1492167/t.md

```text
On Mon, Aug 30, 2021 at 3:51 PM Andy Shevchenko
[ref] wrote:
> On Mon, Aug 30, 2021 at 3:39 PM Jonas Dreßler [ref] 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
```
