[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 08/20] sdcard: Fix sd_crc*() style
From: |
Philippe Mathieu-Daudé |
Subject: |
[Qemu-devel] [PATCH 08/20] sdcard: Fix sd_crc*() style |
Date: |
Fri, 4 May 2018 12:59:06 -0300 |
Fix style to keep patchew/checkpatch happy when moving this code
in the next patch.
Signed-off-by: Philippe Mathieu-Daudé <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 3708ec1d72..a28ef8de5e 100644
--- a/hw/sd/sd.c
+++ b/hw/sd/sd.c
@@ -243,12 +243,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;
}
@@ -260,12 +262,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 00/20] sdcard: proper implementation of CRC, Philippe Mathieu-Daudé, 2018/05/04
- [Qemu-devel] [PATCH 03/20] sdcard: Rename the SDRequest as SDFrame48, Philippe Mathieu-Daudé, 2018/05/04
- [Qemu-devel] [PATCH 02/20] sdcard: Extract sd_calc_frame48_crc7() from sd_req_crc_validate(), Philippe Mathieu-Daudé, 2018/05/04
- [Qemu-devel] [PATCH 01/20] sdcard: Use the ldst API, Philippe Mathieu-Daudé, 2018/05/04
- [Qemu-devel] [PATCH 04/20] sdcard: Add sd_prepare_request[_with_crc](), Philippe Mathieu-Daudé, 2018/05/04
- [Qemu-devel] [PATCH 06/20] sdcard: Add a "validate-crc" property, Philippe Mathieu-Daudé, 2018/05/04
- [Qemu-devel] [PATCH 05/20] sdcard: Use the sd_prepare_request*() functions, Philippe Mathieu-Daudé, 2018/05/04
- [Qemu-devel] [PATCH 07/20] sdcard: Constify sd_crc*()'s message argument, Philippe Mathieu-Daudé, 2018/05/04
- [Qemu-devel] [PATCH 08/20] sdcard: Fix sd_crc*() style,
Philippe Mathieu-Daudé <=
- [Qemu-devel] [PATCH 09/20] sdcard: Expose sd_crc*() functions for QTest use, Philippe Mathieu-Daudé, 2018/05/04
- [Qemu-devel] [PATCH 10/20] sdcard: Expose sd_prepare_request*() functions for QTest use, Philippe Mathieu-Daudé, 2018/05/04
- [Qemu-devel] [PATCH 11/20] sdcard: Add test_sd_request_frame_crc7() qtest (request command CRC7), Philippe Mathieu-Daudé, 2018/05/04
- [Qemu-devel] [PATCH 12/20] sdcard: Let sd_frame48_crc7_calc() work on response frames, Philippe Mathieu-Daudé, 2018/05/04
- [Qemu-devel] [PATCH 14/20] sdcard: Add test_sd_response_frame48_crc7 qtest (command response CRC7), Philippe Mathieu-Daudé, 2018/05/04
- [Qemu-devel] [PATCH 13/20] sdcard: Expose sd_prepare_frame48() for QTest use, Philippe Mathieu-Daudé, 2018/05/04
- [Qemu-devel] [PATCH 15/20] sdcard: Add SDFrame136 struct and 136-bit SD response frames functions, Philippe Mathieu-Daudé, 2018/05/04
- [Qemu-devel] [PATCH 16/20] sdcard: Add test_sd_response_frame136_crc7() qtest, Philippe Mathieu-Daudé, 2018/05/04