[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 12/18] hw/isa: Reduce 'isabus' singleton scope to isa_bus_new(
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH v3 12/18] hw/isa: Reduce 'isabus' singleton scope to isa_bus_new() |
Date: |
Thu, 2 Mar 2023 23:40:52 +0100 |
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 3036341d3b..8e3ca3785e 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
- [PATCH v3 02/18] hw/ide/piix: Allow using PIIX3-IDE as standalone PCI function, (continued)
- [PATCH v3 02/18] hw/ide/piix: Allow using PIIX3-IDE as standalone PCI function, Philippe Mathieu-Daudé, 2023/03/02
- [PATCH v3 03/18] hw/i386/pc_piix: Wire PIIX3 IDE ouput IRQs to ISA bus IRQs 14/15, Philippe Mathieu-Daudé, 2023/03/02
- [PATCH v3 04/18] hw/isa/piix4: Wire PIIX4 IDE ouput IRQs to ISA bus IRQs 14/15, Philippe Mathieu-Daudé, 2023/03/02
- [PATCH v3 05/18] hw/ide: Rename ISA specific ide_init_ioport -> ide_bus_init_ioport_isa, Philippe Mathieu-Daudé, 2023/03/02
- [PATCH v3 06/18] hw/ide/piix: Ensure IDE output IRQs are wired at realization, Philippe Mathieu-Daudé, 2023/03/02
- [PATCH v3 07/18] hw/isa: Deprecate isa_get_irq() in favor of isa_bus_get_irq(), Philippe Mathieu-Daudé, 2023/03/02
- [PATCH v3 08/18] hw/ide: Introduce generic ide_init_ioport(), Philippe Mathieu-Daudé, 2023/03/02
- [PATCH v3 09/18] hw/ide/piix: Use generic ide_bus_init_ioport(), Philippe Mathieu-Daudé, 2023/03/02
- [PATCH v3 10/18] hw/isa: Ensure isa_register_portio_list() do not get NULL ISA device, Philippe Mathieu-Daudé, 2023/03/02
- [PATCH v3 11/18] hw/isa: Simplify isa_address_space[_io](), Philippe Mathieu-Daudé, 2023/03/02
- [PATCH v3 12/18] hw/isa: Reduce 'isabus' singleton scope to isa_bus_new(),
Philippe Mathieu-Daudé <=
- [PATCH v3 13/18] exec/ioport: Factor portio_list_register_flush_coalesced() out, Philippe Mathieu-Daudé, 2023/03/02
- [PATCH v3 14/18] exec/ioport: Factor portio_list_register() out, Philippe Mathieu-Daudé, 2023/03/02
- [PATCH v3 15/18] hw/southbridge/piix: Use OBJECT_DECLARE_SIMPLE_TYPE() macro, Philippe Mathieu-Daudé, 2023/03/02
- [PATCH v3 16/18] hw/isa/piix: Batch register QOM types using DEFINE_TYPES() macro, Philippe Mathieu-Daudé, 2023/03/02
- [PATCH v3 17/18] hw/isa/piix: Unify QOM type name of PIIX ISA function, Philippe Mathieu-Daudé, 2023/03/02
- [PATCH v3 18/18] hw/isa/piix: Unify PIIX-ISA QOM type names using qdev aliases, Philippe Mathieu-Daudé, 2023/03/02
- Re: [PATCH v3 00/18] hw/ide: Untangle ISA/PCI abuses of ide_init_ioport(), Michael S. Tsirkin, 2023/03/02
- Re: [PATCH v3 00/18] hw/ide: Untangle ISA/PCI abuses of ide_init_ioport(), David Woodhouse, 2023/03/03