From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53041) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WYIKC-0003c8-AX for qemu-devel@nongnu.org; Thu, 10 Apr 2014 12:59:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WYIK2-0001gq-Lz for qemu-devel@nongnu.org; Thu, 10 Apr 2014 12:59:40 -0400 Received: from mx1.redhat.com ([209.132.183.28]:18366) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WYIK2-0001gj-Dw for qemu-devel@nongnu.org; Thu, 10 Apr 2014 12:59:30 -0400 Message-ID: <1397149124.28469.30.camel@localhost.localdomain> From: Marcel Apfelbaum Date: Thu, 10 Apr 2014 19:58:44 +0300 In-Reply-To: <20140410164502.GA14182@morn.localdomain> References: <1397136581-10500-1-git-send-email-marcel.a@redhat.com> <1397136581-10500-2-git-send-email-marcel.a@redhat.com> <20140410164502.GA14182@morn.localdomain> Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH V3 1/2] hw/pci: reserve IO and mem for pci-2-pci bridges with no devices attached List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin O'Connor Cc: seabios@seabios.org, kraxel@redhat.com, qemu-devel@nongnu.org, mst@redhat.com 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