> -----Original Message----- > From: Philippe Mathieu-Daudé [mailto:phi...@redhat.com] > Sent: 20 February 2019 01:02 > To: qemu-devel@nongnu.org; Prasad J Pandit <p...@fedoraproject.org>; Marc- > André Lureau <marcandre.lur...@redhat.com>; Paolo Bonzini > <pbonz...@redhat.com> > Cc: Jason Wang <jasow...@redhat.com>; Anthony Perard > <anthony.per...@citrix.com>; qemu-...@nongnu.org; Stefan Berger > <stef...@linux.ibm.com>; David Gibson <da...@gibson.dropbear.id.au>; Gerd > Hoffmann <kra...@redhat.com>; Zhang Chen <zhangc...@gmail.com>; xen- > de...@lists.xenproject.org; Cornelia Huck <coh...@redhat.com>; Samuel > Thibault <samuel.thiba...@ens-lyon.org>; Christian Borntraeger > <borntrae...@de.ibm.com>; Amit Shah <a...@kernel.org>; Li Zhijian > <lizhij...@cn.fujitsu.com>; Corey Minyard <miny...@acm.org>; Michael S. > Tsirkin <m...@redhat.com>; Paul Durrant <paul.durr...@citrix.com>; Halil > Pasic <pa...@linux.ibm.com>; Stefano Stabellini <sstabell...@kernel.org>; > qemu-s3...@nongnu.org; Pavel Dovgalyuk <pavel.dovga...@ispras.ru>; > Philippe Mathieu-Daudé <phi...@redhat.com> > Subject: [PATCH v3 11/25] xen: Let xencons_send() take a 'size' argument > > The single caller of xencons_send(), con_event() already use the > difference 'con->buffer.size - con->buffer.consumed'. > Deduplicate by passing the difference as an argument. > > Signed-off-by: Philippe Mathieu-Daudé <phi...@redhat.com> > --- > hw/char/xen_console.c | 12 +++++++----- > 1 file changed, 7 insertions(+), 5 deletions(-) > > diff --git a/hw/char/xen_console.c b/hw/char/xen_console.c > index 91f34ef06c..083b2c8e2a 100644 > --- a/hw/char/xen_console.c > +++ b/hw/char/xen_console.c > @@ -144,11 +144,10 @@ static void xencons_receive(void *opaque, const > uint8_t *buf, int len) > xen_pv_send_notify(&con->xendev); > } > > -static void xencons_send(struct XenConsole *con) > +static void xencons_send(struct XenConsole *con, ssize_t size) > { > - ssize_t len, size; > + ssize_t len; > > - size = con->buffer.size - con->buffer.consumed; > if (qemu_chr_fe_backend_connected(&con->chr)) { > len = qemu_chr_fe_write(&con->chr, > con->buffer.data + con->buffer.consumed, > @@ -280,10 +279,13 @@ static void con_disconnect(struct XenLegacyDevice > *xendev) > static void con_event(struct XenLegacyDevice *xendev) > { > struct XenConsole *con = container_of(xendev, struct XenConsole, > xendev); > + ssize_t size; > > buffer_append(con); > - if (con->buffer.size - con->buffer.consumed) > - xencons_send(con); > + size = con->buffer.size - con->buffer.consumed; > + if (size) { > + xencons_send(con, size); > + }
You introduce this here, only to modify it in patch #12. Why not squash the two together? Paul > } > > /* -------------------------------------------------------------------- > */ > -- > 2.20.1