LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH 0/5] Rename regulator_set_optimum_mode
@ 2015-02-12  3:35 Bjorn Andersson
  2015-02-12  3:35 ` [PATCH 1/5] regulator: " Bjorn Andersson
                   ` (6 more replies)
  0 siblings, 7 replies; 13+ messages in thread
From: Bjorn Andersson @ 2015-02-12  3:35 UTC (permalink / raw)
  To: James E.J. Bottomley, Felipe Balbi, Greg Kroah-Hartman,
	Jonathan Corbet, Liam Girdwood, Mark Brown, Vinayak Holikatti
  Cc: linux-arm-msm, linux-doc, linux-kernel, linux-pm, linux-scsi, linux-usb

Changing the name of the regulator_set_optimum_mode() to
regulator_set_load() better reflects that the API is doing.

This series does the name change and move the current consumers
over.

Bjorn Andersson (5):
  regulator: s/regulator_set_optimum_mode/regulator_set_load/
  ufs: Rename of regulator_set_optimum_mode
  usb: phy: ab8500-usb: Rename regulator_set_optimum_mode
  usb: phy: phy-msm-usb: Rename regulator_set_optimum_mode
  regulator: Drop temporary regulator_set_optimum_mode wrapper

 Documentation/power/regulator/consumer.txt |  2 +-
 drivers/regulator/core.c                   |  8 ++++----
 drivers/scsi/ufs/ufshcd.c                  | 27 +++++++--------------------
 drivers/usb/phy/phy-ab8500-usb.c           |  4 ++--
 drivers/usb/phy/phy-msm-usb.c              | 15 +++++----------
 include/linux/regulator/consumer.h         |  5 ++---
 6 files changed, 21 insertions(+), 40 deletions(-)

-- 
1.8.2.2


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH 1/5] regulator: Rename regulator_set_optimum_mode
  2015-02-12  3:35 [PATCH 0/5] Rename regulator_set_optimum_mode Bjorn Andersson
@ 2015-02-12  3:35 ` Bjorn Andersson
  2015-02-12  3:35 ` [PATCH 2/5] ufs: Rename of regulator_set_optimum_mode Bjorn Andersson
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 13+ messages in thread
From: Bjorn Andersson @ 2015-02-12  3:35 UTC (permalink / raw)
  To: Jonathan Corbet, Liam Girdwood, Mark Brown
  Cc: linux-pm, linux-doc, linux-kernel, linux-arm-msm

Rename the regulator_set_optimum_mode() function regulator_set_load() to
better represent what's going on.

Signed-off-by: Bjorn Andersson <bjorn.andersson@sonymobile.com>
---
 Documentation/power/regulator/consumer.txt |  2 +-
 drivers/regulator/core.c                   |  8 ++++----
 include/linux/regulator/consumer.h         | 12 +++++++++---
 3 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/Documentation/power/regulator/consumer.txt b/Documentation/power/regulator/consumer.txt
index 8afb236c..e51564c 100644
--- a/Documentation/power/regulator/consumer.txt
+++ b/Documentation/power/regulator/consumer.txt
@@ -137,7 +137,7 @@ Indirect operating mode control.
 Consumer drivers can request a change in their supply regulator operating mode
 by calling :-
 
-int regulator_set_optimum_mode(struct regulator *regulator, int load_uA);
+int regulator_set_load(struct regulator *regulator, int load_uA);
 
 This will cause the core to recalculate the total load on the regulator (based
 on all its consumers) and change operating mode (if necessary and permitted)
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 27fb349..b137578 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -3018,7 +3018,7 @@ unsigned int regulator_get_mode(struct regulator *regulator)
 EXPORT_SYMBOL_GPL(regulator_get_mode);
 
 /**
- * regulator_set_optimum_mode - set regulator optimum operating mode
+ * regulator_set_load - set regulator load
  * @regulator: regulator source
  * @uA_load: load current
  *
@@ -3041,9 +3041,9 @@ EXPORT_SYMBOL_GPL(regulator_get_mode);
  * DRMS will sum the total requested load on the regulator and change
  * to the most efficient operating mode if platform constraints allow.
  *
- * Returns the new regulator mode or error.
+ * On error a negative errno is returned.
  */
