From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Andrew Murray <andrew.murray@arm.com>
Cc: Keith Busch <kbusch@kernel.org>,
Bjorn Helgaas <bhelgaas@google.com>,
linux-pci@vger.kernel.org,
Stuart Hayes <stuart.w.hayes@gmail.com>,
Alexandru Gagniuc <mr.nuke.me@gmail.com>
Subject: Re: [PATCH v1] PCI: pciehp: Refactor infinite loop in pcie_poll_cmd()
Date: Fri, 8 Nov 2019 13:10:26 +0200 [thread overview]
Message-ID: <20191108111026.GD32742@smile.fi.intel.com> (raw)
In-Reply-To: <20191108101815.GE43905@e119886-lin.cambridge.arm.com>
On Fri, Nov 08, 2019 at 10:18:16AM +0000, Andrew Murray wrote:
> On Fri, Nov 08, 2019 at 07:37:26AM +0900, Keith Busch wrote:
> > On Fri, Oct 11, 2019 at 12:02:30PM +0300, Andy Shevchenko wrote:
> > > No functional changes implied.
> >
> > [snip]
> >
> > > - while (true) {
> > > + do {
> > > pcie_capability_read_word(pdev, PCI_EXP_SLTSTA, &slot_status);
> > > if (slot_status == (u16) ~0) {
> > > ctrl_info(ctrl, "%s: no response from device\n",
> > > @@ -81,11 +81,9 @@ static int pcie_poll_cmd(struct controller *ctrl, int timeout)
> > > PCI_EXP_SLTSTA_CC);
> > > return 1;
> > > }
> > > - if (timeout < 0)
> > > - break;
> > > msleep(10);
> > > timeout -= 10;
> > > - }
> > > + } while (timeout > 0);
> > > return 0; /* timeout */
> > > }
> >
> > If you really want to ensure no funcitonal change, I think the end of
> > the loop needs to be 'while (timeout >= 0);'
>
> With this suggested change, you can add:
>
> Reviewed-by: Andrew Murray <andrew.murray@arm.com>
>
> I can't get too excited by coding styles, however I find this more
> readable now, due to the fact that the loop is clearly bounded.
Thank you, Keith and Andrew, I'll submit v2 soon.
--
With Best Regards,
Andy Shevchenko
prev parent reply other threads:[~2019-11-08 11:10 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-11 9:02 [PATCH v1] PCI: pciehp: Refactor infinite loop in pcie_poll_cmd() Andy Shevchenko
2019-11-07 15:15 ` Andy Shevchenko
2019-11-07 17:21 ` Alex G.
2019-11-08 11:08 ` Andy Shevchenko
2019-11-07 22:37 ` Keith Busch
2019-11-08 10:18 ` Andrew Murray
2019-11-08 11:10 ` Andy Shevchenko [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191108111026.GD32742@smile.fi.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=andrew.murray@arm.com \
--cc=bhelgaas@google.com \
--cc=kbusch@kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=mr.nuke.me@gmail.com \
--cc=stuart.w.hayes@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).