aboutsummaryrefslogtreecommitdiff
path: root/hw/intc
diff options
context:
space:
mode:
authorBernhard Beschow <shentey@gmail.com>2023-01-09 18:23:22 +0100
committerPhilippe Mathieu-Daudé <philmd@linaro.org>2023-01-13 16:22:57 +0100
commit2aaf0ec7ff239523ce2c8d913b120202c219af3e (patch)
treef25f7d6d5f303aec64971b02321c531b439f08be /hw/intc
parentf0712099a29aba335fd1dbf4b19811ad0f57d095 (diff)
downloadqemu-2aaf0ec7ff239523ce2c8d913b120202c219af3e.zip
qemu-2aaf0ec7ff239523ce2c8d913b120202c219af3e.tar.gz
qemu-2aaf0ec7ff239523ce2c8d913b120202c219af3e.tar.bz2
hw/intc/i8259: Make using the isa_pic singleton more type-safe
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>
Diffstat (limited to 'hw/intc')
-rw-r--r--hw/intc/i8259.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/hw/intc/i8259.c b/hw/intc/i8259.c
index cc4e21f..0261f08 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);