-int regulator_set_optimum_mode(struct regulator *regulator, int uA_load)
+int regulator_set_load(struct regulator *regulator, int uA_load)
 {
 	struct regulator_dev *rdev = regulator->rdev;
 	int ret;
@@ -3055,7 +3055,7 @@ int regulator_set_optimum_mode(struct regulator *regulator, int uA_load)
 
 	return ret;
 }
-EXPORT_SYMBOL_GPL(regulator_set_optimum_mode);
+EXPORT_SYMBOL_GPL(regulator_set_load);
 
 /**
  * regulator_allow_bypass - allow the regulator to go into bypass mode
diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/consumer.h
index d17e1ff..6d4e9d2 100644
--- a/include/linux/regulator/consumer.h
+++ b/include/linux/regulator/consumer.h
@@ -238,7 +238,7 @@ int regulator_get_current_limit(struct regulator *regulator);
 
 int regulator_set_mode(struct regulator *regulator, unsigned int mode);
 unsigned int regulator_get_mode(struct regulator *regulator);
-int regulator_set_optimum_mode(struct regulator *regulator, int load_uA);
+int regulator_set_load(struct regulator *regulator, int load_uA);
 
 int regulator_allow_bypass(struct regulator *regulator, bool allow);
 
@@ -479,8 +479,7 @@ static inline unsigned int regulator_get_mode(struct regulator *regulator)
 	return REGULATOR_MODE_NORMAL;
 }
 
-static inline int regulator_set_optimum_mode(struct regulator *regulator,
-					int load_uA)
+static inline int regulator_set_load(struct regulator *regulator, int load_uA)
 {
 	return REGULATOR_MODE_NORMAL;
 }
@@ -555,4 +554,11 @@ static inline int regulator_is_supported_voltage_tol(struct regulator *regulator
 					      target_uV + tol_uV);
 }
 
+/* TEMP: Wrapper to keep bisectability */
+static inline int regulator_set_optimum_mode(struct regulator *regulator,
+					     int load_uA)
+{
+	return regulator_set_load(regulator, load_uA);
+}
+
 #endif
