qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH V3 4/5] hw/sd.c: convert wp_switch and spi to bool


From: Mitsyanko Igor
Subject: [Qemu-devel] [PATCH V3 4/5] hw/sd.c: convert wp_switch and spi to bool
Date: Wed, 28 Dec 2011 19:32:21 +0400

Currently several binary variables in SDState represented as bool type while
several other represented as int. This patch converts wp_switch and spi
variables to bool and modifies rest of the code to treat this variables as
bool instead of int.

Signed-off-by: Mitsyanko Igor <address@hidden>
---
 hw/sd.c |    8 ++++----
 hw/sd.h |    2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/hw/sd.c b/hw/sd.c
index 955f4fb..147a7e0 100644
--- a/hw/sd.c
+++ b/hw/sd.c
@@ -84,7 +84,7 @@ struct SDState {
     uint32_t card_status;
     uint8_t sd_status[64];
     uint32_t vhs;
-    int wp_switch;
+    bool wp_switch;
     bool *wp_groups;
     uint64_t size;
     uint32_t blk_len;
@@ -94,7 +94,7 @@ struct SDState {
     uint32_t pwd_len;
     uint8_t function_group[6];
 
-    int spi;
+    bool spi;
     uint8_t current_cmd;
     /* True if we will handle the next command as an ACMD. Note that this does
      * *not* track the APP_CMD status bit!
@@ -418,7 +418,7 @@ static void sd_reset(SDState *sd, BlockDriverState *bdrv)
 
     if (sd->wp_groups)
         g_free(sd->wp_groups);
-    sd->wp_switch = bdrv ? bdrv_is_read_only(bdrv) : 0;
+    sd->wp_switch = bdrv ? bdrv_is_read_only(bdrv) : false;
     sd->wp_groups = g_new0(bool, sect);
     memset(sd->function_group, 0, sizeof(sd->function_group));
     sd->erase_start = 0;
@@ -487,7 +487,7 @@ static const VMStateDescription sd_vmstate = {
    whether card should be in SSI or MMC/SD mode.  It is also up to the
    board to ensure that ssi transfers only occur when the chip select
    is asserted.  */
-SDState *sd_init(BlockDriverState *bs, int is_spi)
+SDState *sd_init(BlockDriverState *bs, bool is_spi)
 {
     SDState *sd;
 
diff --git a/hw/sd.h b/hw/sd.h
index f446783..d25342f 100644
--- a/hw/sd.h
+++ b/hw/sd.h
@@ -67,7 +67,7 @@ typedef struct {
 
 typedef struct SDState SDState;
 
-SDState *sd_init(BlockDriverState *bs, int is_spi);
+SDState *sd_init(BlockDriverState *bs, bool is_spi);
 int sd_do_command(SDState *sd, SDRequest *req,
                   uint8_t *response);
 void sd_write_data(SDState *sd, uint8_t value);
-- 
1.7.4.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]