[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH V3 1/2] hw/pci: reserve IO and mem for pci-2-pci
From: |
Marcel Apfelbaum |
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 19:58:44 +0300 |
On Thu, 2014-04-10 at 12:45 -0400, Kevin O'Connor wrote:
> 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))
> }
Sure!
Thanks for the review,
Marcel
>
> Otherwise, your patches look fine to me.
>
> -Kevin