-- 
1.8.2.2


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH 2/5] ufs: Rename of regulator_set_optimum_mode
  2015-02-12  3:35 [PATCH 0/5] Rename regulator_set_optimum_mode Bjorn Andersson
  2015-02-12  3:35 ` [PATCH 1/5] regulator: " Bjorn Andersson
@ 2015-02-12  3:35 ` Bjorn Andersson
  2015-04-14 12:11   ` Akinobu Mita
  2015-02-12  3:35 ` [PATCH 3/5] usb: phy: ab8500-usb: Rename regulator_set_optimum_mode Bjorn Andersson
                   ` (4 subsequent siblings)
  6 siblings, 1 reply; 13+ messages in thread
From: Bjorn Andersson @ 2015-02-12  3:35 UTC (permalink / raw)
  To: Vinayak Holikatti, James E.J. Bottomley, Mark Brown
  Cc: linux-scsi, linux-kernel, linux-arm-msm

The function regulator_set_optimum_mode() is changing name to
regulator_set_load(), so update the code accordingly. Also cleaned up
ufshcd_config_vreg_load() while touching the code.

Signed-off-by: Bjorn Andersson <bjorn.andersson@sonymobile.com>
---
 drivers/scsi/ufs/ufshcd.c | 27 +++++++--------------------
 1 file changed, 7 insertions(+), 20 deletions(-)

diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index 2e4614b..4b73b94 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -4225,22 +4225,15 @@ static struct scsi_host_template ufshcd_driver_template = {
 static int ufshcd_config_vreg_load(struct device *dev, struct ufs_vreg *vreg,
 				   int ua)
 {
-	int ret = 0;
-	struct regulator *reg = vreg->reg;
-	const char *name = vreg->name;
+	int ret;
 
-	BUG_ON(!vreg);
+	if (!vreg)
+		return 0;
 
-	ret = regulator_set_optimum_mode(reg, ua);
-	if (ret >= 0) {
-		/*
-		 * regulator_set_optimum_mode() returns new regulator
-		 * mode upon success.
-		 */
-		ret = 0;
-	} else {
-		dev_err(dev, "%s: %s set optimum mode(ua=%d) failed, err=%d\n",
-				__func__, name, ua, ret);
+	ret = regulator_set_load(vreg->reg, ua);
+	if (ret < 0) {
+		dev_err(dev, "%s: %s set load (ua=%d) failed, err=%d\n",
+				__func__, vreg->name, ua, ret);
 	}
 
 	return ret;
@@ -4249,18 +4242,12 @@ static int ufshcd_config_vreg_load(struct device *dev, struct ufs_vreg *vreg,
 static inline int ufshcd_config_vreg_lpm(struct ufs_hba *hba,
 					 struct ufs_vreg *vreg)
 {
-	if (!vreg)
-		return 0;
-
 	return ufshcd_config_vreg_load(hba->dev, vreg, UFS_VREG_LPM_LOAD_UA);
 }
 
 static inline int ufshcd_config_vreg_hpm(struct ufs_hba *hba,
 					 struct ufs_vreg *vreg)
 {
-	if (!vreg)
-		return 0;
-
 	return ufshcd_config_vreg_load(hba->dev, vreg, vreg->max_uA);
 }
 
-- 
1.8.2.2


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH 3/5] usb: phy: ab8500-usb: Rename regulator_set_optimum_mode
  2015-02-12  3:35 [PATCH 0/5] Rename regulator_set_optimum_mode Bjorn Andersson
  2015-02-12  3:35 ` [PATCH 1/5] regulator: " Bjorn Andersson
  2015-02-12  3:35 ` [PATCH 2/5] ufs: Rename of regulator_set_optimum_mode Bjorn Andersson
@ 2015-02-12  3:35 ` Bjorn Andersson
  2015-02-27 15:29   ` Felipe Balbi
  2015-02-12  3:35 ` [PATCH 4/5] usb: phy: phy-msm-usb: " Bjorn Andersson
                   ` (3 subsequent siblings)
  6 siblings, 1 reply; 13+ messages in thread
From: Bjorn Andersson @ 2015-02-12  3:35 UTC (permalink / raw)
  To: Felipe Balbi, Greg Kroah-Hartman, Mark Brown
  Cc: linux-usb, linux-kernel, linux-arm-msm

The function regulator_set_optimum_mode() is changing name to
regulator_set_load(), so update the code accordingly.

Signed-off-by: Bjorn Andersson <bjorn.andersson@sonymobile.com>
---
 drivers/usb/phy/phy-ab8500-usb.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/phy/phy-ab8500-usb.c b/drivers/usb/phy/phy-ab8500-usb.c
index 0b1bd23..f5b3b92 100644
--- a/drivers/usb/phy/phy-ab8500-usb.c
+++ b/drivers/usb/phy/phy-ab8500-usb.c
@@ -277,7 +277,7 @@ static void ab8500_usb_regulator_enable(struct ab8500_usb *ab)
 			dev_err(ab->dev, "Failed to set the Vintcore to 1.3V, ret=%d\n",
 					ret);
 
-		ret = regulator_set_optimum_mode(ab->v_ulpi, 28000);
+		ret = regulator_set_load(ab->v_ulpi, 28000);
 		if (ret < 0)
 			dev_err(ab->dev, "Failed to set optimum mode (ret=%d)\n",
 					ret);
@@ -317,7 +317,7 @@ static void ab8500_usb_regulator_disable(struct ab8500_usb *ab)
 						ab->saved_v_ulpi, ret);
 		}
 
-		ret = regulator_set_optimum_mode(ab->v_ulpi, 0);
+		ret = regulator_set_load(ab->v_ulpi, 0);
 		if (ret < 0)
 			dev_err(ab->dev, "Failed to set optimum mode (ret=%d)\n",
 					ret);
-- 
1.8.2.2


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH 4/5] usb: phy: phy-msm-usb: Rename regulator_set_optimum_mode
  2015-02-12  3:35 [PATCH 0/5] Rename regulator_set_optimum_mode Bjorn Andersson
                   ` (2 preceding siblings ...)
  2015-02-12  3:35 ` [PATCH 3/5] usb: phy: ab8500-usb: Rename regulator_set_optimum_mode Bjorn Andersson
@ 2015-02-12  3:35 ` Bjorn Andersson
  2015-02-27 15:30   ` Felipe Balbi
  2015-02-12  3:35 ` [PATCH 5/5] regulator: Drop temporary regulator_set_optimum_mode wrapper Bjorn Andersson
                   ` (2 subsequent siblings)
  6 siblings, 1 reply; 13+ messages in thread
From: Bjorn Andersson @ 2015-02-12  3:35 UTC (permalink / raw)
  To: Felipe Balbi, Greg Kroah-Hartman, Mark Brown
  Cc: linux-usb, linux-kernel, linux-arm-msm

The function regulator_set_optimum_mode() is changing name to
regulator_set_load(), so update the code accordingly.

Signed-off-by: Bjorn Andersson <bjorn.andersson@sonymobile.com>
---
 drivers/usb/phy/phy-msm-usb.c | 15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)

diff --git a/drivers/usb/phy/phy-msm-usb.c b/drivers/usb/phy/phy-msm-usb.c
index 000fd89..6ed67ea 100644
--- a/drivers/usb/phy/phy-msm-usb.c
+++ b/drivers/usb/phy/phy-msm-usb.c
@@ -142,27 +142,22 @@ static int msm_hsusb_ldo_set_mode(struct msm_otg *motg, int on)
 	int ret = 0;
 
 	if (on) {
-		ret = regulator_set_optimum_mode(motg->v1p8,
-				USB_PHY_1P8_HPM_LOAD);
+		ret = regulator_set_load(motg->v1p8, USB_PHY_1P8_HPM_LOAD);
 		if (ret < 0) {
 			pr_err("Could not set HPM for v1p8\n");
 			return ret;
 		}
-		ret = regulator_set_optimum_mode(motg->v3p3,
-				USB_PHY_3P3_HPM_LOAD);
+		ret = regulator_set_load(motg->v3p3, USB_PHY_3P3_HPM_LOAD);
 		if (ret < 0) {
 			pr_err("Could not set HPM for v3p3\n");
-			regulator_set_optimum_mode(motg->v1p8,
-				USB_PHY_1P8_LPM_LOAD);
+			regulator_set_load(motg->v1p8, USB_PHY_1P8_LPM_LOAD);
 			return ret;
 		}
 	} else {
-		ret = regulator_set_optimum_mode(motg->v1p8,
-				USB_PHY_1P8_LPM_LOAD);
+		ret = regulator_set_load(motg->v1p8, USB_PHY_1P8_LPM_LOAD);
 		if (ret < 0)
 			pr_err("Could not set LPM for v1p8\n");
-		ret = regulator_set_optimum_mode(motg->v3p3,
-				USB_PHY_3P3_LPM_LOAD);
+		ret = regulator_set_load(motg->v3p3, USB_PHY_3P3_LPM_LOAD);
 		if (ret < 0)
 			pr_err("Could not set LPM for v3p3\n");
 	}
-- 
1.8.2.2


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH 5/5] regulator: Drop temporary regulator_set_optimum_mode wrapper
  2015-02-12  3:35 [PATCH 0/5] Rename regulator_set_optimum_mode Bjorn Andersson
                   ` (3 preceding siblings ...)
  2015-02-12  3:35 ` [PATCH 4/5] usb: phy: phy-msm-usb: " Bjorn Andersson
@ 2015-02-12  3:35 ` Bjorn Andersson
  2015-02-25 23:40 ` [PATCH 0/5] Rename regulator_set_optimum_mode Bjorn Andersson
  2015-03-09 18:33 ` Mark Brown
  6 siblings, 0 replies; 13+ messages in thread
