[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v2 03/14] sdcard: Fix sd_crc*() style
From: |
Philippe Mathieu-Daudé |
Subject: |
[Qemu-devel] [PATCH v2 03/14] sdcard: Fix sd_crc*() style |
Date: |
Wed, 9 May 2018 00:46:47 -0300 |
Fix style to keep patchew/checkpatch happy when moving this code
in the next patch.
Signed-off-by: Philippe Mathieu-Daudé <address@hidden>
Reviewed-by: Alistair Francis <address@hidden>
---
hw/sd/sd.c | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/hw/sd/sd.c b/hw/sd/sd.c
index eb6dd5482e..27a70896cd 100644
--- a/hw/sd/sd.c
+++ b/hw/sd/sd.c
@@ -242,12 +242,14 @@ static uint8_t sd_crc7(const void *message, size_t width)
uint8_t shift_reg = 0x00;
const uint8_t *msg = (const uint8_t *)message;
- for (i = 0; i < width; i ++, msg ++)
- for (bit = 7; bit >= 0; bit --) {
+ for (i = 0; i < width; i++, msg++) {
+ for (bit = 7; bit >= 0; bit--) {
shift_reg <<= 1;
- if ((shift_reg >> 7) ^ ((*msg >> bit) & 1))
+ if ((shift_reg >> 7) ^ ((*msg >> bit) & 1)) {
shift_reg ^= 0x89;
+ }
}
+ }
return shift_reg;
}
@@ -259,12 +261,14 @@ static uint16_t sd_crc16(const void *message, size_t
width)
const uint16_t *msg = (const uint16_t *)message;
width <<= 1;
- for (i = 0; i < width; i ++, msg ++)
- for (bit = 15; bit >= 0; bit --) {
+ for (i = 0; i < width; i++, msg++) {
+ for (bit = 15; bit >= 0; bit--) {
shift_reg <<= 1;
- if ((shift_reg >> 15) ^ ((*msg >> bit) & 1))
+ if ((shift_reg >> 15) ^ ((*msg >> bit) & 1)) {
shift_reg ^= 0x1011;
+ }
}
+ }
return shift_reg;
}
--
2.17.0
[Qemu-devel] [PATCH v2 05/14] sdcard: Move sd_crc7() and calc_checksum() out for qtesting, Philippe Mathieu-Daudé, 2018/05/08
[Qemu-devel] [PATCH v2 06/14] sdcard: Add test_sd_verify_cksum_frame136(), Philippe Mathieu-Daudé, 2018/05/08
[Qemu-devel] [PATCH v2 07/14] sdcard: Invert the sd_req_crc_is_valid() logic, Philippe Mathieu-Daudé, 2018/05/08