From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: Markus Armbruster <armbru@redhat.com>,
Bernhard Beschow <shentey@gmail.com>
Cc: qemu-devel@nongnu.org, qemu-ppc@nongnu.org,
"Eduardo Habkost" <eduardo@habkost.net>,
"Gerd Hoffmann" <kraxel@redhat.com>,
"Michael S. Tsirkin" <mst@redhat.com>,
"Hervé Poussineau" <hpoussin@reactos.org>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Richard Henderson" <richard.henderson@linaro.org>,
"Aleksandar Rikalo" <aleksandar.rikalo@syrmia.com>,
"Marcel Apfelbaum" <marcel.apfelbaum@gmail.com>,
"Mark Cave-Ayland" <mark.cave-ayland@ilande.co.uk>
Subject: Re: [PATCH v2] hw/audio/pcspk: Inline pcspk_init()
Date: Thu, 19 Oct 2023 23:44:40 +0200 [thread overview]
Message-ID: <5fd6c6c2-5245-c73c-6683-5136751dbde5@linaro.org> (raw)
In-Reply-To: <87ttqmcxc3.fsf@pond.sub.org>
On 19/10/23 19:54, Markus Armbruster wrote:
> Bernhard Beschow <shentey@gmail.com> writes:
>
>> Am 19. Oktober 2023 07:33:07 UTC schrieb "Philippe Mathieu-Daudé" <philmd@linaro.org>:
>>> pcspk_init() is a legacy init function, inline and remove it.
>>>
>>> Since the device is realized using &error_fatal, use the same
>>> error for setting the "pit" link.
>>>
>>> Reviewed-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
>>> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>
> [...]
>
>>> diff --git a/hw/isa/i82378.c b/hw/isa/i82378.c
>>> index 63e0857208..79ffbb52a0 100644
>>> --- a/hw/isa/i82378.c
>>> +++ b/hw/isa/i82378.c
>>> @@ -67,6 +67,7 @@ static void i82378_realize(PCIDevice *pci, Error **errp)
>>> uint8_t *pci_conf;
>>> ISABus *isabus;
>>> ISADevice *pit;
>>> + ISADevice *pcspk;
>>>
>>> pci_conf = pci->config;
>>> pci_set_word(pci_conf + PCI_COMMAND,
>>> @@ -102,7 +103,9 @@ static void i82378_realize(PCIDevice *pci, Error **errp)
>>> pit = i8254_pit_init(isabus, 0x40, 0, NULL);
>>>
>>> /* speaker */
>>> - pcspk_init(isa_new(TYPE_PC_SPEAKER), isabus, pit);
>>> + pcspk = isa_new(TYPE_PC_SPEAKER);
>>> + object_property_set_link(OBJECT(pcspk), "pit", OBJECT(pit), &error_fatal);
>>> + isa_realize_and_unref(pcspk, isabus, &error_fatal);
>>
>> Why not pass errp here? I think that was Mark's comment in v1.
That would more than "inlining". Can be updated on top, but so far
this function is not error proof, so I'm not really worried.
> &error_fatal is almost always wrong in a function that takes Error **.
> Happy to explain in more detail if needed.
>
> [...]
>
next prev parent reply other threads:[~2023-10-19 21:45 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-19 7:33 [PATCH v2] hw/audio/pcspk: Inline pcspk_init() Philippe Mathieu-Daudé
2023-10-19 10:23 ` Bernhard Beschow
2023-10-19 17:54 ` Markus Armbruster
2023-10-19 21:44 ` Philippe Mathieu-Daudé [this message]
2023-10-20 4:49 ` Markus Armbruster
2023-10-20 10:02 ` Philippe Mathieu-Daudé
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=5fd6c6c2-5245-c73c-6683-5136751dbde5@linaro.org \
--to=philmd@linaro.org \
--cc=aleksandar.rikalo@syrmia.com \
--cc=armbru@redhat.com \
--cc=eduardo@habkost.net \
--cc=hpoussin@reactos.org \
--cc=kraxel@redhat.com \
--cc=marcel.apfelbaum@gmail.com \
--cc=mark.cave-ayland@ilande.co.uk \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
--cc=richard.henderson@linaro.org \
--cc=shentey@gmail.com \
/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).