From: Shawn Lin <shawn.lin@rock-chips.com>
To: Jaehoon Chung <jh80.chung@samsung.com>,
Ulf Hansson <ulf.hansson@linaro.org>
Cc: Rob Herring <robh+dt@kernel.org>,
linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org,
Heiko Stuebner <heiko@sntech.de>,
linux-rockchip@lists.infradead.org, devicetree@vger.kernel.org,
Shawn Lin <shawn.lin@rock-chips.com>
Subject: [PATCH v2 2/6] mmc: dw_mmc: cleanup power setting of set_ios callback
Date: Sun, 7 Aug 2016 09:34:20 +0800 [thread overview]
Message-ID: <1470533660-16398-1-git-send-email-shawn.lin@rock-chips.com> (raw)
In-Reply-To: <1470533618-16312-1-git-send-email-shawn.lin@rock-chips.com>
Remove the ret variable and combine the condition check
to simplify the code.
Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
---
Changes in v2: None
drivers/mmc/host/dw_mmc.c | 28 ++++++++++------------------
1 file changed, 10 insertions(+), 18 deletions(-)
diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
index 32380d5..59a5e9c 100644
--- a/drivers/mmc/host/dw_mmc.c
+++ b/drivers/mmc/host/dw_mmc.c
@@ -1281,7 +1281,6 @@ static void dw_mci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
struct dw_mci_slot *slot = mmc_priv(mmc);
const struct dw_mci_drv_data *drv_data = slot->host->drv_data;
u32 regs;
- int ret;
switch (ios->bus_width) {
case MMC_BUS_WIDTH_4:
@@ -1319,15 +1318,12 @@ static void dw_mci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
switch (ios->power_mode) {
case MMC_POWER_UP:
- if (!IS_ERR(mmc->supply.vmmc)) {
- ret = mmc_regulator_set_ocr(mmc, mmc->supply.vmmc,
- ios->vdd);
- if (ret) {
- dev_err(slot->host->dev,
- "failed to enable vmmc regulator\n");
- /*return, if failed turn on vmmc*/
- return;
- }
+ if (!IS_ERR(mmc->supply.vmmc) &&
+ mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, ios->vdd)) {
+ dev_err(slot->host->dev,
+ "failed to enable vmmc regulator\n");
+ /*return, if failed turn on vmmc*/
+ return;
}
set_bit(DW_MMC_CARD_NEED_INIT, &slot->flags);
regs = mci_readl(slot->host, PWREN);
@@ -1336,14 +1332,10 @@ static void dw_mci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
break;
case MMC_POWER_ON:
if (!slot->host->vqmmc_enabled) {
- if (!IS_ERR(mmc->supply.vqmmc)) {
- ret = regulator_enable(mmc->supply.vqmmc);
- if (ret < 0)
- dev_err(slot->host->dev,
- "failed to enable vqmmc\n");
- else
- slot->host->vqmmc_enabled = true;
-
+ if (!IS_ERR(mmc->supply.vqmmc) &&
+ regulator_enable(mmc->supply.vqmmc)) {
+ dev_err(slot->host->dev,
+ "failed to enable vqmmc\n");
} else {
/* Keep track so we don't reset again */
slot->host->vqmmc_enabled = true;
--
2.3.7
next prev parent reply other threads:[~2016-08-07 1:34 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20160807013720epcas1p235628058a90efa6f0062b03a4b2e4284@epcas1p2.samsung.com>
2016-08-07 1:33 ` [PATCH v2 0/6] Add support of inverting power control and some minor cleanup Shawn Lin
[not found] ` <1470533618-16312-1-git-send-email-shawn.lin-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
2016-08-07 1:34 ` [PATCH v2 1/6] dt-bindings: rockchip-dw-mshc: add description of rockchip,power-invert Shawn Lin
[not found] ` <1470533644-16357-1-git-send-email-shawn.lin-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
2016-08-10 18:46 ` Rob Herring
2016-08-07 1:34 ` [PATCH v2 3/6] mmc: dw_mmc: split out dw_mci_set_power Shawn Lin
2016-08-07 1:34 ` Shawn Lin [this message]
2016-08-07 1:34 ` [PATCH v2 4/6] mmc: dw_mmc: split out dw_mci_set_power_reg Shawn Lin
2016-08-07 1:34 ` [PATCH v2 5/6] mmc: dw_mmc: support inverted power control Shawn Lin
2016-08-07 1:35 ` [PATCH v2 6/6] mmc: dw_mmc-rockchip: add parsing of power control from DT Shawn Lin
2016-08-08 10:24 ` [PATCH v2 0/6] Add support of inverting power control and some minor cleanup Jaehoon Chung
2016-08-09 1:49 ` Shawn Lin
2016-08-09 2:12 ` Shawn Lin
2016-08-11 10:08 ` Jaehoon Chung
2016-08-12 2:57 ` Shawn Lin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1470533660-16398-1-git-send-email-shawn.lin@rock-chips.com \
--to=shawn.lin@rock-chips.com \
--cc=devicetree@vger.kernel.org \
--cc=heiko@sntech.de \
--cc=jh80.chung@samsung.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mmc@vger.kernel.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=robh+dt@kernel.org \
--cc=ulf.hansson@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).