[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 14/20] hw/ide: Rename ide_init2() -> ide_bus_init_output_irq(
From: |
Bernhard Beschow |
Subject: |
Re: [PATCH 14/20] hw/ide: Rename ide_init2() -> ide_bus_init_output_irq() |
Date: |
Thu, 16 Feb 2023 00:10:29 +0000 |
Am 15. Februar 2023 11:27:06 UTC schrieb "Philippe Mathieu-Daudé"
<philmd@linaro.org>:
>ide_init2() initializes a IDEBus, and set its output IRQ.
s/a IDEBus/an IDEBus/, see e.g.
https://owl.purdue.edu/owl/general_writing/grammar/articles_a_versus_an.html .
>To emphasize this, rename it as ide_bus_init_output_irq().
The new name suggests that only the IRQ is initialized, while in fact the two
IDE devices contained inside the bus are too. It's really hard to come up with
a good name here because the code is so tangled.
>
>Mechanical change using:
>
> $ sed -i -e 's/ide_init2/ide_bus_init_output_irq/g' \
> $(git grep -l ide_init2)
>
>Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>---
> hw/ide/ahci.c | 2 +-
> hw/ide/cmd646.c | 2 +-
> hw/ide/core.c | 4 ++--
> hw/ide/isa.c | 2 +-
> hw/ide/macio.c | 2 +-
> hw/ide/microdrive.c | 2 +-
> hw/ide/mmio.c | 2 +-
> hw/ide/piix.c | 3 ++-
> hw/ide/sii3112.c | 2 +-
> hw/ide/via.c | 2 +-
> include/hw/ide/internal.h | 4 ++--
> 11 files changed, 14 insertions(+), 13 deletions(-)
>
>diff --git a/hw/ide/ahci.c b/hw/ide/ahci.c
>index 7f67fb3119..d79b70d8c5 100644
>--- a/hw/ide/ahci.c
>+++ b/hw/ide/ahci.c
>@@ -1554,7 +1554,7 @@ void ahci_realize(AHCIState *s, DeviceState *qdev,
>AddressSpace *as, int ports)
> AHCIDevice *ad = &s->dev[i];
>
> ide_bus_init(&ad->port, sizeof(ad->port), qdev, i, 1);
>- ide_init2(&ad->port, irqs[i]);
>+ ide_bus_init_output_irq(&ad->port, irqs[i]);
>
> ad->hba = s;
> ad->port_no = i;
>diff --git a/hw/ide/cmd646.c b/hw/ide/cmd646.c
>index 2865bc25fc..26a90ed45f 100644
>--- a/hw/ide/cmd646.c
>+++ b/hw/ide/cmd646.c
>@@ -294,7 +294,7 @@ static void pci_cmd646_ide_realize(PCIDevice *dev, Error
>**errp)
> qdev_init_gpio_in(ds, cmd646_set_irq, 2);
> for (i = 0; i < 2; i++) {
> ide_bus_init(&d->bus[i], sizeof(d->bus[i]), ds, i, 2);
>- ide_init2(&d->bus[i], qdev_get_gpio_in(ds, i));
>+ ide_bus_init_output_irq(&d->bus[i], qdev_get_gpio_in(ds, i));
>
> bmdma_init(&d->bus[i], &d->bmdma[i], d);
> d->bmdma[i].bus = &d->bus[i];
>diff --git a/hw/ide/core.c b/hw/ide/core.c
>index 1be0731d1a..fd2215c506 100644
>--- a/hw/ide/core.c
>+++ b/hw/ide/core.c
>@@ -2771,7 +2771,7 @@ static IDEDMA ide_dma_nop = {
> .aiocb = NULL,
> };
>
>-void ide_init2(IDEBus *bus, qemu_irq irq)
>+void ide_bus_init_output_irq(IDEBus *bus, qemu_irq irq_out)
> {
> int i;
>
>@@ -2779,7 +2779,7 @@ void ide_init2(IDEBus *bus, qemu_irq irq)
> ide_init1(bus, i);
> ide_reset(&bus->ifs[i]);
> }
>- bus->irq = irq;
>+ bus->irq = irq_out;
> bus->dma = &ide_dma_nop;
> }
>
>diff --git a/hw/ide/isa.c b/hw/ide/isa.c
>index f8ed26b587..95053e026f 100644
>--- a/hw/ide/isa.c
>+++ b/hw/ide/isa.c
>@@ -72,7 +72,7 @@ static void isa_ide_realizefn(DeviceState *dev, Error **errp)
>
> ide_bus_init(&s->bus, sizeof(s->bus), dev, 0, 2);
> ide_init_ioport(&s->bus, isadev, s->iobase, s->iobase2);
>- ide_init2(&s->bus, isa_get_irq(isadev, s->irqnum));
>+ ide_bus_init_output_irq(&s->bus, isa_get_irq(isadev, s->irqnum));
> vmstate_register(VMSTATE_IF(dev), 0, &vmstate_ide_isa, s);
> ide_bus_register_restart_cb(&s->bus);
> }
>diff --git a/hw/ide/macio.c b/hw/ide/macio.c
>index 7efbbc720a..6be29e44bc 100644
>--- a/hw/ide/macio.c
>+++ b/hw/ide/macio.c
>@@ -420,7 +420,7 @@ static void macio_ide_realizefn(DeviceState *dev, Error
>**errp)
> {
> MACIOIDEState *s = MACIO_IDE(dev);
>
>- ide_init2(&s->bus, s->ide_irq);
>+ ide_bus_init_output_irq(&s->bus, s->ide_irq);
>
> /* Register DMA callbacks */
> s->dma.ops = &dbdma_ops;
>diff --git a/hw/ide/microdrive.c b/hw/ide/microdrive.c
>index 08504b499f..84452ae4ef 100644
>--- a/hw/ide/microdrive.c
>+++ b/hw/ide/microdrive.c
>@@ -599,7 +599,7 @@ static void microdrive_realize(DeviceState *dev, Error
>**errp)
> {
> MicroDriveState *md = MICRODRIVE(dev);
>
>- ide_init2(&md->bus, qemu_allocate_irq(md_set_irq, md, 0));
>+ ide_bus_init_output_irq(&md->bus, qemu_allocate_irq(md_set_irq, md, 0));
> }
>
> static void microdrive_init(Object *obj)
>diff --git a/hw/ide/mmio.c b/hw/ide/mmio.c
>index 1f1527122e..b6c40bc028 100644
>--- a/hw/ide/mmio.c
>+++ b/hw/ide/mmio.c
>@@ -122,7 +122,7 @@ static void mmio_ide_realizefn(DeviceState *dev, Error
>**errp)
> SysBusDevice *d = SYS_BUS_DEVICE(dev);
> MMIOIDEState *s = MMIO_IDE(dev);
>
>- ide_init2(&s->bus, s->irq);
>+ ide_bus_init_output_irq(&s->bus, s->irq);
>
> memory_region_init_io(&s->iomem1, OBJECT(s), &mmio_ide_ops, s,
> "ide-mmio.1", 16 << s->shift);
>diff --git a/hw/ide/piix.c b/hw/ide/piix.c
>index daeb9b605d..2f71376b93 100644
>--- a/hw/ide/piix.c
>+++ b/hw/ide/piix.c
>@@ -145,7 +145,8 @@ static int pci_piix_init_ports(PCIIDEState *d)
> if (ret) {
> return ret;
> }
>- ide_init2(&d->bus[i], isa_get_irq(NULL, port_info[i].isairq));
>+ ide_bus_init_output_irq(&d->bus[i],
>+ isa_get_irq(NULL, port_info[i].isairq));
>
> bmdma_init(&d->bus[i], &d->bmdma[i], d);
> d->bmdma[i].bus = &d->bus[i];
>diff --git a/hw/ide/sii3112.c b/hw/ide/sii3112.c
>index c918370220..f9becdff8e 100644
>--- a/hw/ide/sii3112.c
>+++ b/hw/ide/sii3112.c
>@@ -284,7 +284,7 @@ static void sii3112_pci_realize(PCIDevice *dev, Error
>**errp)
> qdev_init_gpio_in(ds, sii3112_set_irq, 2);
> for (i = 0; i < 2; i++) {
> ide_bus_init(&s->bus[i], sizeof(s->bus[i]), ds, i, 1);
>- ide_init2(&s->bus[i], qdev_get_gpio_in(ds, i));
>+ ide_bus_init_output_irq(&s->bus[i], qdev_get_gpio_in(ds, i));
>
> bmdma_init(&s->bus[i], &s->bmdma[i], s);
> s->bmdma[i].bus = &s->bus[i];
>diff --git a/hw/ide/via.c b/hw/ide/via.c
>index fd398226d4..ab9e43e244 100644
>--- a/hw/ide/via.c
>+++ b/hw/ide/via.c
>@@ -191,7 +191,7 @@ static void via_ide_realize(PCIDevice *dev, Error **errp)
> qdev_init_gpio_in(ds, via_ide_set_irq, 2);
> for (i = 0; i < 2; i++) {
> ide_bus_init(&d->bus[i], sizeof(d->bus[i]), ds, i, 2);
>- ide_init2(&d->bus[i], qdev_get_gpio_in(ds, i));
>+ ide_bus_init_output_irq(&d->bus[i], qdev_get_gpio_in(ds, i));
>
> bmdma_init(&d->bus[i], &d->bmdma[i], d);
> d->bmdma[i].bus = &d->bus[i];
>diff --git a/include/hw/ide/internal.h b/include/hw/ide/internal.h
>index 11a4931ef9..c687282a78 100644
>--- a/include/hw/ide/internal.h
>+++ b/include/hw/ide/internal.h
>@@ -488,7 +488,7 @@ struct IDEBus {
> IDEDMA *dma;
> uint8_t unit;
> uint8_t cmd;
>- qemu_irq irq;
>+ qemu_irq irq; /* bus output */
>
> int error_status;
> uint8_t retry_unit;
>@@ -616,8 +616,8 @@ int ide_init_drive(IDEState *s, BlockBackend *blk,
>IDEDriveKind kind,
> uint64_t wwn,
> uint32_t cylinders, uint32_t heads, uint32_t secs,
> int chs_trans, Error **errp);
>-void ide_init2(IDEBus *bus, qemu_irq irq);
> void ide_exit(IDEState *s);
>+void ide_bus_init_output_irq(IDEBus *bus, qemu_irq irq_out);
> int ide_init_ioport(IDEBus *bus, ISADevice *isa, int iobase, int iobase2);
> void ide_bus_set_irq(IDEBus *bus);
> void ide_bus_register_restart_cb(IDEBus *bus);