Re: [PATCH 2/2] pci: drop redundant PCIDeviceClass::is_bridge field

2022-11-16 Thread Igor Mammedov
On Wed, 16 Nov 2022 16:35:10 +0100
Philippe Mathieu-Daudé  wrote:

> On 16/11/22 16:27, Igor Mammedov wrote:
> > and use cast to TYPE_PCI_BRIDGE instead.
> > 
> > Signed-off-by: Igor Mammedov 
> > ---
> >   include/hw/pci/pci.h   | 11 +--
> >   include/hw/pci/pci_bridge.h|  1 +
> >   hw/acpi/pcihp.c|  3 +--
> >   hw/i386/acpi-build.c   |  5 ++---
> >   hw/pci-bridge/cxl_downstream.c |  1 -
> >   hw/pci-bridge/cxl_upstream.c   |  1 -
> >   hw/pci-bridge/i82801b11.c  |  1 -
> >   hw/pci-bridge/pci_bridge_dev.c |  1 -
> >   hw/pci-bridge/pcie_pci_bridge.c|  1 -
> >   hw/pci-bridge/pcie_root_port.c |  1 -
> >   hw/pci-bridge/simba.c  |  1 -
> >   hw/pci-bridge/xio3130_downstream.c |  1 -
> >   hw/pci-bridge/xio3130_upstream.c   |  1 -
> >   hw/pci-host/designware.c   |  1 -
> >   hw/pci-host/xilinx-pcie.c  |  1 -
> >   hw/pci/pci.c   | 20 +---
> >   hw/ppc/spapr_pci.c | 15 +--
> >   17 files changed, 19 insertions(+), 47 deletions(-)  
> 
> > @@ -1090,9 +1088,10 @@ static PCIDevice *do_pci_register_device(PCIDevice 
> > *pci_dev,
> >   Error *local_err = NULL;
> >   DeviceState *dev = DEVICE(pci_dev);
> >   PCIBus *bus = pci_get_bus(pci_dev);
> > +bool is_bridge = IS_PCI_BRIDGE(pci_dev);
> >   
> >   /* Only pci bridges can be attached to extra PCI root buses */
> > -if (pci_bus_is_root(bus) && bus->parent_dev && !pc->is_bridge) {
> > +if (pci_bus_is_root(bus) && bus->parent_dev && 
> > !IS_PCI_BRIDGE(pci_dev)) {  
> 
> Can we use the recently assigned 'is_bridge' variable?

yep, that was an intention behind the variable.
I'll fix it up on respin.

> 
> Otherwise:
> 
> Reviewed-by: Philippe Mathieu-Daudé 
> 




Re: [PATCH 2/2] pci: drop redundant PCIDeviceClass::is_bridge field

2022-11-16 Thread Philippe Mathieu-Daudé

On 16/11/22 16:27, Igor Mammedov wrote:

and use cast to TYPE_PCI_BRIDGE instead.

Signed-off-by: Igor Mammedov 
---
  include/hw/pci/pci.h   | 11 +--
  include/hw/pci/pci_bridge.h|  1 +
  hw/acpi/pcihp.c|  3 +--
  hw/i386/acpi-build.c   |  5 ++---
  hw/pci-bridge/cxl_downstream.c |  1 -
  hw/pci-bridge/cxl_upstream.c   |  1 -
  hw/pci-bridge/i82801b11.c  |  1 -
  hw/pci-bridge/pci_bridge_dev.c |  1 -
  hw/pci-bridge/pcie_pci_bridge.c|  1 -
  hw/pci-bridge/pcie_root_port.c |  1 -
  hw/pci-bridge/simba.c  |  1 -
  hw/pci-bridge/xio3130_downstream.c |  1 -
  hw/pci-bridge/xio3130_upstream.c   |  1 -
  hw/pci-host/designware.c   |  1 -
  hw/pci-host/xilinx-pcie.c  |  1 -
  hw/pci/pci.c   | 20 +---
  hw/ppc/spapr_pci.c | 15 +--
  17 files changed, 19 insertions(+), 47 deletions(-)



@@ -1090,9 +1088,10 @@ static PCIDevice *do_pci_register_device(PCIDevice 
*pci_dev,
  Error *local_err = NULL;
  DeviceState *dev = DEVICE(pci_dev);
  PCIBus *bus = pci_get_bus(pci_dev);
+bool is_bridge = IS_PCI_BRIDGE(pci_dev);
  
  /* Only pci bridges can be attached to extra PCI root buses */

-if (pci_bus_is_root(bus) && bus->parent_dev && !pc->is_bridge) {
+if (pci_bus_is_root(bus) && bus->parent_dev && !IS_PCI_BRIDGE(pci_dev)) {


Can we use the recently assigned 'is_bridge' variable?

Otherwise:

Reviewed-by: Philippe Mathieu-Daudé