Message ID | 20230422150728.176512-5-shentey@gmail.com |
---|---|
State | New |
Headers | show |
Series | Clean up PCI IDE device models | expand |
On Sat, 22 Apr 2023, Bernhard Beschow wrote: > Every invocation of bmdma_init() is followed by `d->bmdma[i].bus = &d->bus[i]`. > Resolve this redundancy by extracting it into bmdma_init(). > > Signed-off-by: Bernhard Beschow <shentey@gmail.com> Reviewed-by: BALATON Zoltan <balaton@eik.bme.hu>
On 22/4/23 17:07, Bernhard Beschow wrote: > Every invocation of bmdma_init() is followed by `d->bmdma[i].bus = &d->bus[i]`. > Resolve this redundancy by extracting it into bmdma_init(). > > Signed-off-by: Bernhard Beschow <shentey@gmail.com> > --- > hw/ide/cmd646.c | 1 - > hw/ide/pci.c | 1 + > hw/ide/piix.c | 1 - > hw/ide/sii3112.c | 1 - > hw/ide/via.c | 1 - > 5 files changed, 1 insertion(+), 4 deletions(-) Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
On 22/04/2023 16:07, Bernhard Beschow wrote: > Every invocation of bmdma_init() is followed by `d->bmdma[i].bus = &d->bus[i]`. > Resolve this redundancy by extracting it into bmdma_init(). > > Signed-off-by: Bernhard Beschow <shentey@gmail.com> > --- > hw/ide/cmd646.c | 1 - > hw/ide/pci.c | 1 + > hw/ide/piix.c | 1 - > hw/ide/sii3112.c | 1 - > hw/ide/via.c | 1 - > 5 files changed, 1 insertion(+), 4 deletions(-) > > diff --git a/hw/ide/cmd646.c b/hw/ide/cmd646.c > index a68357c1c5..a094a6e12a 100644 > --- a/hw/ide/cmd646.c > +++ b/hw/ide/cmd646.c > @@ -297,7 +297,6 @@ static void pci_cmd646_ide_realize(PCIDevice *dev, Error **errp) > 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]; > ide_bus_register_restart_cb(&d->bus[i]); > } > } > diff --git a/hw/ide/pci.c b/hw/ide/pci.c > index 942e216b9b..67e0998ff0 100644 > --- a/hw/ide/pci.c > +++ b/hw/ide/pci.c > @@ -519,6 +519,7 @@ void bmdma_init(IDEBus *bus, BMDMAState *bm, PCIIDEState *d) > bus->dma = &bm->dma; > bm->irq = bus->irq; > bus->irq = qemu_allocate_irq(bmdma_irq, bm, 0); > + bm->bus = bus; > bm->pci_dev = d; > } > > diff --git a/hw/ide/piix.c b/hw/ide/piix.c > index 41d60921e3..a32f7ccece 100644 > --- a/hw/ide/piix.c > +++ b/hw/ide/piix.c > @@ -144,7 +144,6 @@ static bool pci_piix_init_bus(PCIIDEState *d, unsigned i, Error **errp) > 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]; > ide_bus_register_restart_cb(&d->bus[i]); > > return true; > diff --git a/hw/ide/sii3112.c b/hw/ide/sii3112.c > index f9becdff8e..5dd3d03c29 100644 > --- a/hw/ide/sii3112.c > +++ b/hw/ide/sii3112.c > @@ -287,7 +287,6 @@ static void sii3112_pci_realize(PCIDevice *dev, Error **errp) > 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]; > ide_bus_register_restart_cb(&s->bus[i]); > } > } > diff --git a/hw/ide/via.c b/hw/ide/via.c > index 0caae52276..91253fa4ef 100644 > --- a/hw/ide/via.c > +++ b/hw/ide/via.c > @@ -196,7 +196,6 @@ static void via_ide_realize(PCIDevice *dev, Error **errp) > 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]; > ide_bus_register_restart_cb(&d->bus[i]); > } > } Reviewed-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> ATB, Mark.
diff --git a/hw/ide/cmd646.c b/hw/ide/cmd646.c index a68357c1c5..a094a6e12a 100644 --- a/hw/ide/cmd646.c +++ b/hw/ide/cmd646.c @@ -297,7 +297,6 @@ static void pci_cmd646_ide_realize(PCIDevice *dev, Error **errp) 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]; ide_bus_register_restart_cb(&d->bus[i]); } } diff --git a/hw/ide/pci.c b/hw/ide/pci.c index 942e216b9b..67e0998ff0 100644 --- a/hw/ide/pci.c +++ b/hw/ide/pci.c @@ -519,6 +519,7 @@ void bmdma_init(IDEBus *bus, BMDMAState *bm, PCIIDEState *d) bus->dma = &bm->dma; bm->irq = bus->irq; bus->irq = qemu_allocate_irq(bmdma_irq, bm, 0); + bm->bus = bus; bm->pci_dev = d; } diff --git a/hw/ide/piix.c b/hw/ide/piix.c index 41d60921e3..a32f7ccece 100644 --- a/hw/ide/piix.c +++ b/hw/ide/piix.c @@ -144,7 +144,6 @@ static bool pci_piix_init_bus(PCIIDEState *d, unsigned i, Error **errp) 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]; ide_bus_register_restart_cb(&d->bus[i]); return true; diff --git a/hw/ide/sii3112.c b/hw/ide/sii3112.c index f9becdff8e..5dd3d03c29 100644 --- a/hw/ide/sii3112.c +++ b/hw/ide/sii3112.c @@ -287,7 +287,6 @@ static void sii3112_pci_realize(PCIDevice *dev, Error **errp) 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]; ide_bus_register_restart_cb(&s->bus[i]); } } diff --git a/hw/ide/via.c b/hw/ide/via.c index 0caae52276..91253fa4ef 100644 --- a/hw/ide/via.c +++ b/hw/ide/via.c @@ -196,7 +196,6 @@ static void via_ide_realize(PCIDevice *dev, Error **errp) 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]; ide_bus_register_restart_cb(&d->bus[i]); } }
Every invocation of bmdma_init() is followed by `d->bmdma[i].bus = &d->bus[i]`. Resolve this redundancy by extracting it into bmdma_init(). Signed-off-by: Bernhard Beschow <shentey@gmail.com> --- hw/ide/cmd646.c | 1 - hw/ide/pci.c | 1 + hw/ide/piix.c | 1 - hw/ide/sii3112.c | 1 - hw/ide/via.c | 1 - 5 files changed, 1 insertion(+), 4 deletions(-)