diff options
author | Fabio Falzoi <fabio.falzoi84@gmail.com> | 2015-06-14 15:48:47 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-06-17 21:23:14 -0700 |
commit | cb547643c37cc78b7eabeb236bcc618b31e66d5b (patch) | |
tree | 5ca0223ad67c38877c9810ecc9dae4fdb681699e /drivers/staging/rts5208 | |
parent | 1d1c5b24f949a014a636687711fcec0f84359ffd (diff) |
Staging: rts5208: helper function to manage sd erase status
Use a helper function to manage SD erase status when SUPPORT_SD_LOCK is
defined
Signed-off-by: Fabio Falzoi <fabio.falzoi84@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/rts5208')
-rw-r--r-- | drivers/staging/rts5208/rtsx_chip.c | 38 |
1 files changed, 21 insertions, 17 deletions
diff --git a/drivers/staging/rts5208/rtsx_chip.c b/drivers/staging/rts5208/rtsx_chip.c index 0c1716ebc827..e7d328086d8a 100644 --- a/drivers/staging/rts5208/rtsx_chip.c +++ b/drivers/staging/rts5208/rtsx_chip.c @@ -1143,11 +1143,30 @@ static void rtsx_monitor_aspm_config(struct rtsx_chip *chip) } } -void rtsx_polling_func(struct rtsx_chip *chip) +static void rtsx_manage_sd_lock(struct rtsx_chip *chip) { #ifdef SUPPORT_SD_LOCK struct sd_info *sd_card = &chip->sd_card; + u8 val; + + if (!sd_card->sd_erase_status) + return; + + if (chip->card_exist & SD_CARD) { + rtsx_read_register(chip, 0xFD30, &val); + if (val & 0x02) { + sd_card->sd_erase_status = SD_NOT_ERASE; + sd_card->sd_lock_notify = 1; + chip->need_reinit |= SD_CARD; + } + } else { + sd_card->sd_erase_status = SD_NOT_ERASE; + } #endif +} + +void rtsx_polling_func(struct rtsx_chip *chip) +{ bool ss_allowed; if (rtsx_chk_stat(chip, RTSX_STAT_SUSPEND)) @@ -1180,22 +1199,7 @@ void rtsx_polling_func(struct rtsx_chip *chip) } #endif -#ifdef SUPPORT_SD_LOCK - if (sd_card->sd_erase_status) { - if (chip->card_exist & SD_CARD) { - u8 val; - - rtsx_read_register(chip, 0xFD30, &val); - if (val & 0x02) { - sd_card->sd_erase_status = SD_NOT_ERASE; - sd_card->sd_lock_notify = 1; - chip->need_reinit |= SD_CARD; - } - } else { - sd_card->sd_erase_status = SD_NOT_ERASE; - } - } -#endif + rtsx_manage_sd_lock(chip); rtsx_init_cards(chip); |