diff mbox series

[v2,02/14] sdcard: Constify sd_crc*()'s message argument

Message ID 20180509034658.26455-3-f4bug@amsat.org
State New
Headers show
Series sdcard: Proper implementation of CRC7 | expand

Commit Message

Philippe Mathieu-Daudé May 9, 2018, 3:46 a.m. UTC
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 hw/sd/sd.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Alistair Francis May 9, 2018, 5:58 p.m. UTC | #1
On Tue, May 8, 2018 at 8:46 PM, Philippe Mathieu-Daudé <f4bug@amsat.org> wrote:
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

Reviewed-by: Alistair Francis <alistair.francis@wdc.com>

Alistair

> ---
>  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 235e0518d6..eb6dd5482e 100644
> --- a/hw/sd/sd.c
> +++ b/hw/sd/sd.c
> @@ -236,11 +236,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 --) {
> @@ -252,11 +252,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.17.0
>
>
diff mbox series

Patch

diff --git a/hw/sd/sd.c b/hw/sd/sd.c
index 235e0518d6..eb6dd5482e 100644
--- a/hw/sd/sd.c
+++ b/hw/sd/sd.c
@@ -236,11 +236,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 --) {
@@ -252,11 +252,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 ++)