[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 35/46] hw/intc/i8259: Make using the isa_pic singleton more type-s
From: |
Philippe Mathieu-Daudé |
Subject: |
[PULL 35/46] hw/intc/i8259: Make using the isa_pic singleton more type-safe |
Date: |
Fri, 13 Jan 2023 16:45:21 +0100 |
From: Bernhard Beschow <shentey@gmail.com>
This even spares some casts in hot code paths along the way.
Signed-off-by: Bernhard Beschow <shentey@gmail.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20230109172347.1830-10-shentey@gmail.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
hw/intc/i8259.c | 11 ++++-------
include/hw/intc/i8259.h | 6 +++---
include/qemu/typedefs.h | 1 +
3 files changed, 8 insertions(+), 10 deletions(-)
diff --git a/hw/intc/i8259.c b/hw/intc/i8259.c
index cc4e21ffec..0261f087b2 100644
--- a/hw/intc/i8259.c
+++ b/hw/intc/i8259.c
@@ -55,7 +55,7 @@ struct PICClass {
#ifdef DEBUG_IRQ_LATENCY
static int64_t irq_time[16];
#endif
-DeviceState *isa_pic;
+PICCommonState *isa_pic;
static PICCommonState *slave_pic;
/* return the highest priority found in mask (highest = smallest
@@ -173,9 +173,8 @@ static void pic_intack(PICCommonState *s, int irq)
pic_update_irq(s);
}
-int pic_read_irq(DeviceState *d)
+int pic_read_irq(PICCommonState *s)
{
- PICCommonState *s = PIC_COMMON(d);
int irq, intno;
irq = pic_get_irq(s);
@@ -354,10 +353,8 @@ static uint64_t pic_ioport_read(void *opaque, hwaddr addr,
return ret;
}
-int pic_get_output(DeviceState *d)
+int pic_get_output(PICCommonState *s)
{
- PICCommonState *s = PIC_COMMON(d);
-
return (pic_get_irq(s) >= 0);
}
@@ -426,7 +423,7 @@ qemu_irq *i8259_init(ISABus *bus, qemu_irq parent_irq)
irq_set[i] = qdev_get_gpio_in(dev, i);
}
- isa_pic = dev;
+ isa_pic = PIC_COMMON(dev);
isadev = i8259_init_chip(TYPE_I8259, bus, false);
dev = DEVICE(isadev);
diff --git a/include/hw/intc/i8259.h b/include/hw/intc/i8259.h
index e2b1e8c59a..a0e34dd990 100644
--- a/include/hw/intc/i8259.h
+++ b/include/hw/intc/i8259.h
@@ -3,10 +3,10 @@
/* i8259.c */
-extern DeviceState *isa_pic;
+extern PICCommonState *isa_pic;
qemu_irq *i8259_init(ISABus *bus, qemu_irq parent_irq);
qemu_irq *kvm_i8259_init(ISABus *bus);
-int pic_get_output(DeviceState *d);
-int pic_read_irq(DeviceState *d);
+int pic_get_output(PICCommonState *s);
+int pic_read_irq(PICCommonState *s);
#endif
diff --git a/include/qemu/typedefs.h b/include/qemu/typedefs.h
index 073abab998..fba04875c2 100644
--- a/include/qemu/typedefs.h
+++ b/include/qemu/typedefs.h
@@ -99,6 +99,7 @@ typedef struct PCIExpressDevice PCIExpressDevice;
typedef struct PCIExpressHost PCIExpressHost;
typedef struct PCIHostDeviceAddress PCIHostDeviceAddress;
typedef struct PCIHostState PCIHostState;
+typedef struct PICCommonState PICCommonState;
typedef struct PostcopyDiscardState PostcopyDiscardState;
typedef struct Property Property;
typedef struct PropertyInfo PropertyInfo;
--
2.38.1
- [PULL 24/46] hw/mips/malta: Introduce PIIX4_PCI_DEVFN definition, (continued)
- [PULL 24/46] hw/mips/malta: Introduce PIIX4_PCI_DEVFN definition, Philippe Mathieu-Daudé, 2023/01/13
- [PULL 25/46] hw/mips/malta: Set PIIX4 IRQ routes in embedded bootloader, Philippe Mathieu-Daudé, 2023/01/13
- [PULL 26/46] hw/isa/piix4: Correct IRQRC[A:D] reset values, Philippe Mathieu-Daudé, 2023/01/13
- [PULL 27/46] mips: Remove support for trap and emulate KVM, Philippe Mathieu-Daudé, 2023/01/13
- [PULL 28/46] mips: Always include nanomips disassembler, Philippe Mathieu-Daudé, 2023/01/13
- [PULL 29/46] hw/pci/pci_host: Trace config accesses on unexisting functions, Philippe Mathieu-Daudé, 2023/01/13
- [PULL 30/46] hw/pci/pci: Factor out pci_bus_map_irqs() from pci_bus_irqs(), Philippe Mathieu-Daudé, 2023/01/13
- [PULL 31/46] hw/isa/piix3: Decouple INTx-to-LNKx routing which is board-specific, Philippe Mathieu-Daudé, 2023/01/13
- [PULL 32/46] hw/isa/piix4: Decouple INTx-to-LNKx routing which is board-specific, Philippe Mathieu-Daudé, 2023/01/13
- [PULL 33/46] hw/mips/Kconfig: Track Malta's PIIX dependencies via Kconfig, Philippe Mathieu-Daudé, 2023/01/13
- [PULL 35/46] hw/intc/i8259: Make using the isa_pic singleton more type-safe,
Philippe Mathieu-Daudé <=
- [PULL 34/46] hw/usb/hcd-uhci: Introduce TYPE_ defines for device models, Philippe Mathieu-Daudé, 2023/01/13
- [PULL 36/46] hw/intc: Extract the IRQ counting functions into a separate file, Philippe Mathieu-Daudé, 2023/01/13
- [PULL 38/46] hw/rtc/mc146818rtc: Make the mc146818 RTC device target independent, Philippe Mathieu-Daudé, 2023/01/13
- [PULL 39/46] softmmu/rtc: Emit warning when using driftfix=slew on systems without mc146818, Philippe Mathieu-Daudé, 2023/01/13
- [PULL 40/46] hw/pci-host/bonito: Convert to 3-phase reset, Philippe Mathieu-Daudé, 2023/01/13
- [PULL 41/46] hw/pci-host/bonito: Use 'bonito_host' for PCI host bridge code, Philippe Mathieu-Daudé, 2023/01/13
- [PULL 42/46] hw/pci-host/bonito: Use 'bonito_pci' for PCI function #0 code, Philippe Mathieu-Daudé, 2023/01/13
- [PULL 44/46] hw/mips/boston: Rename MachineState 'mc' pointer to 'ms', Philippe Mathieu-Daudé, 2023/01/13
- [PULL 43/46] hw/pci-host/bonito: Declare TYPE_BONITO_PCI_HOST_BRIDGE in header, Philippe Mathieu-Daudé, 2023/01/13
- [PULL 37/46] hw/core/qdev-properties-system: Allow the 'slew' policy only on x86, Philippe Mathieu-Daudé, 2023/01/13