[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAE-0n53Tqcq8KHaYA8+1_kxy2nPmcRp3t1NK_vAZM=9tfCxqjA@mail.gmail.com>
Date: Wed, 6 Sep 2023 15:23:56 -0500
From: Stephen Boyd <swboyd@...omium.org>
To: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Kuppuswamy Sathyanarayanan
<sathyanarayanan.kuppuswamy@...ux.intel.com>
Cc: Mika Westerberg <mika.westerberg@...ux.intel.com>,
Hans de Goede <hdegoede@...hat.com>,
Mark Gross <markgross@...nel.org>,
linux-kernel@...r.kernel.org, patches@...ts.linux.dev,
platform-driver-x86@...r.kernel.org,
Prashant Malani <pmalani@...omium.org>
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.
Powered by blists - more mailing lists