From: Bjorn Andersson @ 2015-02-12  3:35 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown; +Cc: linux-kernel, linux-arm-msm

Signed-off-by: Bjorn Andersson <bjorn.andersson@sonymobile.com>
---
 include/linux/regulator/consumer.h | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/consumer.h
index 6d4e9d2..d8944f5 100644
--- a/include/linux/regulator/consumer.h
+++ b/include/linux/regulator/consumer.h
@@ -554,11 +554,4 @@ static inline int regulator_is_supported_voltage_tol(struct regulator *regulator
 					      target_uV + tol_uV);
 }
 
-/* TEMP: Wrapper to keep bisectability */
-static inline int regulator_set_optimum_mode(struct regulator *regulator,
-					     int load_uA)
-{
-	return regulator_set_load(regulator, load_uA);
-}
-
 #endif
-- 
1.8.2.2


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 0/5] Rename regulator_set_optimum_mode
  2015-02-12  3:35 [PATCH 0/5] Rename regulator_set_optimum_mode Bjorn Andersson
                   ` (4 preceding siblings ...)
  2015-02-12  3:35 ` [PATCH 5/5] regulator: Drop temporary regulator_set_optimum_mode wrapper Bjorn Andersson
@ 2015-02-25 23:40 ` Bjorn Andersson
  2015-03-05 10:46   ` Mark Brown
  2015-03-09 18:33 ` Mark Brown
  6 siblings, 1 reply; 13+ messages in thread
From: Bjorn Andersson @ 2015-02-25 23:40 UTC (permalink / raw)
  To: Bjorn Andersson
  Cc: James E.J. Bottomley, Felipe Balbi, Greg Kroah-Hartman,
	Jonathan Corbet, Liam Girdwood, Mark Brown, Vinayak Holikatti,
	linux-arm-msm, linux-doc, linux-kernel, linux-pm, linux-scsi,
	linux-usb

On Wed, Feb 11, 2015 at 7:35 PM, Bjorn Andersson
<bjorn.andersson@sonymobile.com> wrote:
> Changing the name of the regulator_set_optimum_mode() to
> regulator_set_load() better reflects that the API is doing.
>

Any comments on this?

I'm going to propose a patch to the mmc framework calling this api, so
it would be good to know before I add another consumer of the api.

Regards,
Bjorn

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 3/5] usb: phy: ab8500-usb: Rename regulator_set_optimum_mode
  2015-02-12  3:35 ` [PATCH 3/5] usb: phy: ab8500-usb: Rename regulator_set_optimum_mode Bjorn Andersson
