From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: qemu-devel@nongnu.org
Cc: "Hervé Poussineau" <hpoussin@reactos.org>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>,
qemu-block@nongnu.org, "John Snow" <jsnow@redhat.com>,
"Eduardo Habkost" <eduardo@habkost.net>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Kevin Wolf" <kwolf@redhat.com>,
qemu-ppc@nongnu.org, "Hanna Reitz" <hreitz@redhat.com>,
"Michael S. Tsirkin" <mst@redhat.com>,
"Richard Henderson" <richard.henderson@linaro.org>,
"Gerd Hoffmann" <kraxel@redhat.com>
Subject: [PATCH v2 16/18] hw/isa: Reduce 'isabus' singleton scope to isa_bus_new()
Date: Wed, 15 Feb 2023 17:16:39 +0100 [thread overview]
Message-ID: <20230215161641.32663-17-philmd@linaro.org> (raw)
In-Reply-To: <20230215161641.32663-1-philmd@linaro.org>
Previous commit ensured when entering isa_register_portio_list(),
'dev' is not NULL. Being a TYPE_ISA_DEVICE, the device must sit
on a ISA bus. This means isa_bus_new() as already been called
and 'isabus' can not be NULL.
Simplify by removing the 'isabus' NULL check in
isa_register_portio_list(). 'isabus' is now only used in
isa_bus_new(). Reduce its scope by only declaring it the
function using it (this will allows us to create multiple
ISA buses later).
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
hw/isa/isa-bus.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/hw/isa/isa-bus.c b/hw/isa/isa-bus.c
index 59f98472d1..719f2e96f2 100644
--- a/hw/isa/isa-bus.c
+++ b/hw/isa/isa-bus.c
@@ -25,8 +25,6 @@
#include "sysemu/sysemu.h"
#include "hw/isa/isa.h"
-static ISABus *isabus;
-
static char *isabus_get_fw_dev_path(DeviceState *dev);
static void isa_bus_class_init(ObjectClass *klass, void *data)
@@ -52,6 +50,8 @@ static const TypeInfo isa_bus_info = {
ISABus *isa_bus_new(DeviceState *dev, MemoryRegion* address_space,
MemoryRegion *address_space_io, Error **errp)
{
+ static ISABus *isabus;
+
if (isabus) {
error_setg(errp, "Can't create a second ISA bus");
return NULL;
@@ -132,10 +132,6 @@ int isa_register_portio_list(ISADevice *dev,
assert(dev);
assert(piolist && !piolist->owner);
- if (!isabus) {
- return -ENODEV;
- }
-
/* START is how we should treat DEV, regardless of the actual
contents of the portio array. This is how the old code
actually handled e.g. the FDC device. */
--
2.38.1
next prev parent reply other threads:[~2023-02-15 16:19 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-15 16:16 [PATCH v2 00/18] hw/ide: Untangle ISA/PCI abuses of ide_init_ioport() Philippe Mathieu-Daudé
2023-02-15 16:16 ` [PATCH v2 01/18] hw/isa: Rename isa_get_dma() -> isa_bus_get_dma() Philippe Mathieu-Daudé
2023-02-24 8:42 ` Thomas Huth
2023-02-15 16:16 ` [PATCH v2 02/18] hw/isa: Factor isa_bus_get_irq() out of isa_get_irq() Philippe Mathieu-Daudé
2023-02-24 8:44 ` Thomas Huth
2023-02-15 16:16 ` [PATCH v2 03/18] hw: Replace isa_get_irq() by isa_bus_get_irq() when ISABus is available Philippe Mathieu-Daudé
2023-02-24 8:51 ` Thomas Huth
2023-02-15 16:16 ` [PATCH v2 04/18] hw/ide/piix: Expose output IRQ as properties for late object population Philippe Mathieu-Daudé
2023-02-15 16:16 ` [PATCH v2 05/18] hw/i386/pc_piix: Wire PIIX3 IDE ouput IRQs to ISA bus IRQs 14/15 Philippe Mathieu-Daudé
2023-02-15 16:16 ` [PATCH v2 06/18] hw/isa/piix4: Wire PIIX4 " Philippe Mathieu-Daudé
2023-02-15 16:16 ` [PATCH v2 07/18] hw/ide/piix: Ensure IDE output IRQs are wired at realization Philippe Mathieu-Daudé
2023-02-16 14:43 ` Bernhard Beschow
2023-02-16 15:33 ` Philippe Mathieu-Daudé
2023-02-16 17:10 ` Bernhard Beschow
2023-02-19 21:54 ` Philippe Mathieu-Daudé
2023-02-20 23:49 ` Bernhard Beschow
2023-02-20 23:58 ` BALATON Zoltan
2023-02-21 11:45 ` Daniel P. Berrangé
2023-02-15 16:16 ` [PATCH v2 08/18] hw/isa: Deprecate isa_get_irq() in favor of isa_bus_get_irq() Philippe Mathieu-Daudé
2023-02-15 16:16 ` [PATCH v2 09/18] hw/isa: Simplify isa_address_space[_io]() Philippe Mathieu-Daudé
2023-02-15 16:16 ` [PATCH v2 10/18] hw/isa: Use isa_address_space_io() in isa_register_ioport() Philippe Mathieu-Daudé
2023-02-15 16:16 ` [PATCH v2 11/18] hw/ide: Declare ide_get_[geometry/bios_chs_trans] in 'hw/ide/internal.h' Philippe Mathieu-Daudé
2023-02-15 16:16 ` [PATCH v2 12/18] hw/ide: Rename ISA specific ide_init_ioport -> ide_bus_init_ioport_isa Philippe Mathieu-Daudé
2023-02-15 16:16 ` [PATCH v2 13/18] hw/ide: Introduce generic ide_init_ioport() Philippe Mathieu-Daudé
2023-02-15 16:16 ` [PATCH v2 14/18] hw/ide/piix: Use generic ide_bus_init_ioport() Philippe Mathieu-Daudé
2023-02-15 16:16 ` [PATCH v2 15/18] hw/isa: Ensure isa_register_portio_list() do not get NULL ISA device Philippe Mathieu-Daudé
2023-02-15 16:16 ` Philippe Mathieu-Daudé [this message]
2023-02-15 16:16 ` [PATCH v2 17/18] hw/isa: Un-inline isa_bus_from_device() Philippe Mathieu-Daudé
2023-02-16 15:28 ` Bernhard Beschow
2023-02-15 16:16 ` [PATCH v2 18/18] hw/isa: Remove empty ISADeviceClass structure Philippe Mathieu-Daudé
2023-02-16 15:28 ` Bernhard Beschow
2023-02-20 8:00 ` [PATCH v2 06.5/18] hw/ide/piix: Allow using PIIX3-IDE as standalone PCI function Philippe Mathieu-Daudé
2023-02-20 9:10 ` Gerd Hoffmann
2023-02-20 9:52 ` Philippe Mathieu-Daudé
2023-02-27 22:26 ` 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=20230215161641.32663-17-philmd@linaro.org \
--to=philmd@linaro.org \
--cc=eduardo@habkost.net \
--cc=hpoussin@reactos.org \
--cc=hreitz@redhat.com \
--cc=jsnow@redhat.com \
--cc=kraxel@redhat.com \
--cc=kwolf@redhat.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
--cc=richard.henderson@linaro.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).