qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v2 0/2] change type of pci_bridge_initfn()
@ 2015-12-24  6:00 Cao jin
  0 siblings, 0 replies; 8+ messages in thread
From: Cao jin @ 2015-12-24  6:00 UTC (permalink / raw)
  To: qemu-devel

V2 changelog
1. 

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                  | 5 +----
 hw/pci/pci_bridge.c                | 3 +--
 include/hw/pci/pci_bridge.h        | 2 +-
 9 files changed, 13 insertions(+), 34 deletions(-)

-- 
2.1.0

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Qemu-devel] [PATCH v2 0/2] change type of pci_bridge_initfn()
@ 2015-12-24  8:08 Cao jin
  2015-12-24  8:08 ` [Qemu-devel] [PATCH v2 1/2] dec: convert to realize() Cao jin
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Cao jin @ 2015-12-24  8:08 UTC (permalink / raw)
  To: qemu-devel

V2 changelog
1. make "dec convert to realize" the 1st patch, so these two could be
   independent from each other.

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                  | 5 +----
 hw/pci/pci_bridge.c                | 3 +--
 include/hw/pci/pci_bridge.h        | 2 +-
 9 files changed, 13 insertions(+), 34 deletions(-)

-- 
2.1.0

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Qemu-devel] [PATCH v2 1/2] dec: convert to realize()
  2015-12-24  8:08 [Qemu-devel] [PATCH v2 0/2] change type of pci_bridge_initfn() Cao jin
@ 2015-12-24  8:08 ` Cao jin
  2016-01-11 19:07   ` Markus Armbruster
  2015-12-24  8:08 ` [Qemu-devel] [PATCH v2 2/2] change type of pci_bridge_initfn() to void Cao jin
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 8+ messages in thread
From: Cao jin @ 2015-12-24  8:08 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-ppc, agraf, mst

Signed-off-by: Cao jin <caoj.fnst@cn.fujitsu.com>
---
 hw/pci-bridge/dec.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/hw/pci-bridge/dec.c b/hw/pci-bridge/dec.c
index 28d0ff9..be0fc46 100644
--- a/hw/pci-bridge/dec.c
+++ b/hw/pci-bridge/dec.c
@@ -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;
-- 
2.1.0

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [Qemu-devel] [PATCH v2 2/2] change type of pci_bridge_initfn() to void
  2015-12-24  8:08 [Qemu-devel] [PATCH v2 0/2] change type of pci_bridge_initfn() Cao jin
  2015-12-24  8:08 ` [Qemu-devel] [PATCH v2 1/2] dec: convert to realize() Cao jin
@ 2015-12-24  8:08 ` Cao jin
  2016-01-07 12:47 ` [Qemu-devel] [PATCH v2 0/2] change type of pci_bridge_initfn() Cao jin
  2016-01-11 19:07 ` Markus Armbruster
  3 siblings, 0 replies; 8+ messages in thread
From: Cao jin @ 2015-12-24  8:08 UTC (permalink / raw)
  To: qemu-devel; +Cc: mst

It always return 0(success), change its type to void, and modify the callers.
So it can reduce a error path of its callers.

Signed-off-by: Cao jin <caoj.fnst@cn.fujitsu.com>
---
 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(-)

diff --git a/hw/pci-bridge/i82801b11.c b/hw/pci-bridge/i82801b11.c
index 7e79bc0..b21bc2c 100644
--- a/hw/pci-bridge/i82801b11.c
+++ b/hw/pci-bridge/i82801b11.c
@@ -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);
diff --git a/hw/pci-bridge/ioh3420.c b/hw/pci-bridge/ioh3420.c
index cce2fdd..eead195 100644
--- a/hw/pci-bridge/ioh3420.c
+++ b/hw/pci-bridge/ioh3420.c
@@ -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,
diff --git a/hw/pci-bridge/pci_bridge_dev.c b/hw/pci-bridge/pci_bridge_dev.c
index 26aded9..bc3e1b7 100644
--- a/hw/pci-bridge/pci_bridge_dev.c
+++ b/hw/pci-bridge/pci_bridge_dev.c
@@ -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;
 }
 
diff --git a/hw/pci-bridge/xio3130_downstream.c b/hw/pci-bridge/xio3130_downstream.c
index b3a6479..b4dd25f 100644
--- a/hw/pci-bridge/xio3130_downstream.c
+++ b/hw/pci-bridge/xio3130_downstream.c
@@ -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,
diff --git a/hw/pci-bridge/xio3130_upstream.c b/hw/pci-bridge/xio3130_upstream.c
index eada582..434c8fd 100644
--- a/hw/pci-bridge/xio3130_upstream.c
+++ b/hw/pci-bridge/xio3130_upstream.c
@@ -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,
diff --git a/hw/pci-host/apb.c b/hw/pci-host/apb.c
index 599768e..e9117b9 100644
--- a/hw/pci-host/apb.c
+++ b/hw/pci-host/apb.c
@@ -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:
diff --git a/hw/pci/pci_bridge.c b/hw/pci/pci_bridge.c
index 40c97b1..5c30795 100644
--- a/hw/pci/pci_bridge.c
+++ b/hw/pci/pci_bridge.c
@@ -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 */
diff --git a/include/hw/pci/pci_bridge.h b/include/hw/pci/pci_bridge.h
index 93b621c..ed4aff6 100644
--- a/include/hw/pci/pci_bridge.h
+++ b/include/hw/pci/pci_bridge.h
@@ -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);
 
 
-- 
2.1.0

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] [PATCH v2 0/2] change type of pci_bridge_initfn()
  2015-12-24  8:08 [Qemu-devel] [PATCH v2 0/2] change type of pci_bridge_initfn() Cao jin
  2015-12-24  8:08 ` [Qemu-devel] [PATCH v2 1/2] dec: convert to realize() Cao jin
  2015-12-24  8:08 ` [Qemu-devel] [PATCH v2 2/2] change type of pci_bridge_initfn() to void Cao jin
