qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [RFC v2 6/6] pci: Remove unnecessary PCIBus variables


From: Cornelia Huck
Subject: Re: [Qemu-devel] [RFC v2 6/6] pci: Remove unnecessary PCIBus variables
Date: Wed, 19 Apr 2017 14:20:02 +0200

On Tue, 18 Apr 2017 19:17:24 -0300
Eduardo Habkost <address@hidden> wrote:

> "phb->bus" is a short expression, there's no need for an extra variable
> just to hold its value.
> 
> Generated using the following Coccinelle patch:
> 
>     @@
>     identifier b;
>     identifier phb;
>     typedef PCIBus;
>     @@
>     -PCIBus *b;
>      ... when != b
>     -b = phb->bus;
>      <...
>     -b
>     +phb->bus
>      ...>
> 
> Cc: Richard Henderson <address@hidden>
> Cc: "Michael S. Tsirkin" <address@hidden>
> Cc: Marcel Apfelbaum <address@hidden>
> Cc: Alexander Graf <address@hidden>
> Cc: Scott Wood <address@hidden>
> Cc: David Gibson <address@hidden>
> Cc: Cornelia Huck <address@hidden>
> Cc: Christian Borntraeger <address@hidden>
> Cc: address@hidden
> Signed-off-by: Eduardo Habkost <address@hidden>
> ---
>  hw/alpha/typhoon.c                  | 10 ++++------
>  hw/pci-bridge/pci_expander_bridge.c |  4 +---
>  hw/pci-host/piix.c                  | 26 +++++++++++++-------------
>  hw/pci-host/ppce500.c               |  8 +++-----
>  hw/ppc/ppc4xx_pci.c                 |  4 +---
>  hw/ppc/spapr_pci.c                  |  6 ++----
>  hw/s390x/s390-pci-bus.c             |  6 ++----
>  7 files changed, 26 insertions(+), 38 deletions(-)
> 

> diff --git a/hw/s390x/s390-pci-bus.c b/hw/s390x/s390-pci-bus.c
> index 5e174e90f4..c2776ba221 100644
> --- a/hw/s390x/s390-pci-bus.c
> +++ b/hw/s390x/s390-pci-bus.c
> @@ -553,7 +553,6 @@ static void s390_pci_iommu_free(S390pciState *s, PCIBus 
> *bus, int32_t devfn)
> 
>  static int s390_pcihost_init(SysBusDevice *dev)
>  {
> -    PCIBus *b;
>      BusState *bus;
>      PCIHostState *phb = PCI_HOST_BRIDGE(dev);
>      S390pciState *s = S390_PCI_HOST_BRIDGE(dev);
> @@ -563,10 +562,9 @@ static int s390_pcihost_init(SysBusDevice *dev)
>      pci_host_bus_init_irqs(phb, NULL, s390_pci_set_irq, s390_pci_map_irq,
>                             NULL, get_system_memory(), get_system_io(), 0, 64,
>                             TYPE_PCI_BUS);
> -    b = phb->bus;
> -    pci_setup_iommu(b, s390_pci_dma_iommu, s);
> +    pci_setup_iommu(phb->bus, s390_pci_dma_iommu, s);
> 
> -    bus = BUS(b);
> +    bus = BUS(phb->bus);

This BusState variable is equally unnecessary, as is it just used in
the line below. But that is outside the scope of that simple coccinelle
patch, so

>      qbus_set_hotplug_handler(bus, DEVICE(dev), NULL);
> 
>      s->bus = S390_PCI_BUS(qbus_create(TYPE_S390_PCI_BUS, DEVICE(s), NULL));

Acked-by: Cornelia Huck <address@hidden>

for the s390 part.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]