From: "Wei, Jiangang" <weijg.fnst@cn.fujitsu.com>
To: "armbru@redhat.com" <armbru@redhat.com>
Cc: "marcel@redhat.com" <marcel@redhat.com>,
"Cao, Jin" <caoj.fnst@cn.fujitsu.com>,
"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
"mst@redhat.com" <mst@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v3 2/2] hw/pci-bridge: Convert pxb initialization functions to Error
Date: Thu, 24 Mar 2016 00:40:00 +0000 [thread overview]
Message-ID: <1458779994.2191.2.camel@localhost> (raw)
In-Reply-To: <87d1ql8km4.fsf@blackfin.pond.sub.org>
On Wed, 2016-03-23 at 13:05 +0100, Markus Armbruster wrote:
> Wei Jiangang <weijg.fnst@cn.fujitsu.com> writes:
>
> > Firstly, convert pxb_dev_init_common() to Error and rename
> > it to pxb_dev_realize_common().
> > Actually, pxb_register_bus() is converted as well.
> >
> > And then,
> > convert pxb_dev_initfn() and pxb_pcie_dev_initfn() to Error,
> > rename them to pxb_dev_realize() and pxb_pcie_dev_realize()
> > respectively.
> > ---
> > hw/pci-bridge/pci_expander_bridge.c | 54 ++++++++++++++++++-------------------
> > 1 file changed, 27 insertions(+), 27 deletions(-)
> >
> > diff --git a/hw/pci-bridge/pci_expander_bridge.c b/hw/pci-bridge/pci_expander_bridge.c
> > index ba320bd..6f53a6b 100644
> > --- a/hw/pci-bridge/pci_expander_bridge.c
> > +++ b/hw/pci-bridge/pci_expander_bridge.c
> > @@ -160,30 +160,25 @@ static const TypeInfo pxb_host_info = {
> > };
> >
> > /*
> > - * Registers the PXB bus as a child of the i440fx root bus.
> > - *
> > - * Returns 0 on successs, -1 if i440fx host was not
> > - * found or the bus number is already in use.
> > + * Registers the PXB bus as a child of pci host root bus.
> > */
> > -static int pxb_register_bus(PCIDevice *dev, PCIBus *pxb_bus)
> > +static void pxb_register_bus(PCIDevice *dev, PCIBus *pxb_bus, Error **errp)
> > {
> > PCIBus *bus = dev->bus;
> > int pxb_bus_num = pci_bus_num(pxb_bus);
> >
> > if (bus->parent_dev) {
> > - error_report("PXB devices can be attached only to root bus.");
> > - return -1;
> > + error_setg(errp, "PXB devices can be attached only to root bus");
> > + return;
> > }
> >
> > QLIST_FOREACH(bus, &bus->child, sibling) {
> > if (pci_bus_num(bus) == pxb_bus_num) {
> > - error_report("Bus %d is already in use.", pxb_bus_num);
> > - return -1;
> > + error_setg(errp, "Bus %d is already in use", pxb_bus_num);
> > + return;
> > }
> > }
> > QLIST_INSERT_HEAD(&dev->bus->child, pxb_bus, sibling);
> > -
> > - return 0;
> > }
> >
> > static int pxb_map_irq_fn(PCIDevice *pci_dev, int pin)
> > @@ -213,17 +208,21 @@ static gint pxb_compare(gconstpointer a, gconstpointer b)
> > 0;
> > }
> >
> > -static int pxb_dev_init_common(PCIDevice *dev, bool pcie)
> > +static void pxb_dev_realize_common(PCIDevice *dev, bool pcie, Error **errp)
> > {
> > PXBDev *pxb = convert_to_pxb(dev);
> > DeviceState *ds, *bds = NULL;
> > PCIBus *bus;
> > const char *dev_name = NULL;
> > + Error *err = NULL;
> >
> > if (pxb->numa_node != NUMA_NODE_UNASSIGNED &&
> > pxb->numa_node >= nb_numa_nodes) {
> > - error_report("Illegal numa node %d.", pxb->numa_node);
> > - return -EINVAL;
> > + error_setg(&err, "Illegal numa node %d", pxb->numa_node);
> > + if (err) {
> > + error_propagate(errp, err);
> > + }
>
> No. v2 got it right.
Thanks for your response.
OK, Let us discard v3.
>
> > + return;
> > }
> >
> > if (dev->qdev.id && *dev->qdev.id) {
> [...]
>
>
next prev parent reply other threads:[~2016-03-24 0:40 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-23 10:08 [Qemu-devel] [PATCH v3 0/2] Convert pxb initfn to Error Wei Jiangang
2016-03-23 10:08 ` [Qemu-devel] [PATCH v3 1/2] hw/pci-bridge: Add missing unref in case register-bus fails Wei Jiangang
2016-03-23 10:08 ` [Qemu-devel] [PATCH v3 2/2] hw/pci-bridge: Convert pxb initialization functions to Error Wei Jiangang
2016-03-23 12:05 ` Markus Armbruster
2016-03-24 0:40 ` Wei, Jiangang [this message]
-- strict thread matches above, loose matches on Subject: below --
2016-04-07 16:55 [Qemu-devel] [PATCH v2 0/2] Convert pxb initfn " Michael S. Tsirkin
2016-04-08 7:55 ` [Qemu-devel] [PATCH v3 2/2] hw/pci-bridge: Convert pxb initialization functions " Wei Jiangang
2016-04-08 9:35 ` Michael S. Tsirkin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1458779994.2191.2.camel@localhost \
--to=weijg.fnst@cn.fujitsu.com \
--cc=armbru@redhat.com \
--cc=caoj.fnst@cn.fujitsu.com \
--cc=marcel@redhat.com \
--cc=mst@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.