From: Kevin O'Connor <kevin@koconnor.net>
To: Marcel Apfelbaum <marcel.a@redhat.com>
Cc: seabios@seabios.org, kraxel@redhat.com, qemu-devel@nongnu.org,
mst@redhat.com
Subject: Re: [Qemu-devel] [PATCH V3 1/2] hw/pci: reserve IO and mem for pci-2-pci bridges with no devices attached
Date: Thu, 10 Apr 2014 12:45:02 -0400 [thread overview]
Message-ID: <20140410164502.GA14182@morn.localdomain> (raw)
In-Reply-To: <1397136581-10500-2-git-send-email-marcel.a@redhat.com>
On Thu, Apr 10, 2014 at 04:29:40PM +0300, Marcel Apfelbaum wrote:
[...]
> + for (i = 0, cap = pci_config_readb(pci->bdf, PCI_CAPABILITY_LIST);
> + (i <= 0xff) && cap;
> + i++, cap = pci_config_readb(pci->bdf, cap + PCI_CAP_LIST_NEXT))
> + if (pci_config_readb(pci->bdf, cap + PCI_CAP_LIST_ID) == cap_id)
> + return cap;
I hate to nitpick, but I find that for-loop hard to read. What about
something like:
int i;
u8 cap = pci_config_readb(pci->bdf, PCI_CAPABILITY_LIST);
for (i = 0, cap && i <= 0xff; i++) {
if (pci_config_readb(pci->bdf, cap + PCI_CAP_LIST_ID) == cap_id)
return cap;
cap = pci_config_readb(pci->bdf, cap + PCI_CAP_LIST_NEXT))
}
Otherwise, your patches look fine to me.
-Kevin
next prev parent reply other threads:[~2014-04-10 16:45 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-10 13:29 [Qemu-devel] [SeaBIOS] [PATCH V3 0/2] hw/pci: reserve IO and mem for pci-2-pci bridges with no devices attached Marcel Apfelbaum
2014-04-10 13:29 ` [Qemu-devel] [PATCH V3 1/2] " Marcel Apfelbaum
2014-04-10 15:48 ` Michael S. Tsirkin
2014-04-10 16:45 ` Kevin O'Connor [this message]
2014-04-10 16:58 ` Marcel Apfelbaum
2014-04-10 13:29 ` [Qemu-devel] [PATCH V3 2/2] hw/pci: check if pci2pci bridges implement optional limit registers Marcel Apfelbaum
2014-04-10 15:46 ` Michael S. Tsirkin
2014-04-10 16:29 ` Marcel Apfelbaum
2014-04-10 15:49 ` [Qemu-devel] [SeaBIOS] [PATCH V3 0/2] hw/pci: reserve IO and mem for pci-2-pci bridges with no devices attached Michael S. Tsirkin
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=20140410164502.GA14182@morn.localdomain \
--to=kevin@koconnor.net \
--cc=kraxel@redhat.com \
--cc=marcel.a@redhat.com \
--cc=mst@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=seabios@seabios.org \
/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).