@ 2015-02-27 15:29   ` Felipe Balbi
  0 siblings, 0 replies; 13+ messages in thread
From: Felipe Balbi @ 2015-02-27 15:29 UTC (permalink / raw)
  To: Bjorn Andersson
  Cc: Felipe Balbi, Greg Kroah-Hartman, Mark Brown, linux-usb,
	linux-kernel, linux-arm-msm

[-- Attachment #1: Type: text/plain, Size: 1419 bytes --]

On Wed, Feb 11, 2015 at 07:35:29PM -0800, Bjorn Andersson wrote:
> The function regulator_set_optimum_mode() is changing name to
> regulator_set_load(), so update the code accordingly.
> 
> Signed-off-by: Bjorn Andersson <bjorn.andersson@sonymobile.com>

since this depends on the rest of the series:

Acked-by: Felipe Balbi <balbi@ti.com>

> ---
>  drivers/usb/phy/phy-ab8500-usb.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/usb/phy/phy-ab8500-usb.c b/drivers/usb/phy/phy-ab8500-usb.c
> index 0b1bd23..f5b3b92 100644
> --- a/drivers/usb/phy/phy-ab8500-usb.c
> +++ b/drivers/usb/phy/phy-ab8500-usb.c
> @@ -277,7 +277,7 @@ static void ab8500_usb_regulator_enable(struct ab8500_usb *ab)
>  			dev_err(ab->dev, "Failed to set the Vintcore to 1.3V, ret=%d\n",
>  					ret);
>  
> -		ret = regulator_set_optimum_mode(ab->v_ulpi, 28000);
> +		ret = regulator_set_load(ab->v_ulpi, 28000);
>  		if (ret < 0)
>  			dev_err(ab->dev, "Failed to set optimum mode (ret=%d)\n",
>  					ret);
> @@ -317,7 +317,7 @@ static void ab8500_usb_regulator_disable(struct ab8500_usb *ab)
>  						ab->saved_v_ulpi, ret);
>  		}
>  
> -		ret = regulator_set_optimum_mode(ab->v_ulpi, 0);
> +		ret = regulator_set_load(ab->v_ulpi, 0);
>  		if (ret < 0)
>  			dev_err(ab->dev, "Failed to set optimum mode (ret=%d)\n",
>  					ret);
> -- 
> 1.8.2.2
> 

-- 
balbi

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 4/5] usb: phy: phy-msm-usb: Rename regulator_set_optimum_mode
  2015-02-12  3:35 ` [PATCH 4/5] usb: phy: phy-msm-usb: " Bjorn Andersson
