From: "Philippe Mathieu-Daudé" <f4bug@amsat.org>
To: qemu-devel@nongnu.org
Cc: "Peter Maydell" <peter.maydell@linaro.org>,
"Alistair Francis" <alistair.francis@wdc.com>,
"Philippe Mathieu-Daudé" <f4bug@amsat.org>,
qemu-block@nongnu.org
Subject: [PULL 3/5] hw/sd/sdcard: Constify sd_crc*()'s message argument
Date: Mon, 26 Oct 2020 12:03:13 +0100 [thread overview]
Message-ID: <20201026110315.4026183-4-f4bug@amsat.org> (raw)
In-Reply-To: <20201026110315.4026183-1-f4bug@amsat.org>
CRC functions don't modify the buffer argument,
make it const.
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20200630133912.9428-14-f4bug@amsat.org>
---
hw/sd/sd.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/hw/sd/sd.c b/hw/sd/sd.c
index 5510a64401b..aa6059d2ad6 100644
--- a/hw/sd/sd.c
+++ b/hw/sd/sd.c
@@ -254,11 +254,11 @@ static const int sd_cmd_class[SDMMC_CMD_MAX] = {
7, 7, 10, 7, 9, 9, 9, 8, 8, 10, 8, 8, 8, 8, 8, 8,
};
-static uint8_t sd_crc7(void *message, size_t width)
+static uint8_t sd_crc7(const void *message, size_t width)
{
int i, bit;
uint8_t shift_reg = 0x00;
- uint8_t *msg = (uint8_t *) message;
+ const uint8_t *msg = (const uint8_t *)message;
for (i = 0; i < width; i ++, msg ++)
for (bit = 7; bit >= 0; bit --) {
@@ -270,11 +270,11 @@ static uint8_t sd_crc7(void *message, size_t width)
return shift_reg;
}
-static uint16_t sd_crc16(void *message, size_t width)
+static uint16_t sd_crc16(const void *message, size_t width)
{
int i, bit;
uint16_t shift_reg = 0x0000;
- uint16_t *msg = (uint16_t *) message;
+ const uint16_t *msg = (const uint16_t *)message;
width <<= 1;
for (i = 0; i < width; i ++, msg ++)
--
2.26.2
next prev parent reply other threads:[~2020-10-26 11:13 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-26 11:03 [PULL 0/5] SD/MMC patches for 2020-10-26 Philippe Mathieu-Daudé
2020-10-26 11:03 ` [PULL 1/5] hw/sd/sdcard: Update the SDState documentation Philippe Mathieu-Daudé
2020-10-26 11:03 ` [PULL 2/5] hw/sd/sdcard: Simplify cmd_valid_while_locked() Philippe Mathieu-Daudé
2020-10-26 11:03 ` Philippe Mathieu-Daudé [this message]
2020-10-26 11:03 ` [PULL 4/5] hw/sd/sdcard: Make iolen unsigned Philippe Mathieu-Daudé
2020-10-26 11:03 ` [PULL 5/5] hw/sd/sdcard: Zero out function selection fields before being populated Philippe Mathieu-Daudé
2020-10-26 22:36 ` [PULL 0/5] SD/MMC patches for 2020-10-26 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=20201026110315.4026183-4-f4bug@amsat.org \
--to=f4bug@amsat.org \
--cc=alistair.francis@wdc.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-block@nongnu.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).