Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1457418
| From | Shawn Lin <shawn.lin@rock-chips.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH v2 2/6] mmc: dw_mmc: cleanup power setting of set_ios callback |
| Date | 2016-08-07 03:40 +0200 |
| Message-ID | <s3lei-5hH-31@gated-at.bofh.it> (permalink) |
| References | <s3leh-5hH-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
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
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH v2 0/6] Add support of inverting power control and some minor cleanup Shawn Lin <shawn.lin@rock-chips.com> - 2016-08-07 03:40 +0200
[PATCH v2 2/6] mmc: dw_mmc: cleanup power setting of set_ios callback Shawn Lin <shawn.lin@rock-chips.com> - 2016-08-07 03:40 +0200
[PATCH v2 1/6] dt-bindings: rockchip-dw-mshc: add description of rockchip,power-invert Shawn Lin <shawn.lin@rock-chips.com> - 2016-08-07 03:40 +0200
Re: [PATCH v2 1/6] dt-bindings: rockchip-dw-mshc: add description of rockchip,power-invert Rob Herring <robh@kernel.org> - 2016-08-10 20:50 +0200
Re: [PATCH v2 0/6] Add support of inverting power control and some minor cleanup Jaehoon Chung <jh80.chung@samsung.com> - 2016-08-08 12:30 +0200
Re: [PATCH v2 0/6] Add support of inverting power control and some minor cleanup Shawn Lin <shawn.lin@rock-chips.com> - 2016-08-09 04:00 +0200
Re: [PATCH v2 0/6] Add support of inverting power control and some minor cleanup Shawn Lin <shawn.lin@rock-chips.com> - 2016-08-09 04:20 +0200
csiph-web