Message ID | 165a4ea190af7c09832f50f02004fad82f704898.1674001242.git.balaton@eik.bme.hu |
---|---|
State | New |
Headers | show |
Series | Misc macio clean ups | expand |
On 18/1/23 01:32, BALATON Zoltan wrote: > Drop some local variables that could just be substituted at the single > place they were used. This makes the code shorter and simpler. > > Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu> > --- > hw/misc/macio/macio.c | 13 +++++-------- > 1 file changed, 5 insertions(+), 8 deletions(-) Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
On 18/01/2023 00:32, BALATON Zoltan wrote: > Drop some local variables that could just be substituted at the single > place they were used. This makes the code shorter and simpler. > > Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu> > --- > hw/misc/macio/macio.c | 13 +++++-------- > 1 file changed, 5 insertions(+), 8 deletions(-) > > diff --git a/hw/misc/macio/macio.c b/hw/misc/macio/macio.c > index 4d7223cc85..ae2a9a960d 100644 > --- a/hw/misc/macio/macio.c > +++ b/hw/misc/macio/macio.c > @@ -53,10 +53,8 @@ > */ > static void macio_escc_legacy_setup(MacIOState *s) > { > - ESCCState *escc = ESCC(&s->escc); > - SysBusDevice *sbd = SYS_BUS_DEVICE(escc); > + SysBusDevice *sbd = SYS_BUS_DEVICE(&s->escc); > MemoryRegion *escc_legacy = g_new(MemoryRegion, 1); > - MemoryRegion *bar = &s->bar; > int i; > static const int maps[] = { > 0x00, 0x00, /* Command B */ > @@ -80,16 +78,15 @@ static void macio_escc_legacy_setup(MacIOState *s) > memory_region_add_subregion(escc_legacy, maps[i], port); > } > > - memory_region_add_subregion(bar, 0x12000, escc_legacy); > + memory_region_add_subregion(&s->bar, 0x12000, escc_legacy); > } > > static void macio_bar_setup(MacIOState *s) > { > - ESCCState *escc = ESCC(&s->escc); > - SysBusDevice *sbd = SYS_BUS_DEVICE(escc); > - MemoryRegion *bar = &s->bar; > + SysBusDevice *sbd = SYS_BUS_DEVICE(&s->escc); > + MemoryRegion *bar = sysbus_mmio_get_region(sbd, 0); > > - memory_region_add_subregion(bar, 0x13000, sysbus_mmio_get_region(sbd, 0)); > + memory_region_add_subregion(&s->bar, 0x13000, bar); > macio_escc_legacy_setup(s); > } Reviewed-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> ATB, Mark.
diff --git a/hw/misc/macio/macio.c b/hw/misc/macio/macio.c index 4d7223cc85..ae2a9a960d 100644 --- a/hw/misc/macio/macio.c +++ b/hw/misc/macio/macio.c @@ -53,10 +53,8 @@ */ static void macio_escc_legacy_setup(MacIOState *s) { - ESCCState *escc = ESCC(&s->escc); - SysBusDevice *sbd = SYS_BUS_DEVICE(escc); + SysBusDevice *sbd = SYS_BUS_DEVICE(&s->escc); MemoryRegion *escc_legacy = g_new(MemoryRegion, 1); - MemoryRegion *bar = &s->bar; int i; static const int maps[] = { 0x00, 0x00, /* Command B */ @@ -80,16 +78,15 @@ static void macio_escc_legacy_setup(MacIOState *s) memory_region_add_subregion(escc_legacy, maps[i], port); } - memory_region_add_subregion(bar, 0x12000, escc_legacy); + memory_region_add_subregion(&s->bar, 0x12000, escc_legacy); } static void macio_bar_setup(MacIOState *s) { - ESCCState *escc = ESCC(&s->escc); - SysBusDevice *sbd = SYS_BUS_DEVICE(escc); - MemoryRegion *bar = &s->bar; + SysBusDevice *sbd = SYS_BUS_DEVICE(&s->escc); + MemoryRegion *bar = sysbus_mmio_get_region(sbd, 0); - memory_region_add_subregion(bar, 0x13000, sysbus_mmio_get_region(sbd, 0)); + memory_region_add_subregion(&s->bar, 0x13000, bar); macio_escc_legacy_setup(s); }
Drop some local variables that could just be substituted at the single place they were used. This makes the code shorter and simpler. Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu> --- hw/misc/macio/macio.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-)