From: wwang <[email protected]>

Fix a bug that SDIO and SD normal card would appear simultaneously if a SDIO 
card inserted.

Signed-off-by: wwang <[email protected]>
---
 drivers/staging/rts_pstor/sd.c |   17 ++++++++++++++---
 1 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/rts_pstor/sd.c b/drivers/staging/rts_pstor/sd.c
index fb62eaf..9ce63f7 100644
--- a/drivers/staging/rts_pstor/sd.c
+++ b/drivers/staging/rts_pstor/sd.c
@@ -3094,6 +3094,7 @@ int reset_sd_card(struct rtsx_chip *chip)
 {
        struct sd_info *sd_card = &(chip->sd_card);
        int retval;
+       int reset_pass = 0;
 
        sd_init_reg_addr(chip);
 
@@ -3134,7 +3135,10 @@ int reset_sd_card(struct rtsx_chip *chip)
 
        if (chip->sd_ctl & RESET_MMC_FIRST) {
                retval = reset_mmc(chip);
-               if ((retval != STATUS_SUCCESS) && !sd_check_err_code(chip, 
SD_NO_CARD)) {
+               if (retval != STATUS_SUCCESS) {
+                       if (sd_check_err_code(chip, SD_NO_CARD))
+                               TRACE_RET(chip, STATUS_FAIL);
+
                        retval = reset_sd(chip);
                        if (retval != STATUS_SUCCESS) {
                                if (CHECK_PID(chip, 0x5209)) {
@@ -3143,7 +3147,11 @@ int reset_sd_card(struct rtsx_chip *chip)
                                                TRACE_RET(chip, STATUS_FAIL);
                                        }
                                }
+                       } else {
+                               reset_pass = 1;
                        }
+               } else {
+                       reset_pass = 1;
                }
        } else {
                retval = reset_sd(chip);
@@ -3161,13 +3169,16 @@ int reset_sd_card(struct rtsx_chip *chip)
 
                        if (!chip->sd_io) {
                                retval = reset_mmc(chip);
+                               if (retval == STATUS_SUCCESS)
+                                       reset_pass = 1;
                        }
+               } else {
+                       reset_pass = 1;
                }
        }
 
-       if (retval != STATUS_SUCCESS) {
+       if (!reset_pass)
                TRACE_RET(chip, STATUS_FAIL);
-       }
 
        retval = sd_set_clock_divider(chip, SD_CLK_DIVIDE_0);
        if (retval != STATUS_SUCCESS) {
-- 
1.7.7

_______________________________________________
devel mailing list
[email protected]
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel

Reply via email to