@ 2015-02-27 15:30   ` Felipe Balbi
  0 siblings, 0 replies; 13+ messages in thread
From: Felipe Balbi @ 2015-02-27 15:30 UTC (permalink / raw)
  To: Bjorn Andersson
  Cc: Felipe Balbi, Greg Kroah-Hartman, Mark Brown, linux-usb,
	linux-kernel, linux-arm-msm

[-- Attachment #1: Type: text/plain, Size: 1895 bytes --]

On Wed, Feb 11, 2015 at 07:35:30PM -0800, Bjorn Andersson wrote:
> The function regulator_set_optimum_mode() is changing name to
> regulator_set_load(), so update the code accordingly.
> 
> Signed-off-by: Bjorn Andersson <bjorn.andersson@sonymobile.com>

since this depends on the rest of the series:

Acked-by: Felipe Balbi <balbi@ti.com>

> ---
>  drivers/usb/phy/phy-msm-usb.c | 15 +++++----------
>  1 file changed, 5 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/usb/phy/phy-msm-usb.c b/drivers/usb/phy/phy-msm-usb.c
> index 000fd89..6ed67ea 100644
> --- a/drivers/usb/phy/phy-msm-usb.c
> +++ b/drivers/usb/phy/phy-msm-usb.c
> @@ -142,27 +142,22 @@ static int msm_hsusb_ldo_set_mode(struct msm_otg *motg, int on)
>  	int ret = 0;
>  
>  	if (on) {
> -		ret = regulator_set_optimum_mode(motg->v1p8,
> -				USB_PHY_1P8_HPM_LOAD);
> +		ret = regulator_set_load(motg->v1p8, USB_PHY_1P8_HPM_LOAD);
>  		if (ret < 0) {
>  			pr_err("Could not set HPM for v1p8\n");
>  			return ret;
>  		}
> -		ret = regulator_set_optimum_mode(motg->v3p3,
> -				USB_PHY_3P3_HPM_LOAD);
> +		ret = regulator_set_load(motg->v3p3, USB_PHY_3P3_HPM_LOAD);
>  		if (ret < 0) {
>  			pr_err("Could not set HPM for v3p3\n");
> -			regulator_set_optimum_mode(motg->v1p8,
> -				USB_PHY_1P8_LPM_LOAD);
> +			regulator_set_load(motg->v1p8, USB_PHY_1P8_LPM_LOAD);
>  			return ret;
>  		}
>  	} else {
> -		ret = regulator_set_optimum_mode(motg->v1p8,
> -				USB_PHY_1P8_LPM_LOAD);
> +		ret = regulator_set_load(motg->v1p8, USB_PHY_1P8_LPM_LOAD);
>  		if (ret < 0)
>  			pr_err("Could not set LPM for v1p8\n");
> -		ret = regulator_set_optimum_mode(motg->v3p3,
> -				USB_PHY_3P3_LPM_LOAD);
> +		ret = regulator_set_load(motg->v3p3, USB_PHY_3P3_LPM_LOAD);
>  		if (ret < 0)
>  			pr_err("Could not set LPM for v3p3\n");
>  	}
> -- 
> 1.8.2.2
> 

-- 
balbi

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 0/5] Rename regulator_set_optimum_mode
  2015-02-25 23:40 ` [PATCH 0/5] Rename regulator_set_optimum_mode Bjorn Andersson
