lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 11 Aug 2014 22:05:12 -0700
From:	Tim Kryger <tim.kryger@...il.com>
To:	Chris Ball <chris@...ntf.net>, Ulf Hansson <ulf.hansson@...aro.org>
Cc:	Tim Kryger <tim.kryger@...il.com>,
	Linux MMC List <linux-mmc@...r.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: [PATCH v2] mmc: core: Remove fixed voltage regulator logic

There is no need for regulator consumers to include special logic for
fixed voltage regulators as they support regulator_set_voltage() just
like their non-fixed regulator counterparts.

Signed-off-by: Tim Kryger <tim.kryger@...il.com>
---

Changes in v2:
  - Remove query of the current voltage, just set the desired voltage


This simplification of logic is possible due to a recent change that
allows fixed regulators to return success for regulator_set_voltage
operations if the requested range overlaps with the fixed voltage.

c00dc35 regulator: core: Allow regulator_set_voltage for fixed regulators

I have verified this change on a BeagleBone Black where the eMMC and SD
card receive a fixed 3.3v supply.  The TI HSMMC driver used on the BBB,
like the Intel PXA MMC driver, ensures that software only requests VMMC
be set to supported voltage ranges by calling mmc_regulator_get_ocrmask.
This function considers the capabilities of the regulator in order to
determine an appropriate OCR mask of supported voltages that constrains
the set of values which may later be passed into mmc_regulator_set_ocr.

Once the following (queued) patch is merged, the SDHCI driver will call
mmc_regulator_get_supply which then calls mmc_regulator_get_ocrmask.

https://lkml.org/lkml/2014/6/13/451

The Atmel, ARM, Freescale MXC, SuperH Internal MMCIF, Allwinner sunxi,
Toshiba Mobile IO Controller, and Renesas USDHI6ROL0 drivers already
call mmc_regulator_get_supply so they too only request voltages that
are achievable.

There are no other callers of mmc_regulator_set_ocr so this patch should
be safe.


 drivers/mmc/core/core.c |   18 +-----------------
 1 file changed, 1 insertion(+), 17 deletions(-)

diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index 7dc0c85..1a3e35b 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -1263,7 +1263,6 @@ int mmc_regulator_set_ocr(struct mmc_host *mmc,
 
 	if (vdd_bit) {
 		int		tmp;
-		int		voltage;
 
 		/*
 		 * REVISIT mmc_vddrange_to_ocrmask() may have set some
@@ -1280,22 +1279,7 @@ int mmc_regulator_set_ocr(struct mmc_host *mmc,
 			max_uV = min_uV + 100 * 1000;
 		}
 
-		/*
-		 * If we're using a fixed/static regulator, don't call
-		 * regulator_set_voltage; it would fail.
-		 */
-		voltage = regulator_get_voltage(supply);
-
-		if (!regulator_can_change_voltage(supply))
-			min_uV = max_uV = voltage;
-
-		if (voltage < 0)
-			result = voltage;
-		else if (voltage < min_uV || voltage > max_uV)
-			result = regulator_set_voltage(supply, min_uV, max_uV);
-		else
-			result = 0;
-
+		result = regulator_set_voltage(supply, min_uV, max_uV);
 		if (result == 0 && !mmc->regulator_enabled) {
 			result = regulator_enable(supply);
 			if (!result)
-- 
1.7.9.5

--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