[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v3 05/33] serial-pci-multi: factor out multi_serial_get_nr_po
From: |
Marc-André Lureau |
Subject: |
Re: [PATCH v3 05/33] serial-pci-multi: factor out multi_serial_get_nr_ports |
Date: |
Thu, 24 Oct 2019 11:59:45 +0200 |
On Thu, Oct 24, 2019 at 12:41 AM Philippe Mathieu-Daudé
<address@hidden> wrote:
>
> On 10/23/19 7:31 PM, Marc-André Lureau wrote:
> > Reused in following patch.
> >
> > Signed-off-by: Marc-André Lureau <address@hidden>
> > ---
> > hw/char/serial-pci-multi.c | 26 ++++++++++++++------------
> > 1 file changed, 14 insertions(+), 12 deletions(-)
> >
> > diff --git a/hw/char/serial-pci-multi.c b/hw/char/serial-pci-multi.c
> > index 5f13b5663b..6fa1cc6225 100644
> > --- a/hw/char/serial-pci-multi.c
> > +++ b/hw/char/serial-pci-multi.c
> > @@ -77,24 +77,26 @@ static void multi_serial_irq_mux(void *opaque, int n,
> > int level)
> > pci_set_irq(&pci->dev, pending);
> > }
> >
> > +static int multi_serial_get_nr_ports(PCIDeviceClass *pc)
>
> static size_t multi_serial_get_port_count()?
>
> Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
works for me, thanks
>
> > +{
> > + switch (pc->device_id) {
> > + case 0x0003:
> > + return 2;
> > + case 0x0004:
> > + return 4;
> > + }
> > +
> > + g_assert_not_reached();
> > +}
> > +
> > +
> > static void multi_serial_pci_realize(PCIDevice *dev, Error **errp)
> > {
> > PCIDeviceClass *pc = PCI_DEVICE_GET_CLASS(dev);
> > PCIMultiSerialState *pci = DO_UPCAST(PCIMultiSerialState, dev, dev);
> > SerialState *s;
> > Error *err = NULL;
> > - int i, nr_ports = 0;
> > -
> > - switch (pc->device_id) {
> > - case 0x0003:
> > - nr_ports = 2;
> > - break;
> > - case 0x0004:
> > - nr_ports = 4;
> > - break;
> > - }
> > - assert(nr_ports > 0);
> > - assert(nr_ports <= PCI_SERIAL_MAX_PORTS);
> > + int i, nr_ports = multi_serial_get_nr_ports(pc);
> >
> > pci->dev.config[PCI_CLASS_PROG] = pci->prog_if;
> > pci->dev.config[PCI_INTERRUPT_PIN] = 0x01;
> >
- [PATCH v3 00/33] Clean-ups: qom-ify serial and remove QDEV_PROP_PTR, Marc-André Lureau, 2019/10/23
- [PATCH v3 01/33] qdev: remove unused qdev_prop_int64, Marc-André Lureau, 2019/10/23
- [PATCH v3 02/33] sysbus: remove unused sysbus_try_create*, Marc-André Lureau, 2019/10/23
- [PATCH v3 03/33] sysbus: remove outdated comment, Marc-André Lureau, 2019/10/23
- [PATCH v3 04/33] chardev: generate an internal id when none given, Marc-André Lureau, 2019/10/23
- [PATCH v3 05/33] serial-pci-multi: factor out multi_serial_get_nr_ports, Marc-André Lureau, 2019/10/23
- [PATCH v3 06/33] serial: initial qom-ification, Marc-André Lureau, 2019/10/23
- [PATCH v3 07/33] serial: register vmsd with DeviceClass, Marc-André Lureau, 2019/10/23
- [PATCH v3 08/33] serial: add "chardev" property, Marc-André Lureau, 2019/10/23
- [PATCH v3 09/33] serial: add "baudbase" property, Marc-André Lureau, 2019/10/23
- [PATCH v3 10/33] serial: add "instance-id" property, Marc-André Lureau, 2019/10/23
- [PATCH v3 11/33] serial: realize the serial device, Marc-André Lureau, 2019/10/23
- [PATCH v3 13/33] serial: start making SerialMM a sysbus device, Marc-André Lureau, 2019/10/23