Patchwork [01/24] pseries pci: removed redundant busdev

login
register
mail settings
Submitter Alexander Graf
Date Aug. 15, 2012, 9:58 a.m.
Message ID <1345024742-18394-2-git-send-email-agraf@suse.de>
Download mbox | patch
Permalink /patch/177603/
State New
Headers show

Comments

Alexander Graf - Aug. 15, 2012, 9:58 a.m.
From: Alexey Kardashevskiy <aik@ozlabs.ru>

The PCIHostState struct already contains SysBusDevice so
the one in sPAPRPHBState has to go.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: Alexander Graf <agraf@suse.de>
---
 hw/spapr_pci.c |    4 ++--
 hw/spapr_pci.h |    1 -
 2 files changed, 2 insertions(+), 3 deletions(-)
Andreas Färber - Aug. 15, 2012, 10:17 a.m.
Am 15.08.2012 11:58, schrieb Alexander Graf:
> From: Alexey Kardashevskiy <aik@ozlabs.ru>
> 
> The PCIHostState struct already contains SysBusDevice so
> the one in sPAPRPHBState has to go.
> 
> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
> Signed-off-by: Alexander Graf <agraf@suse.de>

As mentioned, this patch conflicts with my spapr_pci patch in the
pci_host series that Anthony wanted to apply for 1.2.

Andreas

> ---
>  hw/spapr_pci.c |    4 ++--
>  hw/spapr_pci.h |    1 -
>  2 files changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/hw/spapr_pci.c b/hw/spapr_pci.c
> index b2e4f78..5bee180 100644
> --- a/hw/spapr_pci.c
> +++ b/hw/spapr_pci.c
> @@ -276,7 +276,7 @@ static DMAContext *spapr_pci_dma_context_fn(PCIBus *bus, void *opaque,
>  
>  static int spapr_phb_init(SysBusDevice *s)
>  {
> -    sPAPRPHBState *phb = FROM_SYSBUS(sPAPRPHBState, s);
> +    sPAPRPHBState *phb = DO_UPCAST(sPAPRPHBState, host_state.busdev, s);
>      char *namebuf;
>      int i;
>      PCIBus *bus;
> @@ -314,7 +314,7 @@ static int spapr_phb_init(SysBusDevice *s)
>      memory_region_add_subregion(get_system_memory(), phb->io_win_addr,
>                                  &phb->iowindow);
>  
> -    bus = pci_register_bus(&phb->busdev.qdev,
> +    bus = pci_register_bus(&phb->host_state.busdev.qdev,
>                             phb->busname ? phb->busname : phb->dtbusname,
>                             pci_spapr_set_irq, pci_spapr_map_irq, phb,
>                             &phb->memspace, &phb->iospace,
> diff --git a/hw/spapr_pci.h b/hw/spapr_pci.h
> index d9e46e2..a141764 100644
> --- a/hw/spapr_pci.h
> +++ b/hw/spapr_pci.h
> @@ -28,7 +28,6 @@
>  #include "hw/xics.h"
>  
>  typedef struct sPAPRPHBState {
> -    SysBusDevice busdev;
>      PCIHostState host_state;
>  
>      uint64_t buid;
>

Patch

diff --git a/hw/spapr_pci.c b/hw/spapr_pci.c
index b2e4f78..5bee180 100644
--- a/hw/spapr_pci.c
+++ b/hw/spapr_pci.c
@@ -276,7 +276,7 @@  static DMAContext *spapr_pci_dma_context_fn(PCIBus *bus, void *opaque,
 
 static int spapr_phb_init(SysBusDevice *s)
 {
-    sPAPRPHBState *phb = FROM_SYSBUS(sPAPRPHBState, s);
+    sPAPRPHBState *phb = DO_UPCAST(sPAPRPHBState, host_state.busdev, s);
     char *namebuf;
     int i;
     PCIBus *bus;
@@ -314,7 +314,7 @@  static int spapr_phb_init(SysBusDevice *s)
     memory_region_add_subregion(get_system_memory(), phb->io_win_addr,
                                 &phb->iowindow);
 
-    bus = pci_register_bus(&phb->busdev.qdev,
+    bus = pci_register_bus(&phb->host_state.busdev.qdev,
                            phb->busname ? phb->busname : phb->dtbusname,
                            pci_spapr_set_irq, pci_spapr_map_irq, phb,
                            &phb->memspace, &phb->iospace,
diff --git a/hw/spapr_pci.h b/hw/spapr_pci.h
index d9e46e2..a141764 100644
--- a/hw/spapr_pci.h
+++ b/hw/spapr_pci.h
@@ -28,7 +28,6 @@ 
 #include "hw/xics.h"
 
 typedef struct sPAPRPHBState {
-    SysBusDevice busdev;
     PCIHostState host_state;
 
     uint64_t buid;