[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1434289733-29077-3-git-send-email-fabio.falzoi84@gmail.com>
Date: Sun, 14 Jun 2015 15:48:48 +0200
From: Fabio Falzoi <fabio.falzoi84@...il.com>
To: gregkh@...uxfoundation.org
Cc: micky_ching@...lsil.com.cn, joe@...ches.com,
dan.carpente@...cle.com, devel@...verdev.osuosl.org,
linux-kernel@...r.kernel.org,
Fabio Falzoi <fabio.falzoi84@...il.com>
Subject: [PATCH 2/7] Staging: rts5208: helper function to manage power off
Use a helper function to check if power off is needed.
Signed-off-by: Fabio Falzoi <fabio.falzoi84@...il.com>
---
drivers/staging/rts5208/rtsx_chip.c | 34 ++++++++++++++++++++--------------
1 file changed, 20 insertions(+), 14 deletions(-)
diff --git a/drivers/staging/rts5208/rtsx_chip.c b/drivers/staging/rts5208/rtsx_chip.c
index e7d3280..5946cc4 100644
--- a/drivers/staging/rts5208/rtsx_chip.c
+++ b/drivers/staging/rts5208/rtsx_chip.c
@@ -1143,6 +1143,25 @@ static void rtsx_monitor_aspm_config(struct rtsx_chip *chip)
}
}
+static void rtsx_manage_ocp(struct rtsx_chip *chip)
+{
+#ifdef SUPPORT_OCP
+ if (!chip->ocp_int)
+ return;
+
+ rtsx_read_register(chip, OCPSTAT, &chip->ocp_stat);
+
+ if (chip->card_exist & SD_CARD)
+ sd_power_off_card3v3(chip);
+ else if (chip->card_exist & MS_CARD)
+ ms_power_off_card3v3(chip);
+ else if (chip->card_exist & XD_CARD)
+ xd_power_off_card3v3(chip);
+
+ chip->ocp_int = 0;
+#endif
+}
+
static void rtsx_manage_sd_lock(struct rtsx_chip *chip)
{
#ifdef SUPPORT_SD_LOCK
@@ -1184,20 +1203,7 @@ void rtsx_polling_func(struct rtsx_chip *chip)
if (rtsx_chk_stat(chip, RTSX_STAT_SS))
return;
-#ifdef SUPPORT_OCP
- if (chip->ocp_int) {
- rtsx_read_register(chip, OCPSTAT, &chip->ocp_stat);
-
- if (chip->card_exist & SD_CARD)
- sd_power_off_card3v3(chip);
- else if (chip->card_exist & MS_CARD)
- ms_power_off_card3v3(chip);
- else if (chip->card_exist & XD_CARD)
- xd_power_off_card3v3(chip);
-
- chip->ocp_int = 0;
- }
-#endif
+ rtsx_manage_ocp(chip);
rtsx_manage_sd_lock(chip);
--
2.1.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists