diff mbox

[4/4] Rename PCI_FUNC_MAX to PCI_FUNCTIONS_PER_DEVICES in pci.[ch]

Message ID 20100824132811.GD19469@kt
State New
Headers show

Commit Message

Ken CC Aug. 24, 2010, 1:28 p.m. UTC
PCI_FUNC_MAX is introduced by
6eab3de16d36c48a983366b09d0a0029a5260bc3
and
6fa84913eccec4266a27c81ae88465f6790742b9
which should be safe to rename to PCI_FUNCTIONS_PER_DEVICES.

Signed-off-by: Ken CC <ken.ccao@gmail.com>
---
 hw/pci.c |    4 ++--
 hw/pci.h |    1 -
 2 files changed, 2 insertions(+), 3 deletions(-)

Comments

Michael S. Tsirkin Sept. 7, 2010, 5:22 p.m. UTC | #1
On Tue, Aug 24, 2010 at 09:28:11PM +0800, Ken CC wrote:
> PCI_FUNC_MAX is introduced by
> 6eab3de16d36c48a983366b09d0a0029a5260bc3
> and
> 6fa84913eccec4266a27c81ae88465f6790742b9
> which should be safe to rename to PCI_FUNCTIONS_PER_DEVICES.
> 
> Signed-off-by: Ken CC <ken.ccao@gmail.com>

I liked the shorter name better ...

> ---
>  hw/pci.c |    4 ++--
>  hw/pci.h |    1 -
>  2 files changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/hw/pci.c b/hw/pci.c
> index fc4becd..3901455 100644
> --- a/hw/pci.c
> +++ b/hw/pci.c
> @@ -711,7 +711,7 @@ static int pci_init_multifunction(PCIBus *bus, PCIDevice *dev)
>          return 0;
>      }
>      /* function 0 indicates single function, so function > 0 must be NULL */
> -    for (func = 1; func < PCI_FUNC_MAX; ++func) {
> +    for (func = 1; func < PCI_FUNCTIONS_PER_DEVICE; ++func) {
>          if (bus->devices[PCI_DEVFN(slot, func)]) {
>              error_report("PCI: %x.0 indicates single function, "
>                           "but %x.%x is already populated.",
> @@ -750,7 +750,7 @@ static PCIDevice *do_pci_register_device(PCIDevice *pci_dev, PCIBus *bus,
>      assert(devfn / PCI_FUNCTIONS_PER_DEVICE < PCIBUS_MAX_DEVICES);
>      if (devfn < 0) {
>          for(devfn = bus->devfn_min ; devfn < ARRAY_SIZE(bus->devices);
> -            devfn += PCI_FUNC_MAX) {
> +            devfn += PCI_FUNCTIONS_PER_DEVICE) {
>              if (!bus->devices[devfn])
>                  goto found;
>          }
> diff --git a/hw/pci.h b/hw/pci.h
> index eb97b76..f6fb6d8 100644
> --- a/hw/pci.h
> +++ b/hw/pci.h
> @@ -16,7 +16,6 @@ struct kvm_irq_routing_entry;
>  #define PCI_DEVFN(slot, func)   ((((slot) & 0x1f) << 3) | ((func) & 0x07))
>  #define PCI_SLOT(devfn)         (((devfn) >> 3) & 0x1f)
>  #define PCI_FUNC(devfn)         ((devfn) & 0x07)
> -#define PCI_FUNC_MAX            8
>  #define PCI_FUNCTIONS_PER_DEVICE 8
>  #define PCIBUS_MAX_DEVICES 32
>
diff mbox

Patch

diff --git a/hw/pci.c b/hw/pci.c
index fc4becd..3901455 100644
--- a/hw/pci.c
+++ b/hw/pci.c
@@ -711,7 +711,7 @@  static int pci_init_multifunction(PCIBus *bus, PCIDevice *dev)
         return 0;
     }
     /* function 0 indicates single function, so function > 0 must be NULL */
-    for (func = 1; func < PCI_FUNC_MAX; ++func) {
+    for (func = 1; func < PCI_FUNCTIONS_PER_DEVICE; ++func) {
         if (bus->devices[PCI_DEVFN(slot, func)]) {
             error_report("PCI: %x.0 indicates single function, "
                          "but %x.%x is already populated.",
@@ -750,7 +750,7 @@  static PCIDevice *do_pci_register_device(PCIDevice *pci_dev, PCIBus *bus,
     assert(devfn / PCI_FUNCTIONS_PER_DEVICE < PCIBUS_MAX_DEVICES);
     if (devfn < 0) {
         for(devfn = bus->devfn_min ; devfn < ARRAY_SIZE(bus->devices);
-            devfn += PCI_FUNC_MAX) {
+            devfn += PCI_FUNCTIONS_PER_DEVICE) {
             if (!bus->devices[devfn])
                 goto found;
         }
diff --git a/hw/pci.h b/hw/pci.h
index eb97b76..f6fb6d8 100644
--- a/hw/pci.h
+++ b/hw/pci.h
@@ -16,7 +16,6 @@  struct kvm_irq_routing_entry;
 #define PCI_DEVFN(slot, func)   ((((slot) & 0x1f) << 3) | ((func) & 0x07))
 #define PCI_SLOT(devfn)         (((devfn) >> 3) & 0x1f)
 #define PCI_FUNC(devfn)         ((devfn) & 0x07)
-#define PCI_FUNC_MAX            8
 #define PCI_FUNCTIONS_PER_DEVICE 8
 #define PCIBUS_MAX_DEVICES 32