diff mbox series

[v3,07/18] hw/isa: Deprecate isa_get_irq() in favor of isa_bus_get_irq()

Message ID 20230302224058.43315-8-philmd@linaro.org
State New
Headers show
Series hw/ide: Untangle ISA/PCI abuses of ide_init_ioport() | expand

Commit Message

Philippe Mathieu-Daudé March 2, 2023, 10:40 p.m. UTC
Last commit removed the last use of isa_get_irq(NULL).
Add an assertion to ensure we won't use that hack again.
Deprecate in favor of the BUS API: isa_bus_get_irq().

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 hw/isa/isa-bus.c     | 6 +++---
 include/hw/isa/isa.h | 3 ++-
 2 files changed, 5 insertions(+), 4 deletions(-)

Comments

Mark Cave-Ayland April 26, 2023, 1:12 p.m. UTC | #1
On 02/03/2023 22:40, Philippe Mathieu-Daudé wrote:

> Last commit removed the last use of isa_get_irq(NULL).
> Add an assertion to ensure we won't use that hack again.
> Deprecate in favor of the BUS API: isa_bus_get_irq().
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>   hw/isa/isa-bus.c     | 6 +++---
>   include/hw/isa/isa.h | 3 ++-
>   2 files changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/hw/isa/isa-bus.c b/hw/isa/isa-bus.c
> index a289eccfb1..081bac18ee 100644
> --- a/hw/isa/isa-bus.c
> +++ b/hw/isa/isa-bus.c
> @@ -85,10 +85,10 @@ qemu_irq isa_bus_get_irq(ISABus *bus, unsigned irqnum)
>    * This function is only for special cases such as the 'ferr', and
>    * temporary use for normal devices until they are converted to qdev.
>    */
> -qemu_irq isa_get_irq(ISADevice *dev, unsigned isairq)
> +qemu_irq isa_get_irq(ISADevice *dev, unsigned irqnum)
>   {
> -    assert(!dev || ISA_BUS(qdev_get_parent_bus(DEVICE(dev))) == isabus);
> -    return isa_bus_get_irq(isabus, isairq);
> +    assert(dev);
> +    return isa_bus_get_irq(ISA_BUS(qdev_get_parent_bus(DEVICE(dev))), irqnum);
>   }
>   
>   void isa_connect_gpio_out(ISADevice *isadev, int gpioirq, unsigned isairq)
> diff --git a/include/hw/isa/isa.h b/include/hw/isa/isa.h
> index 40d6224a4e..75fb620782 100644
> --- a/include/hw/isa/isa.h
> +++ b/include/hw/isa/isa.h
> @@ -87,7 +87,8 @@ ISADevice *isa_create_simple(ISABus *bus, const char *name);
>   
>   ISADevice *isa_vga_init(ISABus *bus);
>   
> -qemu_irq isa_get_irq(ISADevice *dev, unsigned isairq);
> +/*  isa_get_irq() is deprecated, please use isa_bus_get_irq() instead. */
> +qemu_irq isa_get_irq(ISADevice *dev, unsigned irqnum);
>   void isa_connect_gpio_out(ISADevice *isadev, int gpioirq, unsigned isairq);
>   MemoryRegion *isa_address_space(ISADevice *dev);
>   MemoryRegion *isa_address_space_io(ISADevice *dev);

Reviewed-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>


ATB,

Mark.
diff mbox series

Patch

diff --git a/hw/isa/isa-bus.c b/hw/isa/isa-bus.c
index a289eccfb1..081bac18ee 100644
--- a/hw/isa/isa-bus.c
+++ b/hw/isa/isa-bus.c
@@ -85,10 +85,10 @@  qemu_irq isa_bus_get_irq(ISABus *bus, unsigned irqnum)
  * This function is only for special cases such as the 'ferr', and
  * temporary use for normal devices until they are converted to qdev.
  */
-qemu_irq isa_get_irq(ISADevice *dev, unsigned isairq)
+qemu_irq isa_get_irq(ISADevice *dev, unsigned irqnum)
 {
-    assert(!dev || ISA_BUS(qdev_get_parent_bus(DEVICE(dev))) == isabus);
-    return isa_bus_get_irq(isabus, isairq);
+    assert(dev);
+    return isa_bus_get_irq(ISA_BUS(qdev_get_parent_bus(DEVICE(dev))), irqnum);
 }
 
 void isa_connect_gpio_out(ISADevice *isadev, int gpioirq, unsigned isairq)
diff --git a/include/hw/isa/isa.h b/include/hw/isa/isa.h
index 40d6224a4e..75fb620782 100644
--- a/include/hw/isa/isa.h
+++ b/include/hw/isa/isa.h
@@ -87,7 +87,8 @@  ISADevice *isa_create_simple(ISABus *bus, const char *name);
 
 ISADevice *isa_vga_init(ISABus *bus);
 
-qemu_irq isa_get_irq(ISADevice *dev, unsigned isairq);
+/*  isa_get_irq() is deprecated, please use isa_bus_get_irq() instead. */
+qemu_irq isa_get_irq(ISADevice *dev, unsigned irqnum);
 void isa_connect_gpio_out(ISADevice *isadev, int gpioirq, unsigned isairq);
 MemoryRegion *isa_address_space(ISADevice *dev);
 MemoryRegion *isa_address_space_io(ISADevice *dev);