From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NSwfN-0007J3-Pd for qemu-devel@nongnu.org; Thu, 07 Jan 2010 13:01:01 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NSwfI-0007CQ-I0 for qemu-devel@nongnu.org; Thu, 07 Jan 2010 13:01:01 -0500 Received: from [199.232.76.173] (port=56929 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NSwfI-0007CF-Av for qemu-devel@nongnu.org; Thu, 07 Jan 2010 13:00:56 -0500 Received: from mx1.redhat.com ([209.132.183.28]:5861) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NSwfH-0007ZH-Pv for qemu-devel@nongnu.org; Thu, 07 Jan 2010 13:00:56 -0500 Date: Thu, 7 Jan 2010 16:00:29 -0200 From: Luiz Capitulino Message-ID: <20100107160029.06759f78@doriath> In-Reply-To: <4B45FB80.1010902@linux.vnet.ibm.com> References: <1262723698-23658-1-git-send-email-lcapitulino@redhat.com> <1262723698-23658-4-git-send-email-lcapitulino@redhat.com> <4B45FB80.1010902@linux.vnet.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] Re: [PATCH 3/5] PCI: Convert pci_info() to QObject List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony Liguori Cc: qemu-devel@nongnu.org, mst@redhat.com On Thu, 07 Jan 2010 09:19:28 -0600 Anthony Liguori wrote: > > -static void pci_info_device(PCIBus *bus, PCIDevice *d) > > +static void pci_for_each_device_under_bus(PCIBus *bus, > > + void (*fn)(PCIBus *b, PCIDevice *d)) > > { > > - Monitor *mon = cur_mon; > > - int i, class; > > - PCIIORegion *r; > > - const pci_class_desc *desc; > > + PCIDevice *d; > > + int devfn; > > > > - monitor_printf(mon, " Bus %2d, device %3d, function %d:\n", > > - pci_bus_num(d->bus), > > - PCI_SLOT(d->devfn), PCI_FUNC(d->devfn)); > > - class = pci_get_word(d->config + PCI_CLASS_DEVICE); > > + for(devfn = 0; devfn< ARRAY_SIZE(bus->devices); devfn++) { > > + d = bus->devices[devfn]; > > + if (d) > > + fn(bus, d); > > + } > > +} > > > > Coding style is off. You're missing braces on the if. Was based on the current code, will fix. > The conversion otherwise looks good. I'm not sure mem_type_64 is the > best property name but I'll let mst comment on that. I'd also prefer we > didn't mix case with BAR and IRQ. I'd rather see us just use bar and irq. Ok, will fix too.