From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1N8X3F-0000ee-Ji for qemu-devel@nongnu.org; Thu, 12 Nov 2009 05:37:17 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1N8X3C-0000bm-3N for qemu-devel@nongnu.org; Thu, 12 Nov 2009 05:37:17 -0500 Received: from [199.232.76.173] (port=56107 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1N8X3B-0000be-K0 for qemu-devel@nongnu.org; Thu, 12 Nov 2009 05:37:13 -0500 Received: from mx1.redhat.com ([209.132.183.28]:32776) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1N8X3B-0003Mw-4K for qemu-devel@nongnu.org; Thu, 12 Nov 2009 05:37:13 -0500 Date: Thu, 12 Nov 2009 12:34:40 +0200 From: "Michael S. Tsirkin" Message-ID: <20091112103440.GK3785@redhat.com> References: <1258005528-25383-1-git-send-email-yamahata@valinux.co.jp> <1258005528-25383-18-git-send-email-yamahata@valinux.co.jp> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1258005528-25383-18-git-send-email-yamahata@valinux.co.jp> Subject: [Qemu-devel] Re: [PATCH 17/20] pci: remove magic number, 256 in pci.c List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Isaku Yamahata Cc: qemu-devel@nongnu.org On Thu, Nov 12, 2009 at 02:58:45PM +0900, Isaku Yamahata wrote: > This patch replaces magic number, 256, with ARRAY_SIZE(). > > Signed-off-by: Isaku Yamahata Acked-by: Michael S. Tsirkin > --- > hw/pci.c | 5 +++-- > 1 files changed, 3 insertions(+), 2 deletions(-) > > diff --git a/hw/pci.c b/hw/pci.c > index 2eff7fe..dce445a 100644 > --- a/hw/pci.c > +++ b/hw/pci.c > @@ -487,7 +487,8 @@ static PCIDevice *do_pci_register_device(PCIDevice *pci_dev, PCIBus *bus, > uint8_t header_type) > { > if (devfn < 0) { > - for(devfn = bus->devfn_min ; devfn < 256; devfn += 8) { > + for(devfn = bus->devfn_min ; devfn < ARRAY_SIZE(bus->devices); > + devfn += 8) { > if (!bus->devices[devfn]) > goto found; > } > @@ -1025,7 +1026,7 @@ static void pci_for_each_device_under_bus(PCIBus *bus, > PCIDevice *d; > int devfn; > > - for(devfn = 0; devfn < 256; devfn++) { > + for(devfn = 0; devfn < ARRAY_SIZE(bus->devices); devfn++) { > d = bus->devices[devfn]; > if (d) > fn(bus, d); > -- > 1.6.0.2