[PATCH v3 02/13] usb: phy: msm: Move global regulators variables to driver state

2013-10-14 Thread Ivan T. Ivanov
From: Ivan T. Ivanov iiva...@mm-sol.com

Signed-off-by: Ivan T. Ivanov iiva...@mm-sol.com
---
 drivers/usb/phy/phy-msm-usb.c |   82 -
 include/linux/usb/msm_hsusb.h |3 ++
 2 files changed, 42 insertions(+), 43 deletions(-)

diff --git a/drivers/usb/phy/phy-msm-usb.c b/drivers/usb/phy/phy-msm-usb.c
index 118798d..ab39ecb 100644
--- a/drivers/usb/phy/phy-msm-usb.c
+++ b/drivers/usb/phy/phy-msm-usb.c
@@ -58,47 +58,43 @@
 #define USB_PHY_VDD_DIG_VOL_MIN100 /* uV */
 #define USB_PHY_VDD_DIG_VOL_MAX132 /* uV */
 
-static struct regulator *hsusb_3p3;
-static struct regulator *hsusb_1p8;
-static struct regulator *hsusb_vddcx;
-
 static int msm_hsusb_init_vddcx(struct msm_otg *motg, int init)
 {
int ret = 0;
 
if (init) {
-   hsusb_vddcx = regulator_get(motg-phy.dev, HSUSB_VDDCX);
-   if (IS_ERR(hsusb_vddcx)) {
+   motg-vddcx = regulator_get(motg-phy.dev, HSUSB_VDDCX);
+   if (IS_ERR(motg-vddcx)) {
dev_err(motg-phy.dev, unable to get hsusb vddcx\n);
-   return PTR_ERR(hsusb_vddcx);
+   return PTR_ERR(motg-vddcx);
}
 
-   ret = regulator_set_voltage(hsusb_vddcx,
+   ret = regulator_set_voltage(motg-vddcx,
USB_PHY_VDD_DIG_VOL_MIN,
USB_PHY_VDD_DIG_VOL_MAX);
if (ret) {
dev_err(motg-phy.dev, unable to set the voltage 
for hsusb vddcx\n);
-   regulator_put(hsusb_vddcx);
+   regulator_put(motg-vddcx);
return ret;
}
 
-   ret = regulator_enable(hsusb_vddcx);
+   ret = regulator_enable(motg-vddcx);
if (ret) {
dev_err(motg-phy.dev, unable to enable hsusb 
vddcx\n);
-   regulator_put(hsusb_vddcx);
+   regulator_put(motg-vddcx);
}
} else {
-   ret = regulator_set_voltage(hsusb_vddcx, 0,
+   ret = regulator_set_voltage(motg-vddcx, 0,
USB_PHY_VDD_DIG_VOL_MAX);
if (ret)
dev_err(motg-phy.dev, unable to set the voltage 
for hsusb vddcx\n);
-   ret = regulator_disable(hsusb_vddcx);
+   ret = regulator_disable(motg-vddcx);
if (ret)
dev_err(motg-phy.dev, unable to disable hsusb 
vddcx\n);
 
-   regulator_put(hsusb_vddcx);
+   regulator_put(motg-vddcx);
}
 
return ret;
@@ -109,38 +105,38 @@ static int msm_hsusb_ldo_init(struct msm_otg *motg, int 
init)
int rc = 0;
 
if (init) {
-   hsusb_3p3 = regulator_get(motg-phy.dev, HSUSB_3p3);
-   if (IS_ERR(hsusb_3p3)) {
+   motg-v3p3 = regulator_get(motg-phy.dev, HSUSB_3p3);
+   if (IS_ERR(motg-v3p3)) {
dev_err(motg-phy.dev, unable to get hsusb 3p3\n);
-   return PTR_ERR(hsusb_3p3);
+   return PTR_ERR(motg-v3p3);
}
 
-   rc = regulator_set_voltage(hsusb_3p3, USB_PHY_3P3_VOL_MIN,
+   rc = regulator_set_voltage(motg-v3p3, USB_PHY_3P3_VOL_MIN,
USB_PHY_3P3_VOL_MAX);
if (rc) {
dev_err(motg-phy.dev, unable to set voltage level 
for hsusb 3p3\n);
goto put_3p3;
}
-   rc = regulator_enable(hsusb_3p3);
+   rc = regulator_enable(motg-v3p3);
if (rc) {
dev_err(motg-phy.dev, unable to enable the hsusb 
3p3\n);
goto put_3p3;
}
-   hsusb_1p8 = regulator_get(motg-phy.dev, HSUSB_1p8);
-   if (IS_ERR(hsusb_1p8)) {
+   motg-v1p8 = regulator_get(motg-phy.dev, HSUSB_1p8);
+   if (IS_ERR(motg-v1p8)) {
dev_err(motg-phy.dev, unable to get hsusb 1p8\n);
-   rc = PTR_ERR(hsusb_1p8);
+   rc = PTR_ERR(motg-v1p8);
goto disable_3p3;
}
-   rc = regulator_set_voltage(hsusb_1p8, USB_PHY_1P8_VOL_MIN,
+   rc = regulator_set_voltage(motg-v1p8, USB_PHY_1P8_VOL_MIN,
USB_PHY_1P8_VOL_MAX);
if (rc) {
dev_err(motg-phy.dev, unable to set voltage level 
for hsusb 1p8\n);
goto put_1p8;
}
-   rc = regulator_enable(hsusb_1p8);
+   rc = regulator_enable(motg-v1p8);

Re: [PATCH v3 02/13] usb: phy: msm: Move global regulators variables to driver state

2013-10-14 Thread Felipe Balbi
On Mon, Oct 14, 2013 at 06:24:29PM +0300, Ivan T. Ivanov wrote:
 From: Ivan T. Ivanov iiva...@mm-sol.com
 
 Signed-off-by: Ivan T. Ivanov iiva...@mm-sol.com

this one looks good.

-- 
balbi


signature.asc
Description: Digital signature