change type of pci_bridge_initfn() to void
PATCH 1/1 change type of pci_bridge_initfn() to void
It always return 0(success), change its type to void, and modify its caller. Doing this can reduce a error path of its caller, and it is also good when convert init() to realize()
--- 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 | 5 +---- hw/pci/pci_bridge.c | 3 +-- include/hw/pci/pci_bridge.h | 2 +- 8 files changed, 10 insertions(+), 31 deletions(-)
leave DEC 21154 PCI-PCI bridge unchanged because it is better to handle it when convert init() to realize().
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
@@ -61,11 +61,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 -4
@@ -636,10 +636,7 @@ 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
Quoted 5 lines · Cao jin
It always return 0(success), change its type to void, and modify its caller. Doing this can reduce a error path of its caller, and it is also good when convert
init()torealize()Signed-off-by Cao jin <[email protected]>
Sounds good, but pls remember to ping me after 2.5 is out.
Quoted 161 lines
--- 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 | 5 +---- hw/pci/pci_bridge.c | 3 +-- include/hw/pci/pci_bridge.h | 2 +- 8 files changed, 10 insertions(+), 31 deletions(-)leave DEC 21154 PCI-PCI bridge unchanged because it is better to handle it when convert
init()torealize().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@@ -61,11 +61,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
-4@@ -636,10 +636,7 @@ 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
Ping
Quoted 174 lines · Michael S. Tsirkin
Quoted 5 lines · Cao jin
It always return 0(success), change its type to void, and modify its caller. Doing this can reduce a error path of its caller, and it is also good when convert
init()torealize()Signed-off-by Cao jin <[email protected]>Sounds good, but pls remember to ping me after 2.5 is out.
Quoted 158 lines
--- 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 | 5 +---- hw/pci/pci_bridge.c | 3 +-- include/hw/pci/pci_bridge.h | 2 +- 8 files changed, 10 insertions(+), 31 deletions(-)leave DEC 21154 PCI-PCI bridge unchanged because it is better to handle it when convert
init()torealize().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@@ -61,11 +61,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
-4@@ -636,10 +636,7 @@ 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
-2@@ -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); --Quoted 3 lines
2.1.0
.
Signature · 3 lines
Yours Sincerely, Cao Jin
Hi mst
friendly ping again...
Quoted 186 lines · Cao jin
Ping
Quoted 182 lines · Michael S. Tsirkin
Quoted 7 lines · Cao jin
It always return 0(success), change its type to void, and modify its caller.
Doing this can reduce a error path of its caller, and it is also good when
convertinit()torealize()Signed-off-by Cao jin <[email protected]>Sounds good, but pls remember to ping me after 2.5 is out.
Quoted 164 lines
--- 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 | 5 +---- hw/pci/pci_bridge.c | 3 +-- include/hw/pci/pci_bridge.h | 2 +- 8 files changed, 10 insertions(+), 31 deletions(-)leave DEC 21154 PCI-PCI bridge unchanged because it is better to handle it
when convertinit()torealize().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@@ -61,11 +61,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
-4@@ -636,10 +636,7 @@ 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
-2@@ -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); --Quoted 3 lines
2.1.0
.
Signature · 3 lines
Yours Sincerely, Cao Jin
Quoted 2 lines · Cao jin
Hi mst
friendly ping again...
This does not work since then this function can not be used as an init callback, and this is how
dec uses it.
Quoted 193 lines · Cao jin
Quoted 186 lines
Ping
Quoted 182 lines · Michael S. Tsirkin
Quoted 7 lines · Cao jin
It always return 0(success), change its type to void, and modify its caller.
Doing this can reduce a error path of its caller, and it is also good when
convertinit()torealize()Signed-off-by Cao jin <[email protected]>Sounds good, but pls remember to ping me after 2.5 is out.
Quoted 164 lines
--- 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 | 5 +---- hw/pci/pci_bridge.c | 3 +-- include/hw/pci/pci_bridge.h | 2 +- 8 files changed, 10 insertions(+), 31 deletions(-)leave DEC 21154 PCI-PCI bridge unchanged because it is better to handle it
when convertinit()torealize().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@@ -61,11 +61,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
-4@@ -636,10 +636,7 @@ 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
-2@@ -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); --Quoted 3 lines
2.1.0
.
Signature · 3 lines
Yours Sincerely, Cao Jin
Hi mst
Quoted 8 lines · Michael S. Tsirkin
Quoted 2 lines · Cao jin
Hi mst
friendly ping again...This does not work since then this function can not be used as an init callback, and this is how
dec uses it.
thanks very much for your time:) I was planning to separate supporting function & device convert to realize() into different patches, but seems it is not suitable for this case. then, I will put "dec: convert to realize" into this patch.
Quoted 197 lines
Quoted 188 lines · Cao jin
Quoted 186 lines
Ping
Quoted 182 lines · Michael S. Tsirkin
Quoted 7 lines · Cao jin
It always return 0(success), change its type to void, and modify its caller.
Doing this can reduce a error path of its caller, and it is also good when
convertinit()torealize()Signed-off-by Cao jin <[email protected]>Sounds good, but pls remember to ping me after 2.5 is out.
Quoted 164 lines
--- 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 | 5 +---- hw/pci/pci_bridge.c | 3 +-- include/hw/pci/pci_bridge.h | 2 +- 8 files changed, 10 insertions(+), 31 deletions(-)leave DEC 21154 PCI-PCI bridge unchanged because it is better to handle it
when convertinit()torealize().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@@ -61,11 +61,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
-4@@ -636,10 +636,7 @@ 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
-2@@ -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); --Quoted 3 lines
2.1.0
.
Quoted 5 lines
--
Yours Sincerely,Cao Jin
.
Signature · 3 lines
Yours Sincerely, Cao Jin
Quoted 12 lines · Cao jin
Hi mst
Quoted 8 lines · Michael S. Tsirkin
Quoted 2 lines · Cao jin
Hi mst
friendly ping again...This does not work since then this function can not be used as an init callback, and this is how
dec uses it.
Quoted 4 lines
thanks very much for your time:) I was planning to separate supporting function & device convert to
realize()into different patches, but seems it is not suitable for this case. then, I will put "dec: convert to realize" into this patch.
OK but how exactly did you test your patch that a build break was missed?
Could you include some info about testing done when you post patches?
Quoted 203 lines
Quoted 197 lines
Quoted 188 lines · Cao jin
Quoted 186 lines
Ping
Quoted 182 lines · Michael S. Tsirkin
Quoted 7 lines · Cao jin
It always return 0(success), change its type to void, and modify its caller.
Doing this can reduce a error path of its caller, and it is also good when
convertinit()torealize()Signed-off-by Cao jin <[email protected]>Sounds good, but pls remember to ping me after 2.5 is out.
Quoted 164 lines
--- 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 | 5 +---- hw/pci/pci_bridge.c | 3 +-- include/hw/pci/pci_bridge.h | 2 +- 8 files changed, 10 insertions(+), 31 deletions(-)leave DEC 21154 PCI-PCI bridge unchanged because it is better to handle it
when convertinit()torealize().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@@ -61,11 +61,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
-4@@ -636,10 +636,7 @@ 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
-2@@ -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); --Quoted 3 lines
2.1.0
.
Quoted 5 lines
--
Yours Sincerely,Cao Jin
.
Signature · 3 lines
Yours Sincerely, Cao Jin
Quoted 18 lines · Michael S. Tsirkin
Quoted 12 lines · Cao jin
Hi mst
Quoted 8 lines · Michael S. Tsirkin
Quoted 2 lines · Cao jin
Hi mst
friendly ping again...This does not work since then this function can not be used as an init callback, and this is how
dec uses it.Quoted 4 lines
thanks very much for your time:) I was planning to separate supporting function & device convert to
realize()into different patches, but seems it is not suitable for this case. then, I will put "dec: convert to realize" into this patch.
Quoted 5 lines
OK but how exactly did you test your patch that a build break was missed?
Could you include some info about testing done when you post patches?
Really really sorry about my carelessness, I just find compiling fail before this mail, really sorry about such kind of silly mistake. I know I have made many silly mistakes before, ashamed of these. I am working hard to avoid these silly mistake later. Again, really sorry, and really thanks the time you spend on this.
Btw, I just thought maybe this patch could be splitted into 2 independent patches, just like v2 I sent.
Quoted 208 lines
Quoted 195 lines
Quoted 195 lines
Quoted 193 lines · Cao jin
Quoted 186 lines
Ping
Quoted 182 lines · Michael S. Tsirkin
Quoted 7 lines · Cao jin
It always return 0(success), change its type to void, and modify its caller.
Doing this can reduce a error path of its caller, and it is also good when
convertinit()torealize()Signed-off-by Cao jin <[email protected]>Sounds good, but pls remember to ping me after 2.5 is out.
Quoted 164 lines
--- 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 | 5 +---- hw/pci/pci_bridge.c | 3 +-- include/hw/pci/pci_bridge.h | 2 +- 8 files changed, 10 insertions(+), 31 deletions(-)leave DEC 21154 PCI-PCI bridge unchanged because it is better to handle it
when convertinit()torealize().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@@ -61,11 +61,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
-4@@ -636,10 +636,7 @@ 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
-2@@ -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); --Quoted 3 lines
2.1.0
.
--
Yours Sincerely,Cao Jin
Quoted 8 lines
Quoted 2 lines
.
--
Yours Sincerely,Cao Jin
.
Signature · 3 lines
Yours Sincerely, Cao Jin