From: Amit Shah <amit.shah@redhat.com>
To: qemu list <qemu-devel@nongnu.org>
Cc: Amit Shah <amit.shah@redhat.com>, Paul Brook <paul@codesourcery.com>
Subject: [Qemu-devel] [PATCH v2 3/4] virtio-serial: Simplify condition for a while loop
Date: Fri, 10 Dec 2010 20:55:52 +0530 [thread overview]
Message-ID: <06778303820b5ae1b44b82d35ac5a0709f8e7578.1291994656.git.amit.shah@redhat.com> (raw)
In-Reply-To: <cover.1291994656.git.amit.shah@redhat.com>
In-Reply-To: <cover.1291994656.git.amit.shah@redhat.com>
Separate out a non-changing condition over the period of a loop into an
if statement before the loop. This will be used later to re-work the
loop.
Signed-off-by: Amit Shah <amit.shah@redhat.com>
---
hw/virtio-serial-bus.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/hw/virtio-serial-bus.c b/hw/virtio-serial-bus.c
index 74ba5ec..ecf0056 100644
--- a/hw/virtio-serial-bus.c
+++ b/hw/virtio-serial-bus.c
@@ -121,7 +121,10 @@ static void do_flush_queued_data(VirtIOSerialPort *port, VirtQueue *vq,
assert(port || discard);
assert(virtio_queue_ready(vq));
- while ((discard || !port->throttled) && virtqueue_pop(vq, &elem)) {
+ if (!discard && port->throttled) {
+ return;
+ }
+ while (virtqueue_pop(vq, &elem)) {
uint8_t *buf;
size_t ret, buf_size;
--
1.7.3.2
next prev parent reply other threads:[~2010-12-10 15:26 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-12-10 15:25 [Qemu-devel] [PATCH v2 0/4] virtio-serial: Trivial fixes, don't copy buffers to host Amit Shah
2010-12-10 15:25 ` [Qemu-devel] [PATCH v2 1/4] virtio-console: Factor out common init between console and generic ports Amit Shah
2010-12-10 15:25 ` [Qemu-devel] [PATCH v2 2/4] virtio-console: Remove unnecessary braces Amit Shah
2010-12-10 15:25 ` Amit Shah [this message]
2010-12-10 15:25 ` [Qemu-devel] [PATCH v2 4/4] virtio-serial: Don't copy over guest buffer to host Amit Shah
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=06778303820b5ae1b44b82d35ac5a0709f8e7578.1291994656.git.amit.shah@redhat.com \
--to=amit.shah@redhat.com \
--cc=paul@codesourcery.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).