From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: qemu-devel@nongnu.org
Cc: "Daniel Henrique Barboza" <danielhb413@gmail.com>,
"Jason Wang" <jasowang@redhat.com>,
"Nicholas Piggin" <npiggin@gmail.com>,
"David Gibson" <david@gibson.dropbear.id.au>,
qemu-ppc@nongnu.org, "Alexey Kardashevskiy" <aik@ozlabs.ru>,
"Harsh Prateek Bora" <harshpb@linux.ibm.com>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>
Subject: [PATCH v2 2/4] hw/ppc/spapr_vof: Simplify LD/ST API uses
Date: Fri, 27 Sep 2024 23:50:38 +0200 [thread overview]
Message-ID: <20240927215040.20552-3-philmd@linaro.org> (raw)
In-Reply-To: <20240927215040.20552-1-philmd@linaro.org>
Directly call ldn_be_p once instead of ldl_be_p / ldq_be_p.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
hw/ppc/spapr_vof.c | 27 +++++++++------------------
1 file changed, 9 insertions(+), 18 deletions(-)
diff --git a/hw/ppc/spapr_vof.c b/hw/ppc/spapr_vof.c
index c02eaacfed..d238a44d88 100644
--- a/hw/ppc/spapr_vof.c
+++ b/hw/ppc/spapr_vof.c
@@ -136,26 +136,17 @@ bool spapr_vof_setprop(MachineState *ms, const char *path, const char *propname,
vof->bootargs = g_strndup(val, vallen);
return true;
}
- if (strcmp(propname, "linux,initrd-start") == 0) {
- if (vallen == sizeof(uint32_t)) {
- spapr->initrd_base = ldl_be_p(val);
- return true;
+ switch (vallen) {
+ case 4:
+ case 8:
+ if (strcmp(propname, "linux,initrd-start") == 0) {
+ spapr->initrd_base = ldn_be_p(val, vallen);
}
- if (vallen == sizeof(uint64_t)) {
- spapr->initrd_base = ldq_be_p(val);
- return true;
- }
- return false;
- }
- if (strcmp(propname, "linux,initrd-end") == 0) {
- if (vallen == sizeof(uint32_t)) {
- spapr->initrd_size = ldl_be_p(val) - spapr->initrd_base;
- return true;
- }
- if (vallen == sizeof(uint64_t)) {
- spapr->initrd_size = ldq_be_p(val) - spapr->initrd_base;
- return true;
+ if (strcmp(propname, "linux,initrd-end") == 0) {
+ spapr->initrd_size = ldn_be_p(val, vallen);
}
+ return true;
+ default:
return false;
}
}
--
2.45.2
next prev parent reply other threads:[~2024-09-27 21:51 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-27 21:50 [PATCH v2 0/4] hw/ppc & net: Simplify LD/ST API uses Philippe Mathieu-Daudé
2024-09-27 21:50 ` [PATCH v2 1/4] hw/ppc/spapr_nvdimm: " Philippe Mathieu-Daudé
2024-10-03 22:18 ` Richard Henderson
2024-09-27 21:50 ` Philippe Mathieu-Daudé [this message]
2024-10-03 22:21 ` [PATCH v2 2/4] hw/ppc/spapr_vof: " Richard Henderson
2024-09-27 21:50 ` [PATCH v2 3/4] hw/ppc/vof: " Philippe Mathieu-Daudé
2024-09-27 21:50 ` [PATCH v2 4/4] net/l2tpv3: " Philippe Mathieu-Daudé
2024-10-03 22:34 ` Richard Henderson
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=20240927215040.20552-3-philmd@linaro.org \
--to=philmd@linaro.org \
--cc=aik@ozlabs.ru \
--cc=danielhb413@gmail.com \
--cc=david@gibson.dropbear.id.au \
--cc=harshpb@linux.ibm.com \
--cc=jasowang@redhat.com \
--cc=npiggin@gmail.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@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).