Received: from eggs.gnu.org ([2001:4830:134:3::10]:49284) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WYI6I-0007xt-16 for qemu-devel@nongnu.org; Thu, 10 Apr 2014 12:45:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WYI66-0005O4-I2 for qemu-devel@nongnu.org; Thu, 10 Apr 2014 12:45:17 -0400 Received: from mail-pb0-f51.google.com ([209.85.160.51]:33377) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WYI66-0005LP-D4 for qemu-devel@nongnu.org; Thu, 10 Apr 2014 12:45:06 -0400 Received: by mail-pb0-f51.google.com with SMTP id uo5so4161173pbc.24 for ; Thu, 10 Apr 2014 09:45:05 -0700 (PDT) Date: Thu, 10 Apr 2014 12:45:02 -0400 From: Kevin O'Connor Message-ID: <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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1397136581-10500-2-git-send-email-marcel.a@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 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Marcel Apfelbaum Cc: seabios@seabios.org, kraxel@redhat.com, qemu-devel@nongnu.org, mst@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