[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [patch 01/18] qemu: add pci helper functions
From: |
Paul Brook |
Subject: |
Re: [Qemu-devel] [patch 01/18] qemu: add pci helper functions |
Date: |
Wed, 4 Feb 2009 14:56:20 +0000 |
User-agent: |
KMail/1.9.9 |
On Wednesday 04 February 2009, Marcelo Tosatti wrote:
> +PCIDevice *pci_find_device(int bus_num, int slot)
> +{
> + int devfn;
> + PCIDevice *d;
> + PCIBus *bus = pci_find_bus(bus_num);
> +
> + if (!bus)
> + return NULL;
> +
> + for(devfn = 0; devfn < 256; devfn++) {
> + d = bus->devices[devfn];
> + if (d && PCI_SLOT(devfn) == slot)
> + return d;
> + }
> + return NULL;
> +}
This loop is bogus. You already know the devfn from the slot.
It's also completely busted if you have multifunction devices.
Paul
- [Qemu-devel] [patch 00/18] acpi pci hotplug support, Marcelo Tosatti, 2009/02/04
- [Qemu-devel] [patch 02/18] qemu: return PCIDevice on net device init and record devfn, Marcelo Tosatti, 2009/02/04
- [Qemu-devel] [patch 03/18] qemu: dynamic drive/drive_opt index allocation, Marcelo Tosatti, 2009/02/04
- [Qemu-devel] [patch 04/18] qemu: dynamic nic info index allocation, Marcelo Tosatti, 2009/02/04
- [Qemu-devel] [patch 05/18] qemu: drive removal support, Marcelo Tosatti, 2009/02/04
- [Qemu-devel] [patch 06/18] qemu: record devfn on block driver instance, Marcelo Tosatti, 2009/02/04
- [Qemu-devel] [patch 07/18] qemu: move drives_opt for external use, Marcelo Tosatti, 2009/02/04
- [Qemu-devel] [patch 09/18] qemu: add net_client_uninit / qemu_find_vlan_client, Marcelo Tosatti, 2009/02/04
- [Qemu-devel] [patch 08/18] qemu: net/drive add/remove tweaks, Marcelo Tosatti, 2009/02/04