From: Marcel Apfelbaum <marcel@redhat.com>
To: Mao Zhongyi <maozy.fnst@cn.fujitsu.com>, qemu-devel@nongnu.org
Cc: mst@redhat.com, armbru@redhat.com
Subject: Re: [Qemu-devel] [PATCH] pci-bridge/i82801b11: Convert to realize
Date: Sat, 27 May 2017 20:01:13 +0300 [thread overview]
Message-ID: <19dc61d7-9779-22a6-03cc-0eb718fe2875@redhat.com> (raw)
In-Reply-To: <5ab8c115-a8de-1d48-155a-3daac7e0d841@cn.fujitsu.com>
On 27/05/2017 9:58, Mao Zhongyi wrote:
>
>
> On 05/26/2017 10:08 PM, Marcel Apfelbaum wrote:
>>
>>
>> On 26/05/2017 15:15, Mao Zhongyi wrote:
>>> The pci-birdge device i82801b11 still implements the old
>>> PCIDeviceClass .init() through i82801b11_bridge_init()
>>> instead of the new .realize(). All devices need to be
>>> converted to .realize(). So convert it and rename it to
>>> i82801b11_bridge_realize().
>>>
>>> Signed-off-by: Mao Zhongyi <maozy.fnst@cn.fujitsu.com>
>>> ---
>>> hw/pci-bridge/i82801b11.c | 9 ++++-----
>>> 1 file changed, 4 insertions(+), 5 deletions(-)
>>>
>>> diff --git a/hw/pci-bridge/i82801b11.c b/hw/pci-bridge/i82801b11.c
>>> index 2404e7e..dca3162 100644
>>> --- a/hw/pci-bridge/i82801b11.c
>>> +++ b/hw/pci-bridge/i82801b11.c
>>> @@ -44,6 +44,7 @@
>>> #include "qemu/osdep.h"
>>> #include "hw/pci/pci.h"
>>> #include "hw/i386/ich9.h"
>>> +#include "qapi/error.h"
>>> /*****************************************************************************/
>>> @@ -58,7 +59,7 @@ typedef struct I82801b11Bridge {
>>> /*< public >*/
>>> } I82801b11Bridge;
>>> -static int i82801b11_bridge_initfn(PCIDevice *d)
>>> +static void i82801b11_bridge_realize(PCIDevice *d, Error **errp)
>>> {
>>> int rc;
>>> @@ -70,12 +71,10 @@ static int i82801b11_bridge_initfn(PCIDevice *d)
>>> goto err_bridge;
>>> }
>>> pci_config_set_prog_interface(d->config,
>>> PCI_CLASS_BRIDGE_PCI_INF_SUB);
>>> - return 0;
>>> + return;
>>> err_bridge:
>>> pci_bridge_exitfn(d);
>>
>> Hi,
>>
>> Since you move to realize, you may want to leverage the errp to add
>> info on errors.
>>
>> Thanks,
>> Marcel
>
>
> Hi, Marcel
>
Hi!
> Thanks for your quick reply and advice. In fact, I have considered
> adding an error
> message to errp when an error occurs. But I found that
> pci_bridge_ssvid_init() has
> reported a specific info when it fails. If the error is reported here
> again, it seems
> a bit more superfluous, so it's not adopted.
I agree we don't want to see the error twice, but that means we may want
to pass the error pointer to pci_bridge_ssvid_init and so on.
One of the main things we achieve when moving to 'realize' is better
error handling, so if we don't do that maybe is not worth it.
You may need to do several changes you didn't intend to
in order to do the error propagation right...
Thanks,
Marcel
> Of course, output a readable error info
> to make it easier for users is also a good choice. So, are you sure
> you want to do
> that?
>
> Look forward to your feedback and suggestion soon.
>
> Thanks a lot.
> Mao
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>>
>
>
next prev parent reply other threads:[~2017-05-27 17:01 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-26 12:15 [Qemu-devel] [PATCH] pci-bridge/i82801b11: Convert to realize Mao Zhongyi
2017-05-26 14:08 ` Marcel Apfelbaum
2017-05-27 6:58 ` Mao Zhongyi
2017-05-27 17:01 ` Marcel Apfelbaum [this message]
2017-05-29 11:37 ` Markus Armbruster
2017-05-31 1:46 ` Mao Zhongyi
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=19dc61d7-9779-22a6-03cc-0eb718fe2875@redhat.com \
--to=marcel@redhat.com \
--cc=armbru@redhat.com \
--cc=maozy.fnst@cn.fujitsu.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 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).