[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 02/23] hw/sd/sdcard: Rewrite sd_cmd_ALL_SEND_CID using switch cas
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH 02/23] hw/sd/sdcard: Rewrite sd_cmd_ALL_SEND_CID using switch case (CMD2) |
Date: |
Fri, 21 Jun 2024 10:05:33 +0200 |
Keep this handler style in sync with other handlers by
using a switch() case, which might become handy to
handle other states.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
hw/sd/sd.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/hw/sd/sd.c b/hw/sd/sd.c
index 626e99ecd6..addeb1940f 100644
--- a/hw/sd/sd.c
+++ b/hw/sd/sd.c
@@ -1044,13 +1044,13 @@ static sd_rsp_type_t sd_cmd_SEND_OP_CMD(SDState *sd,
SDRequest req)
static sd_rsp_type_t sd_cmd_ALL_SEND_CID(SDState *sd, SDRequest req)
{
- if (sd->state != sd_ready_state) {
+ switch (sd->state) {
+ case sd_ready_state:
+ sd->state = sd_identification_state;
+ return sd_r2_i;
+ default:
return sd_invalid_state_for_cmd(sd, req);
}
-
- sd->state = sd_identification_state;
-
- return sd_r2_i;
}
static sd_rsp_type_t sd_cmd_SEND_RELATIVE_ADDR(SDState *sd, SDRequest req)
--
2.41.0
- [PATCH 00/23] hw/sd/sdcard: Accumulation of cleanups and fixes, Philippe Mathieu-Daudé, 2024/06/21
- [PATCH 01/23] hw/sd/sdcard: Correct code indentation, Philippe Mathieu-Daudé, 2024/06/21
- [PATCH 02/23] hw/sd/sdcard: Rewrite sd_cmd_ALL_SEND_CID using switch case (CMD2),
Philippe Mathieu-Daudé <=
- [PATCH 03/23] hw/sd/sdcard: Fix typo in SEND_OP_COND command name, Philippe Mathieu-Daudé, 2024/06/21
- [PATCH 04/23] hw/sd/sdcard: Use HWBLOCK_SHIFT definition instead of magic values, Philippe Mathieu-Daudé, 2024/06/21
- [PATCH 05/23] hw/sd/sdcard: Use registerfield CSR::CURRENT_STATE definition, Philippe Mathieu-Daudé, 2024/06/21
- [PATCH 06/23] hw/sd/sdcard: Use Load/Store API to fill some CID/CSD registers, Philippe Mathieu-Daudé, 2024/06/21
- [PATCH 07/23] hw/sd/sdcard: Remove ACMD6 handler for SPI mode, Philippe Mathieu-Daudé, 2024/06/21