@ 2015-03-05 10:46   ` Mark Brown
  0 siblings, 0 replies; 13+ messages in thread
From: Mark Brown @ 2015-03-05 10:46 UTC (permalink / raw)
  To: Bjorn Andersson
  Cc: Bjorn Andersson, James E.J. Bottomley, Felipe Balbi,
	Greg Kroah-Hartman, Jonathan Corbet, Liam Girdwood,
	Vinayak Holikatti, linux-arm-msm, linux-doc, linux-kernel,
	linux-pm, linux-scsi, linux-usb

[-- Attachment #1: Type: text/plain, Size: 348 bytes --]

On Wed, Feb 25, 2015 at 03:40:31PM -0800, Bjorn Andersson wrote:

> Any comments on this?

> I'm going to propose a patch to the mmc framework calling this api, so
> it would be good to know before I add another consumer of the api.

Please don't send content free nags.  They just add to the volume of
mail that needs to be read and responded to.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 0/5] Rename regulator_set_optimum_mode
  2015-02-12  3:35 [PATCH 0/5] Rename regulator_set_optimum_mode Bjorn Andersson
                   ` (5 preceding siblings ...)
  2015-02-25 23:40 ` [PATCH 0/5] Rename regulator_set_optimum_mode Bjorn Andersson
@ 2015-03-09 18:33 ` Mark Brown
  6 siblings, 0 replies; 13+ messages in thread
From: Mark Brown @ 2015-03-09 18:33 UTC (permalink / raw)
  To: Bjorn Andersson
  Cc: James E.J. Bottomley, Felipe Balbi, Greg Kroah-Hartman,
	Jonathan Corbet, Liam Girdwood, Vinayak Holikatti, linux-arm-msm,
	linux-doc, linux-kernel, linux-pm, linux-scsi, linux-usb

[-- Attachment #1: Type: text/plain, Size: 208 bytes --]

On Wed, Feb 11, 2015 at 07:35:26PM -0800, Bjorn Andersson wrote:
> Changing the name of the regulator_set_optimum_mode() to
> regulator_set_load() better reflects that the API is doing.

Applied all, thanks.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 2/5] ufs: Rename of regulator_set_optimum_mode
  2015-02-12  3:35 ` [PATCH 2/5] ufs: Rename of regulator_set_optimum_mode Bjorn Andersson
@ 2015-04-14 12:11   ` Akinobu Mita
  2015-04-15 18:35     ` Bjorn Andersson
  0 siblings, 1 reply; 13+ messages in thread
From: Akinobu Mita @ 2015-04-14 12:11 UTC (permalink / raw)
  To: Bjorn Andersson
  Cc: Vinayak Holikatti, James E.J. Bottomley, Mark Brown, linux-scsi,
	LKML, linux-arm-msm

2015-02-12 12:35 GMT+09:00 Bjorn Andersson <bjorn.andersson@sonymobile.com>:
> The function regulator_set_optimum_mode() is changing name to
> regulator_set_load(), so update the code accordingly. Also cleaned up
> ufshcd_config_vreg_load() while touching the code.
>
> Signed-off-by: Bjorn Andersson <bjorn.andersson@sonymobile.com>
> ---
>  drivers/scsi/ufs/ufshcd.c | 27 +++++++--------------------
>  1 file changed, 7 insertions(+), 20 deletions(-)
>
> diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
> index 2e4614b..4b73b94 100644
> --- a/drivers/scsi/ufs/ufshcd.c
> +++ b/drivers/scsi/ufs/ufshcd.c
> @@ -4225,22 +4225,15 @@ static struct scsi_host_template ufshcd_driver_template = {
>  static int ufshcd_config_vreg_load(struct device *dev, struct ufs_vreg *vreg,
>                                    int ua)
>  {
> -       int ret = 0;
> -       struct regulator *reg = vreg->reg;
> -       const char *name = vreg->name;
> +       int ret;
>
> -       BUG_ON(!vreg);
> +       if (!vreg)
> +               return 0;
>
> -       ret = regulator_set_optimum_mode(reg, ua);
> -       if (ret >= 0) {
> -               /*
> -                * regulator_set_optimum_mode() returns new regulator
> -                * mode upon success.
> -                */
> -               ret = 0;
> -       } else {
> -               dev_err(dev, "%s: %s set optimum mode(ua=%d) failed, err=%d\n",
> -                               __func__, name, ua, ret);
> +       ret = regulator_set_load(vreg->reg, ua);
> +       if (ret < 0) {
> +               dev_err(dev, "%s: %s set load (ua=%d) failed, err=%d\n",
> +                               __func__, vreg->name, ua, ret);
>         }
>
>         return ret;
> @@ -4249,18 +4242,12 @@ static int ufshcd_config_vreg_load(struct device *dev, struct ufs_vreg *vreg,
>  static inline int ufshcd_config_vreg_lpm(struct ufs_hba *hba,
>                                          struct ufs_vreg *vreg)
>  {
> -       if (!vreg)
> -               return 0;
> -
>         return ufshcd_config_vreg_load(hba->dev, vreg, UFS_VREG_LPM_LOAD_UA);
>  }
>
>  static inline int ufshcd_config_vreg_hpm(struct ufs_hba *hba,
>                                          struct ufs_vreg *vreg)
>  {
> -       if (!vreg)
> -               return 0;
> -
>         return ufshcd_config_vreg_load(hba->dev, vreg, vreg->max_uA);
>  }

I tried this patch and it caused kernel null pointer dereference with
'verg->max_uA' when vreg == NULL.  So you can't simply move !vreg check here
into ufshcd_config_vreg_load().

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 2/5] ufs: Rename of regulator_set_optimum_mode
  2015-04-14 12:11   ` Akinobu Mita
