Re: [PATCH v2] staging: rtl8723bs: fix constant on left side of test checkpatch warnings
From: Andy Shevchenko
Date: Tue Mar 24 2026 - 09:43:37 EST
On Tue, Mar 24, 2026 at 06:32:34PM +0530, Prithvi wrote:
> On Mon, Mar 23, 2026 at 06:42:49PM +0200, Andy Shevchenko wrote:
> > On Mon, Mar 23, 2026 at 09:59:01PM +0530, Prithvi Tambewagh wrote:
...
> > > do {
> > > valid = rtw_read8(padapter, REG_HMETFR) & BIT(msgbox_num);
> > > - if (0 == valid) {
> > > + if (!valid)
> > > read_down = true;
> > > - }
> > > } while ((!read_down) && (retry_cnts--));
> > >
> > > return read_down;
> >
> > This entire piece can be replaced with something from iopoll.h.
>
> Yes...I checked out and found we can use read_poll_timeout_atomic():
...
> #include <rtl8723b_hal.h>
> #include <linux/etherdevice.h>
> #include "hal_com_h2c.h"
> +#include <linux/iopoll.h>
Just make sure you put it in a better (more ordered) place, like one line above.
...
#include <linux/etherdevice.h>
#include <linux/iopoll.h>
...
...
> static u8 _is_fw_read_cmd_down(struct adapter *padapter, u8 msgbox_num)
> {
> u8 valid;
> + int ret;
> +
> + ret = read_poll_timeout_atomic(rtw_read8,
> + valid,
> + !(valid & BIT(msgbox_num)),
> + 0,
> + 500,
> + false,
> + padapter, REG_HMETFR);
> + return !ret;
ret = read_poll_timeout_atomic(rtw_read8,
valid, !(valid & BIT(msgbox_num)),
0, 500, false,
padapter, REG_HMETFR);
return !ret;
> }
>
> Is this approach correct?
Yes, looks correct. Just compress it a bit and fix indentation,
see above how.
--
With Best Regards,
Andy Shevchenko