Messages in this thread | | | From | Stephen Boyd <> | Date | Wed, 6 Sep 2023 15:23:56 -0500 | Subject | Re: [PATCH v2 1/3] platform/x86: intel_scu_ipc: Check status after timeout in busy_loop() |
| |
Quoting Kuppuswamy Sathyanarayanan (2023-09-06 13:20:49) > On 9/6/2023 1:14 PM, Stephen Boyd wrote: > > Quoting Andy Shevchenko (2023-09-06 13:04:54) > >> On Wed, Sep 06, 2023 at 11:09:41AM -0700, Stephen Boyd wrote: > >>> status = ipc_read_status(scu); > >>> if (!(status & IPC_STATUS_BUSY)) > >> > >>> - return (status & IPC_STATUS_ERR) ? -EIO : 0; > >>> + goto not_busy; > >> > >> Wouldn't simple 'break' suffice here? > > > > Yes, at the cost of reading the status again when it isn't busy, or > > checking the busy bit after the loop breaks out and reading it once > > again when it is busy. I suppose the compiler would figure that out and > > optimize so that break would simply goto the return statement. > > > > The code could look like this without a goto. > > > > do { > > status = ipc_read_status(scu); > > if (!(status & IPC_STATUS_BUSY)) > > break; > > } while (time_before(jiffies, end)); > > > > if (status & IPC_STATUS_BUSY) > > status = ipc_read_status(scu); > > IMO, you can remove the if condition and read again the status in all cases. > It is more readable. But it is up to you. >
I don't really care either way. Just let me know what makes the maintainers happy here.
| |