Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752354AbbFNNtd (ORCPT ); Sun, 14 Jun 2015 09:49:33 -0400 Received: from mail-wi0-f173.google.com ([209.85.212.173]:33582 "EHLO mail-wi0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752100AbbFNNtZ (ORCPT ); Sun, 14 Jun 2015 09:49:25 -0400 From: Fabio Falzoi To: gregkh@linuxfoundation.org Cc: micky_ching@realsil.com.cn, joe@perches.com, dan.carpente@oracle.com, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, Fabio Falzoi Subject: [PATCH 1/7] Staging: rts5208: helper function to manage sd erase status Date: Sun, 14 Jun 2015 15:48:47 +0200 Message-Id: <1434289733-29077-2-git-send-email-fabio.falzoi84@gmail.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1434289733-29077-1-git-send-email-fabio.falzoi84@gmail.com> References: <1434289733-29077-1-git-send-email-fabio.falzoi84@gmail.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1976 Lines: 76 Use a helper function to manage SD erase status when SUPPORT_SD_LOCK is defined Signed-off-by: Fabio Falzoi --- drivers/staging/rts5208/rtsx_chip.c | 38 ++++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/drivers/staging/rts5208/rtsx_chip.c b/drivers/staging/rts5208/rtsx_chip.c index 0c1716e..e7d3280 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); -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/