Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753886AbbG2LLm (ORCPT ); Wed, 29 Jul 2015 07:11:42 -0400 Received: from comal.ext.ti.com ([198.47.26.152]:37051 "EHLO comal.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751384AbbG2LLj (ORCPT ); Wed, 29 Jul 2015 07:11:39 -0400 From: Kishon Vijay Abraham I To: , , , , , , , CC: , Subject: [PATCH 13/17] mmc: host: omap_hsmmc: enable/disable vmmc_aux regulator based on prior state Date: Wed, 29 Jul 2015 16:39:43 +0530 Message-ID: <1438168187-1614-14-git-send-email-kishon@ti.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1438168187-1614-1-git-send-email-kishon@ti.com> References: <1438168187-1614-1-git-send-email-kishon@ti.com> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1391 Lines: 38 enable vmmc_aux regulator only if it is in disabled state and disable vmmc_aux regulator only if it is in enabled state. Signed-off-by: Kishon Vijay Abraham I --- drivers/mmc/host/omap_hsmmc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c index 58bda42..001f8a0 100644 --- a/drivers/mmc/host/omap_hsmmc.c +++ b/drivers/mmc/host/omap_hsmmc.c @@ -258,7 +258,7 @@ static int omap_hsmmc_enable_supply(struct mmc_host *mmc, int vdd) } /* Enable interface voltage rail, if needed */ - if (mmc->supply.vqmmc) { + if (mmc->supply.vqmmc && !regulator_is_enabled(mmc->supply.vqmmc)) { ret = regulator_enable(mmc->supply.vqmmc); if (ret) { dev_err(mmc_dev(mmc), "vmmc_aux reg enable failed\n"); @@ -280,7 +280,7 @@ static int omap_hsmmc_disable_supply(struct mmc_host *mmc) int ret; int status; - if (mmc->supply.vqmmc) { + if (mmc->supply.vqmmc && regulator_is_enabled(mmc->supply.vqmmc)) { ret = regulator_disable(mmc->supply.vqmmc); if (ret) { dev_err(mmc_dev(mmc), "vmmc_aux reg disable failed\n"); -- 1.7.9.5 -- 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/