@ 2015-04-15 18:35     ` Bjorn Andersson
  0 siblings, 0 replies; 13+ messages in thread
From: Bjorn Andersson @ 2015-04-15 18:35 UTC (permalink / raw)
  To: Akinobu Mita
  Cc: Vinayak Holikatti, James E.J. Bottomley, Mark Brown, linux-scsi,
	LKML, linux-arm-msm

On Tue 14 Apr 05:11 PDT 2015, Akinobu Mita wrote:

> 2015-02-12 12:35 GMT+09:00 Bjorn Andersson <bjorn.andersson@sonymobile.com>:
> > The function regulator_set_optimum_mode() is changing name to
> > regulator_set_load(), so update the code accordingly. Also cleaned up
> > ufshcd_config_vreg_load() while touching the code.
> >
> > Signed-off-by: Bjorn Andersson <bjorn.andersson@sonymobile.com>

[..]

> >  static inline int ufshcd_config_vreg_hpm(struct ufs_hba *hba,
> >                                          struct ufs_vreg *vreg)
> >  {
> > -       if (!vreg)
> > -               return 0;
> > -
> >         return ufshcd_config_vreg_load(hba->dev, vreg, vreg->max_uA);
> >  }
> 
> I tried this patch and it caused kernel null pointer dereference with
> 'verg->max_uA' when vreg == NULL.  So you can't simply move !vreg check here
> into ufshcd_config_vreg_load().

Akinobu-san, you're correct, sorry for missing that (and in essence
reverting your commit).

Looks like Linus merged the fix on master, so I will send out a fixup.

Regards,
Bjorn

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2015-04-15 18:35 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-12  3:35 [PATCH 0/5] Rename regulator_set_optimum_mode Bjorn Andersson
2015-02-12  3:35 ` [PATCH 1/5] regulator: " Bjorn Andersson
2015-02-12  3:35 ` [PATCH 2/5] ufs: Rename of regulator_set_optimum_mode Bjorn Andersson
2015-04-14 12:11   ` Akinobu Mita
2015-04-15 18:35     ` Bjorn Andersson
2015-02-12  3:35 ` [PATCH 3/5] usb: phy: ab8500-usb: Rename regulator_set_optimum_mode Bjorn Andersson
2015-02-27 15:29   ` Felipe Balbi
2015-02-12  3:35 ` [PATCH 4/5] usb: phy: phy-msm-usb: " Bjorn Andersson
2015-02-27 15:30   ` Felipe Balbi
2015-02-12  3:35 ` [PATCH 5/5] regulator: Drop temporary regulator_set_optimum_mode wrapper Bjorn Andersson
2015-02-25 23:40 ` [PATCH 0/5] Rename regulator_set_optimum_mode Bjorn Andersson
2015-03-05 10:46   ` Mark Brown
2015-03-09 18:33 ` Mark Brown

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