@ 2016-01-07 12:47 ` Cao jin
  2016-01-11 19:07 ` Markus Armbruster
  3 siblings, 0 replies; 8+ messages in thread
From: Cao jin @ 2016-01-07 12:47 UTC (permalink / raw)
  To: Michael S. Tsirkin; +Cc: qemu-devel

Hi,
     I am just wondering, could this patchset be accepted?
     dec bridge has been tested, its realization is ok

On 12/24/2015 04:08 PM, Cao jin wrote:
> V2 changelog
> 1. make "dec convert to realize" the 1st patch, so these two could be
>     independent from each other.
>
> 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                  | 5 +----
>   hw/pci/pci_bridge.c                | 3 +--
>   include/hw/pci/pci_bridge.h        | 2 +-
>   9 files changed, 13 insertions(+), 34 deletions(-)
>

-- 
Yours Sincerely,

Cao jin

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] [PATCH v2 1/2] dec: convert to realize()
  2015-12-24  8:08 ` [Qemu-devel] [PATCH v2 1/2] dec: convert to realize() Cao jin
@ 2016-01-11 19:07   ` Markus Armbruster
  2016-01-12  3:17     ` Cao jin
  0 siblings, 1 reply; 8+ messages in thread
From: Markus Armbruster @ 2016-01-11 19:07 UTC (permalink / raw)
  To: Cao jin; +Cc: mst, qemu-ppc, qemu-devel, agraf

Cao jin <caoj.fnst@cn.fujitsu.com> writes:

> Signed-off-by: Cao jin <caoj.fnst@cn.fujitsu.com>
> ---
>  hw/pci-bridge/dec.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/hw/pci-bridge/dec.c b/hw/pci-bridge/dec.c
> index 28d0ff9..be0fc46 100644
> --- a/hw/pci-bridge/dec.c
> +++ b/hw/pci-bridge/dec.c
> @@ -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;

Correct because pci_bridge_initfn() can't fail.  Suggest to mention that
in the commit message.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] [PATCH v2 0/2] change type of pci_bridge_initfn()
  2015-12-24  8:08 [Qemu-devel] [PATCH v2 0/2] change type of pci_bridge_initfn() Cao jin
                   ` (2 preceding siblings ...)
  2016-01-07 12:47 ` [Qemu-devel] [PATCH v2 0/2] change type of pci_bridge_initfn() Cao jin
@ 2016-01-11 19:07 ` Markus Armbruster
  3 siblings, 0 replies; 8+ messages in thread
From: Markus Armbruster @ 2016-01-11 19:07 UTC (permalink / raw)
  To: Cao jin; +Cc: qemu-devel

Cao jin <caoj.fnst@cn.fujitsu.com> writes:

> V2 changelog
> 1. make "dec convert to realize" the 1st patch, so these two could be
>    independent from each other.

Series
Reviewed-by: Markus Armbruster <armbru@redhat.com>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] [PATCH v2 1/2] dec: convert to realize()
  2016-01-11 19:07   ` Markus Armbruster
@ 2016-01-12  3:17     ` Cao jin
  0 siblings, 0 replies; 8+ messages in thread
From: Cao jin @ 2016-01-12  3:17 UTC (permalink / raw)
  To: Markus Armbruster; +Cc: agraf, qemu-ppc, qemu-devel, mst



On 01/12/2016 03:07 AM, Markus Armbruster wrote:
> Cao jin <caoj.fnst@cn.fujitsu.com> writes:
>
[...]
>
> Correct because pci_bridge_initfn() can't fail.  Suggest to mention that
> in the commit message.

Ok, thanks for suggestion:)

-- 
Yours Sincerely,

Cao jin

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2016-01-12  3:14 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-24  8:08 [Qemu-devel] [PATCH v2 0/2] change type of pci_bridge_initfn() Cao jin
2015-12-24  8:08 ` [Qemu-devel] [PATCH v2 1/2] dec: convert to realize() Cao jin
2016-01-11 19:07   ` Markus Armbruster
2016-01-12  3:17     ` Cao jin
2015-12-24  8:08 ` [Qemu-devel] [PATCH v2 2/2] change type of pci_bridge_initfn() to void Cao jin
2016-01-07 12:47 ` [Qemu-devel] [PATCH v2 0/2] change type of pci_bridge_initfn() Cao jin
2016-01-11 19:07 ` Markus Armbruster
  -- strict thread matches above, loose matches on Subject: below --
2015-12-24  6:00 Cao jin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).