change type of pci_bridge_initfn()
v4 cover change type of pci_bridge_initfn()
v4 changelog:
1. fix apb bridge build fail as Marcel find.
Test:
1. Compiled on all arch(configure without param)
2. make check passed
3. Hacked to test dec bridge realization, passed.
Cao jin (2):
dec: convert to realize()
change type of pci_bridge_initfn() to void
hw/pci-bridge/dec.c | 6 +++--- hw/pci-bridge/i82801b11.c | 5 +---- hw/pci-bridge/ioh3420.c | 6 +----- hw/pci-bridge/pci_bridge_dev.c | 8 +++----- hw/pci-bridge/xio3130_downstream.c | 6 +----- hw/pci-bridge/xio3130_upstream.c | 6 +----- hw/pci-host/apb.c | 7 +------ hw/pci/pci_bridge.c | 3 +-- include/hw/pci/pci_bridge.h | 2 +- 9 files changed, 13 insertions(+), 36 deletions(-)
Signature · 1 line
2.1.0
PATCH v4 1/2 dec: convert to realize()
Also because pci_bridge_initfn() can`t fail.
--- hw/pci-bridge/dec.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
hw/pci-bridge/dec.c +3 -3
@@ -51,9 +51,9 @@ static int dec_map_irq(PCIDevice *pci_dev, int irq_num)return irq_num; } -static int dec_pci_bridge_initfn (PCIDevice *pci_dev) +static void dec_pci_bridge_realize (PCIDevice *pci_dev,Error **errp) { -return pci_bridge_initfn (pci_dev,TYPE_PCI_BUS ); +pci_bridge_initfn (pci_dev,TYPE_PCI_BUS ); }static void dec_21154_pci_bridge_class_init (ObjectClass *klass,void *data)
@@ -61,7 +61,7 @@ static void dec_21154_pci_bridge_class_init(ObjectClass *klass, void *data)DeviceClass *dc =DEVICE_CLASS (klass);PCIDeviceClass *k =PCI_DEVICE_CLASS (klass); - k->init = dec_pci_bridge_initfn; + k->realize = dec_pci_bridge_realize; k->exit = pci_bridge_exitfn; k->vendor_id =PCI_VENDOR_ID_DEC ; k->device_id =PCI_DEVICE_ID_DEC_21154 ;
Signature · 1 line
2.1.0
PATCH v4 2/2 change type of pci_bridge_initfn() to void
In reply to Cao jinSince it can`t fail. Also modify the callers.
--- hw/pci-bridge/i82801b11.c | 5 +---- hw/pci-bridge/ioh3420.c | 6 +----- hw/pci-bridge/pci_bridge_dev.c | 8 +++----- hw/pci-bridge/xio3130_downstream.c | 6 +----- hw/pci-bridge/xio3130_upstream.c | 6 +----- hw/pci-host/apb.c | 7 +------ hw/pci/pci_bridge.c | 3 +-- include/hw/pci/pci_bridge.h | 2 +- 8 files changed, 10 insertions(+), 33 deletions(-)
hw/pci-bridge/i82801b11.c +1 -4
@@ -61,10 +61,7 @@ static int i82801b11_bridge_initfn(PCIDevice *d) {int rc; - rc =pci_bridge_initfn (d,TYPE_PCI_BUS ); -if (rc <0 ) { -return rc; - } +pci_bridge_initfn (d,TYPE_PCI_BUS ); rc =pci_bridge_ssvid_init (d, I82801ba_SSVID_OFFSET, I82801ba_SSVID_SVID, I82801ba_SSVID_SSID);
hw/pci-bridge/ioh3420.c +1 -5
@@ -97,11 +97,7 @@ static int ioh3420_initfn(PCIDevice *d)PCIESlot *s =PCIE_SLOT (d);int rc; - rc =pci_bridge_initfn (d,TYPE_PCIE_BUS ); -if (rc <0 ) { -return rc; - } - +pci_bridge_initfn (d,TYPE_PCIE_BUS );pcie_port_init_reg (d); rc = pci_bridge_ssvid_init(d, IOH_EP_SSVID_OFFSET,
hw/pci-bridge/pci_bridge_dev.c +3 -5
@@ -52,10 +52,8 @@ static int pci_bridge_dev_initfn(PCIDevice *dev)PCIBridgeDev *bridge_dev =PCI_BRIDGE_DEV (dev);int err; - err =pci_bridge_initfn (dev,TYPE_PCI_BUS ); -if (err) { - goto bridge_error; - } +pci_bridge_initfn (dev,TYPE_PCI_BUS ); +if (bridge_dev->flags & (1 <<PCI_BRIDGE_DEV_F_SHPC_REQ )) { dev->config[PCI_INTERRUPT_PIN ] =0x1 ; memory_region_init(&bridge_dev->bar, OBJECT(dev), "shpc-bar",
@@ -94,7 +92,7 @@ slotid_error: } shpc_error:pci_bridge_exitfn (dev); -bridge_error: +return err; }
hw/pci-bridge/xio3130_downstream.c +1 -5
@@ -60,11 +60,7 @@ static int xio3130_downstream_initfn(PCIDevice *d)PCIESlot *s =PCIE_SLOT (d);int rc; - rc =pci_bridge_initfn (d,TYPE_PCIE_BUS ); -if (rc <0 ) { -return rc; - } - +pci_bridge_initfn (d,TYPE_PCIE_BUS );pcie_port_init_reg (d); rc = msi_init(d, XIO3130_MSI_OFFSET, XIO3130_MSI_NR_VECTOR,
hw/pci-bridge/xio3130_upstream.c +1 -5
@@ -56,11 +56,7 @@ static int xio3130_upstream_initfn(PCIDevice *d)PCIEPort *p =PCIE_PORT (d);int rc; - rc =pci_bridge_initfn (d,TYPE_PCIE_BUS ); -if (rc <0 ) { -return rc; - } - +pci_bridge_initfn (d,TYPE_PCIE_BUS );pcie_port_init_reg (d); rc = msi_init(d, XIO3130_MSI_OFFSET, XIO3130_MSI_NR_VECTOR,
hw/pci-host/apb.c +1 -6
@@ -634,12 +634,7 @@ static void pci_apb_set_irq(void *opaque, int irq_num, int level)static int apb_pci_bridge_initfn (PCIDevice *dev) { -int rc; - - rc =pci_bridge_initfn (dev,TYPE_PCI_BUS ); -if (rc <0 ) { -return rc; - } +pci_bridge_initfn (dev,TYPE_PCI_BUS );/* * command register:
hw/pci/pci_bridge.c +1 -2
@@ -332,7 +332,7 @@ void pci_bridge_reset(DeviceState *qdev) }/* default qdev initialization function for PCI-to-PCI bridge */ -int pci_bridge_initfn (PCIDevice *dev,const char *typename) +void pci_bridge_initfn (PCIDevice *dev,const char *typename) {PCIBus *parent = dev->bus;PCIBridge *br =PCI_BRIDGE (dev);
@@ -378,7 +378,6 @@ int pci_bridge_initfn(PCIDevice *dev, const char *typename) br->windows =pci_bridge_region_init (br);QLIST_INIT (&sec_bus->child);QLIST_INSERT_HEAD (&parent->child, sec_bus, sibling); -return 0 ; }/* default qdev clean up function for PCI-to-PCI bridge */
include/hw/pci/pci_bridge.h +1 -1
@@ -48,7 +48,7 @@ void pci_bridge_disable_base_limit(PCIDevice *dev);void pci_bridge_reset_reg (PCIDevice *dev);void pci_bridge_reset (DeviceState *qdev); -int pci_bridge_initfn (PCIDevice *pci_dev,const char *typename); +void pci_bridge_initfn (PCIDevice *pci_dev,const char *typename);void pci_bridge_exitfn (PCIDevice *pci_dev);
Signature · 1 line
2.1.0
Re: [Qemu-devel] [PATCH v4 2/2] change type of pci_bridge_initfn() to void
Quoted 153 lines · Cao jin
Since it can`t fail. Also modify the callers.
Signed-off-by Cao jin <[email protected]>Reviewed-by Markus Armbruster <[email protected]>--- hw/pci-bridge/i82801b11.c | 5 +---- hw/pci-bridge/ioh3420.c | 6 +----- hw/pci-bridge/pci_bridge_dev.c | 8 +++----- hw/pci-bridge/xio3130_downstream.c | 6 +----- hw/pci-bridge/xio3130_upstream.c | 6 +----- hw/pci-host/apb.c | 7 +------ hw/pci/pci_bridge.c | 3 +-- include/hw/pci/pci_bridge.h | 2 +- 8 files changed, 10 insertions(+), 33 deletions(-)hw/pci-bridge/i82801b11.c +1
-4@@ -61,10 +61,7 @@ static int i82801b11_bridge_initfn(PCIDevice *d) {int rc; - rc =pci_bridge_initfn (d,TYPE_PCI_BUS ); -if (rc <0 ) { -return rc; - } +pci_bridge_initfn (d,TYPE_PCI_BUS ); rc =pci_bridge_ssvid_init (d, I82801ba_SSVID_OFFSET, I82801ba_SSVID_SVID, I82801ba_SSVID_SSID);hw/pci-bridge/ioh3420.c +1
-5@@ -97,11 +97,7 @@ static int ioh3420_initfn(PCIDevice *d)PCIESlot *s =PCIE_SLOT (d);int rc; - rc =pci_bridge_initfn (d,TYPE_PCIE_BUS ); -if (rc <0 ) { -return rc; - } - +pci_bridge_initfn (d,TYPE_PCIE_BUS );pcie_port_init_reg (d); rc = pci_bridge_ssvid_init(d, IOH_EP_SSVID_OFFSET,hw/pci-bridge/pci_bridge_dev.c +3
-5@@ -52,10 +52,8 @@ static int pci_bridge_dev_initfn(PCIDevice *dev)PCIBridgeDev *bridge_dev =PCI_BRIDGE_DEV (dev);int err; - err =pci_bridge_initfn (dev,TYPE_PCI_BUS ); -if (err) { - goto bridge_error; - } +pci_bridge_initfn (dev,TYPE_PCI_BUS ); +if (bridge_dev->flags & (1 <<PCI_BRIDGE_DEV_F_SHPC_REQ )) { dev->config[PCI_INTERRUPT_PIN ] =0x1 ; memory_region_init(&bridge_dev->bar, OBJECT(dev), "shpc-bar",@@ -94,7 +92,7 @@ slotid_error: } shpc_error:pci_bridge_exitfn (dev); -bridge_error: +return err; }hw/pci-bridge/xio3130_downstream.c +1
-5@@ -60,11 +60,7 @@ static int xio3130_downstream_initfn(PCIDevice *d)PCIESlot *s =PCIE_SLOT (d);int rc; - rc =pci_bridge_initfn (d,TYPE_PCIE_BUS ); -if (rc <0 ) { -return rc; - } - +pci_bridge_initfn (d,TYPE_PCIE_BUS );pcie_port_init_reg (d); rc = msi_init(d, XIO3130_MSI_OFFSET, XIO3130_MSI_NR_VECTOR,hw/pci-bridge/xio3130_upstream.c +1
-5@@ -56,11 +56,7 @@ static int xio3130_upstream_initfn(PCIDevice *d)PCIEPort *p =PCIE_PORT (d);int rc; - rc =pci_bridge_initfn (d,TYPE_PCIE_BUS ); -if (rc <0 ) { -return rc; - } - +pci_bridge_initfn (d,TYPE_PCIE_BUS );pcie_port_init_reg (d); rc = msi_init(d, XIO3130_MSI_OFFSET, XIO3130_MSI_NR_VECTOR,hw/pci-host/apb.c +1
-6@@ -634,12 +634,7 @@ static void pci_apb_set_irq(void *opaque, int irq_num, int level)static int apb_pci_bridge_initfn (PCIDevice *dev) { -int rc; - - rc =pci_bridge_initfn (dev,TYPE_PCI_BUS ); -if (rc <0 ) { -return rc; - } +pci_bridge_initfn (dev,TYPE_PCI_BUS );/* * command register: hw/pci/pci_bridge.c +1
-2@@ -332,7 +332,7 @@ void pci_bridge_reset(DeviceState *qdev) }/* default qdev initialization function for PCI-to-PCI bridge */ -int pci_bridge_initfn (PCIDevice *dev,const char *typename) +void pci_bridge_initfn (PCIDevice *dev,const char *typename) {PCIBus *parent = dev->bus;PCIBridge *br =PCI_BRIDGE (dev);@@ -378,7 +378,6 @@ int pci_bridge_initfn(PCIDevice *dev, const char *typename) br->windows =pci_bridge_region_init (br);QLIST_INIT (&sec_bus->child);QLIST_INSERT_HEAD (&parent->child, sec_bus, sibling); -return 0 ; }/* default qdev clean up function for PCI-to-PCI bridge */ include/hw/pci/pci_bridge.h +0
-0
include/hw/pci/pci_bridge.h void pci_bridge_disable_base_limit(PCIDevice *dev); · line 54
Quoted 8 lines
include/hw/pci/pci_bridge.h +1
-1@@ -48,7 +48,7 @@ void pci_bridge_disable_base_limit(PCIDevice *dev);void pci_bridge_reset_reg (PCIDevice *dev);void pci_bridge_reset (DeviceState *qdev); -int pci_bridge_initfn (PCIDevice *pci_dev,const char *typename); +void pci_bridge_initfn (PCIDevice *pci_dev,const char *typename);void pci_bridge_exitfn (PCIDevice *pci_dev);
Looks OK to me,
Thanks,
Marcel
Hi mst,
the series has got reviewed-by for a long while, could it be
accepted now?
Quoted 23 lines · Cao jin
v4 changelog:
1. fix apb bridge build fail as Marcel find.Test:
1. Compiled on all arch(configure without param)
2. make check passed
3. Hacked to test dec bridge realization, passed.Cao jin (2):
dec: convert torealize()
change type ofpci_bridge_initfn()to voidhw/pci-bridge/dec.c | 6 +++--- hw/pci-bridge/i82801b11.c | 5 +---- hw/pci-bridge/ioh3420.c | 6 +----- hw/pci-bridge/pci_bridge_dev.c | 8 +++----- hw/pci-bridge/xio3130_downstream.c | 6 +----- hw/pci-bridge/xio3130_upstream.c | 6 +----- hw/pci-host/apb.c | 7 +------ hw/pci/pci_bridge.c | 3 +-- include/hw/pci/pci_bridge.h | 2 +- 9 files changed, 13 insertions(+), 36 deletions(-)
Signature · 3 lines
Yours Sincerely, Cao jin
Quoted 3 lines · Cao jin
Hi mst,
the series has got reviewed-by for a long while, could it be accepted
now?
Applied now, thanks.
Quoted 30 lines · Cao jin
Quoted 23 lines
v4 changelog:
1. fix apb bridge build fail as Marcel find.Test:
1. Compiled on all arch(configure without param)
2. make check passed
3. Hacked to test dec bridge realization, passed.Cao jin (2):
dec: convert torealize()
change type ofpci_bridge_initfn()to voidhw/pci-bridge/dec.c | 6 +++--- hw/pci-bridge/i82801b11.c | 5 +---- hw/pci-bridge/ioh3420.c | 6 +----- hw/pci-bridge/pci_bridge_dev.c | 8 +++----- hw/pci-bridge/xio3130_downstream.c | 6 +----- hw/pci-bridge/xio3130_upstream.c | 6 +----- hw/pci-host/apb.c | 7 +------ hw/pci/pci_bridge.c | 3 +-- include/hw/pci/pci_bridge.h | 2 +- 9 files changed, 13 insertions(+), 36 deletions(-)Signature · 3 lines
Yours Sincerely, Cao jin