qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Cc: patches@linaro.org
Subject: [Qemu-devel] [PATCH v2 1/5] fsdev/9p-iov-marshal.c: Don't use cpu_to_*w() functions
Date: Thu,  7 Jul 2016 17:20:56 +0100	[thread overview]
Message-ID: <1467908460-27048-2-git-send-email-peter.maydell@linaro.org> (raw)
In-Reply-To: <1467908460-27048-1-git-send-email-peter.maydell@linaro.org>

Don't use the cpu_to_*w() functions, which we are trying to deprecate.
Instead just use cpu_to_*() to do the byteswap, which brings the
code in the marshal function in line with that in the unmarshal.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Eric Blake <eblake@redhat.com>
---
 fsdev/9p-iov-marshal.c | 18 ++++++------------
 1 file changed, 6 insertions(+), 12 deletions(-)

diff --git a/fsdev/9p-iov-marshal.c b/fsdev/9p-iov-marshal.c
index 584082b..663cad5 100644
--- a/fsdev/9p-iov-marshal.c
+++ b/fsdev/9p-iov-marshal.c
@@ -207,31 +207,25 @@ ssize_t v9fs_iov_vmarshal(struct iovec *in_sg, int in_num, size_t offset,
             break;
         }
         case 'w': {
-            uint16_t val;
+            uint16_t val = va_arg(ap, int);
             if (bswap) {
-                cpu_to_le16w(&val, va_arg(ap, int));
-            } else {
-                val =  va_arg(ap, int);
+                val = cpu_to_le16(val);
             }
             copied = v9fs_pack(in_sg, in_num, offset, &val, sizeof(val));
             break;
         }
         case 'd': {
-            uint32_t val;
+            uint32_t val = va_arg(ap, uint32_t);
             if (bswap) {
-                cpu_to_le32w(&val, va_arg(ap, uint32_t));
-            } else {
-                val =  va_arg(ap, uint32_t);
+                val = cpu_to_le32(val);
             }
             copied = v9fs_pack(in_sg, in_num, offset, &val, sizeof(val));
             break;
         }
         case 'q': {
-            uint64_t val;
+            uint64_t val = va_arg(ap, uint64_t);
             if (bswap) {
-                cpu_to_le64w(&val, va_arg(ap, uint64_t));
-            } else {
-                val =  va_arg(ap, uint64_t);
+                val = cpu_to_le64(val);
             }
             copied = v9fs_pack(in_sg, in_num, offset, &val, sizeof(val));
             break;
-- 
1.9.1

  reply	other threads:[~2016-07-07 16:21 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-07 16:20 [Qemu-devel] [PATCH v2 0/5] Drop cpu_to_*w, *_to_cpup, document cpu_to_*, *_to_cpu Peter Maydell
2016-07-07 16:20 ` Peter Maydell [this message]
2016-07-07 16:20 ` [Qemu-devel] [PATCH v2 2/5] hw/bt: Don't use cpu_to_*w() and *_to_cpup() Peter Maydell
2016-07-07 16:20 ` [Qemu-devel] [PATCH v2 3/5] bswap.h: Remove unused " Peter Maydell
2016-07-07 16:20 ` [Qemu-devel] [PATCH v2 4/5] bswap.h: Fix comment typo Peter Maydell
2016-07-07 16:21 ` [Qemu-devel] [PATCH v2 5/5] bswap.h: Document cpu_to_* and *_to_cpu conversion functions Peter Maydell
2016-07-12 15:04 ` [Qemu-devel] [PATCH v2 0/5] Drop cpu_to_*w, *_to_cpup, document cpu_to_*, *_to_cpu Peter Maydell

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=1467908460-27048-2-git-send-email-peter.maydell@linaro.org \
    --to=peter.maydell@linaro.org \
    --cc=patches@linaro.org \
    --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).