Message ID | 20191023173154.30051-10-marcandre.lureau@redhat.com |
---|---|
State | New |
Headers | show |
Series | Clean-ups: qom-ify serial and remove QDEV_PROP_PTR | expand |
On 10/23/19 7:31 PM, Marc-André Lureau wrote: > Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> > --- > hw/char/serial.c | 5 +++-- > include/hw/char/serial.h | 2 +- > 2 files changed, 4 insertions(+), 3 deletions(-) > > diff --git a/hw/char/serial.c b/hw/char/serial.c > index 09e89727a6..069d8715d0 100644 > --- a/hw/char/serial.c > +++ b/hw/char/serial.c > @@ -988,7 +988,7 @@ SerialState *serial_init(int base, qemu_irq irq, int baudbase, > SerialState *s = SERIAL(dev); > > s->irq = irq; > - s->baudbase = baudbase; > + qdev_prop_set_uint32(dev, "baudbase", baudbase); > qdev_prop_set_chr(dev, "chardev", chr); > serial_realize_core(s, &error_fatal); > qdev_set_legacy_instance_id(dev, base, 2); > @@ -1002,6 +1002,7 @@ SerialState *serial_init(int base, qemu_irq irq, int baudbase, > > static Property serial_properties[] = { > DEFINE_PROP_CHR("chardev", SerialState, chr), > + DEFINE_PROP_UINT32("baudbase", SerialState, baudbase, 115200), > DEFINE_PROP_END_OF_LIST(), > }; > > @@ -1070,7 +1071,7 @@ SerialState *serial_mm_init(MemoryRegion *address_space, > > s->it_shift = it_shift; > s->irq = irq; > - s->baudbase = baudbase; > + qdev_prop_set_uint32(dev, "baudbase", baudbase); > qdev_prop_set_chr(dev, "chardev", chr); > > serial_realize_core(s, &error_fatal); > diff --git a/include/hw/char/serial.h b/include/hw/char/serial.h > index 180cc7c24e..3dc618598e 100644 > --- a/include/hw/char/serial.h > +++ b/include/hw/char/serial.h > @@ -58,7 +58,7 @@ typedef struct SerialState { > CharBackend chr; > int last_break_enable; > int it_shift; > - int baudbase; > + uint32_t baudbase; > uint32_t tsr_retry; > guint watch_tag; > uint32_t wakeup; > Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
On Wed, 23 Oct 2019 at 18:33, Marc-André Lureau <marcandre.lureau@redhat.com> wrote: > > Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> > --- > hw/char/serial.c | 5 +++-- > include/hw/char/serial.h | 2 +- > 2 files changed, 4 insertions(+), 3 deletions(-) > + DEFINE_PROP_UINT32("baudbase", SerialState, baudbase, 115200), You could also remove the explicit setting of s->baudbase = 115200 in serial-isa.c/serial-pci-multi.c/serial-pci.c, I think? (or maybe you do that in a later patch). Anyway Reviewed-by: Peter Maydell <peter.maydell@linaro.org> thanks -- PMM
diff --git a/hw/char/serial.c b/hw/char/serial.c index 09e89727a6..069d8715d0 100644 --- a/hw/char/serial.c +++ b/hw/char/serial.c @@ -988,7 +988,7 @@ SerialState *serial_init(int base, qemu_irq irq, int baudbase, SerialState *s = SERIAL(dev); s->irq = irq; - s->baudbase = baudbase; + qdev_prop_set_uint32(dev, "baudbase", baudbase); qdev_prop_set_chr(dev, "chardev", chr); serial_realize_core(s, &error_fatal); qdev_set_legacy_instance_id(dev, base, 2); @@ -1002,6 +1002,7 @@ SerialState *serial_init(int base, qemu_irq irq, int baudbase, static Property serial_properties[] = { DEFINE_PROP_CHR("chardev", SerialState, chr), + DEFINE_PROP_UINT32("baudbase", SerialState, baudbase, 115200), DEFINE_PROP_END_OF_LIST(), }; @@ -1070,7 +1071,7 @@ SerialState *serial_mm_init(MemoryRegion *address_space, s->it_shift = it_shift; s->irq = irq; - s->baudbase = baudbase; + qdev_prop_set_uint32(dev, "baudbase", baudbase); qdev_prop_set_chr(dev, "chardev", chr); serial_realize_core(s, &error_fatal); diff --git a/include/hw/char/serial.h b/include/hw/char/serial.h index 180cc7c24e..3dc618598e 100644 --- a/include/hw/char/serial.h +++ b/include/hw/char/serial.h @@ -58,7 +58,7 @@ typedef struct SerialState { CharBackend chr; int last_break_enable; int it_shift; - int baudbase; + uint32_t baudbase; uint32_t tsr_retry; guint watch_tag; uint32_t wakeup;
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> --- hw/char/serial.c | 5 +++-- include/hw/char/serial.h | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-)