linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [GIT PULL 00/20] phy: for 4.0 -rc cycle
@ 2015-03-13 12:01 Kishon Vijay Abraham I
  2015-03-13 12:01 ` [PATCH 01/20] phy: miphy28lp: Avoid calling of_get_child_count() multiple times Kishon Vijay Abraham I
                   ` (20 more replies)
  0 siblings, 21 replies; 25+ messages in thread
From: Kishon Vijay Abraham I @ 2015-03-13 12:01 UTC (permalink / raw)
  To: gregkh; +Cc: kishon, linux-kernel

Hi Greg,

Please find the pull request for 4.0 -rc cycle. We should thank Axel Lin for
reviewing all the PHY drivers and sending fixes. This also includes a fix
from Thierry Reding in phy core.

Let me know if I have to change something.

Thanks
Kishon

The following changes since commit c517d838eb7d07bbe9507871fab3931deccff539:

  Linux 4.0-rc1 (2015-02-22 18:21:14 -0800)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/kishon/linux-phy.git tags/for-4.0-rc

for you to fetch changes up to b1ff3231b2d4197ef5024f9c57ffc6cfa562590c:

  phy: omap-usb2: Fix missing clk_prepare call when using old dt name (2015-03-13 17:14:39 +0530)

----------------------------------------------------------------
contains fixes all over drivers/phy

----------------------------------------------------------------
Axel Lin (19):
      phy: miphy28lp: Avoid calling of_get_child_count() multiple times
      phy: miphy365x: Avoid calling of_get_child_count() multiple times
      phy: armada375-usb2: Set drvdata for phy and use it
      phy: xgene: Remove duplicate code to set ctx->dev
      phy: miphy28lp: Add missing .owner field in miphy28lp_ops
      phy: exynos-mipi-video: Fixup the test for state->regmap
      phy: exynos-mipi-video: Use spin_lock to protct state->regmap rmw operations
      phy: exynos-dp-video: Kill exynos_dp_video_phy_pwr_isol function
      phy: hix5hd2-sata: Check return value of platform_get_resource
      phy: samsung-usb2: Remove NULL terminating entry from phys array
      phy: ti-pipe3: Simplify ti_pipe3_dpll_wait_lock implementation
      phy: rockchip-usb: Fixup rockchip_usb_phy_power_on failure path
      phy: exynos5-usbdrd: Fix off-by-one valid value checking for args->args[0]
      phy: twl4030-usb: Remove redundant assignment for twl->linkstat
      phy: miphy365x: Convert to devm_kcalloc and fix wrong sizeof
      phy: miphy28lp: Convert to devm_kcalloc and fix wrong sizof
      phy: core: Fixup return value of phy_exit when !pm_runtime_enabled
      phy: ti/omap: Fix modalias
      phy: omap-usb2: Fix missing clk_prepare call when using old dt name

Thierry Reding (1):
      phy: Find the right match in devm_phy_destroy()

 drivers/phy/phy-armada375-usb2.c    |    3 ++-
 drivers/phy/phy-core.c              |   11 ++++++-----
 drivers/phy/phy-exynos-dp-video.c   |   24 ++++--------------------
 drivers/phy/phy-exynos-mipi-video.c |   11 ++++-------
 drivers/phy/phy-exynos4210-usb2.c   |    1 -
 drivers/phy/phy-exynos4x12-usb2.c   |    1 -
 drivers/phy/phy-exynos5-usbdrd.c    |    2 +-
 drivers/phy/phy-exynos5250-usb2.c   |    1 -
 drivers/phy/phy-hix5hd2-sata.c      |    3 +++
 drivers/phy/phy-miphy28lp.c         |   13 +++++++------
 drivers/phy/phy-miphy365x.c         |   12 ++++++------
 drivers/phy/phy-omap-control.c      |    2 +-
 drivers/phy/phy-omap-usb2.c         |    7 ++++---
 drivers/phy/phy-rockchip-usb.c      |    6 +++---
 drivers/phy/phy-ti-pipe3.c          |   12 ++++--------
 drivers/phy/phy-twl4030-usb.c       |    1 -
 drivers/phy/phy-xgene.c             |    1 -
 17 files changed, 45 insertions(+), 66 deletions(-)

-- 
1.7.9.5


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

* [PATCH 01/20] phy: miphy28lp: Avoid calling of_get_child_count() multiple times
  2015-03-13 12:01 [GIT PULL 00/20] phy: for 4.0 -rc cycle Kishon Vijay Abraham I
@ 2015-03-13 12:01 ` Kishon Vijay Abraham I
  2015-03-13 12:01 ` [PATCH 02/20] phy: miphy365x: " Kishon Vijay Abraham I
                   ` (19 subsequent siblings)
  20 siblings, 0 replies; 25+ messages in thread
From: Kishon Vijay Abraham I @ 2015-03-13 12:01 UTC (permalink / raw)
  To: gregkh; +Cc: kishon, linux-kernel

From: Axel Lin <axel.lin@ingics.com>

Currently, of_get_child_count() is called in each iteration of the for loop in
miphy28lp_xlate(). This patch stores the return value of of_get_child_count()
in miphy_dev->nphys and call of_get_child_count() once in miphy28lp_probe().

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
---
 drivers/phy/phy-miphy28lp.c |   11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/phy/phy-miphy28lp.c b/drivers/phy/phy-miphy28lp.c
index 9b2848e..d444932 100644
--- a/drivers/phy/phy-miphy28lp.c
+++ b/drivers/phy/phy-miphy28lp.c
@@ -228,6 +228,7 @@ struct miphy28lp_dev {
 	struct regmap *regmap;
 	struct mutex miphy_mutex;
 	struct miphy28lp_phy **phys;
+	int nphys;
 };
 
 struct miphy_initval {
@@ -1116,7 +1117,7 @@ static struct phy *miphy28lp_xlate(struct device *dev,
 		return ERR_PTR(-EINVAL);
 	}
 
-	for (index = 0; index < of_get_child_count(dev->of_node); index++)
+	for (index = 0; index < miphy_dev->nphys; index++)
 		if (phynode == miphy_dev->phys[index]->phy->dev.of_node) {
 			miphy_phy = miphy_dev->phys[index];
 			break;
@@ -1200,15 +1201,15 @@ static int miphy28lp_probe(struct platform_device *pdev)
 	struct miphy28lp_dev *miphy_dev;
 	struct phy_provider *provider;
 	struct phy *phy;
-	int chancount, port = 0;
-	int ret;
+	int ret, port = 0;
 
 	miphy_dev = devm_kzalloc(&pdev->dev, sizeof(*miphy_dev), GFP_KERNEL);
 	if (!miphy_dev)
 		return -ENOMEM;
 
-	chancount = of_get_child_count(np);
-	miphy_dev->phys = devm_kzalloc(&pdev->dev, sizeof(phy) * chancount,
+	miphy_dev->nphys = of_get_child_count(np);
+	miphy_dev->phys = devm_kzalloc(&pdev->dev,
+				       sizeof(phy) * miphy_dev->nphys,
 				       GFP_KERNEL);
 	if (!miphy_dev->phys)
 		return -ENOMEM;
-- 
1.7.9.5


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

* [PATCH 02/20] phy: miphy365x: Avoid calling of_get_child_count() multiple times
  2015-03-13 12:01 [GIT PULL 00/20] phy: for 4.0 -rc cycle Kishon Vijay Abraham I
  2015-03-13 12:01 ` [PATCH 01/20] phy: miphy28lp: Avoid calling of_get_child_count() multiple times Kishon Vijay Abraham I
@ 2015-03-13 12:01 ` Kishon Vijay Abraham I
  2015-03-13 12:01 ` [PATCH 03/20] phy: armada375-usb2: Set drvdata for phy and use it Kishon Vijay Abraham I
                   ` (18 subsequent siblings)
  20 siblings, 0 replies; 25+ messages in thread
From: Kishon Vijay Abraham I @ 2015-03-13 12:01 UTC (permalink / raw)
  To: gregkh; +Cc: kishon, linux-kernel

From: Axel Lin <axel.lin@ingics.com>

Currently, of_get_child_count() is called in each iteration of the for loop in
miphy365x_xlate(). This patch stores the return value of of_get_child_count()
in miphy_dev->nphys and call of_get_child_count() once in miphy365x_probe().

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
---
 drivers/phy/phy-miphy365x.c |   11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/phy/phy-miphy365x.c b/drivers/phy/phy-miphy365x.c
index 6c80154..61177a6 100644
--- a/drivers/phy/phy-miphy365x.c
+++ b/drivers/phy/phy-miphy365x.c
@@ -150,6 +150,7 @@ struct miphy365x_dev {
 	struct regmap *regmap;
 	struct mutex miphy_mutex;
 	struct miphy365x_phy **phys;
+	int nphys;
 };
 
 /*
@@ -485,7 +486,7 @@ static struct phy *miphy365x_xlate(struct device *dev,
 		return ERR_PTR(-EINVAL);
 	}
 
-	for (index = 0; index < of_get_child_count(dev->of_node); index++)
+	for (index = 0; index < miphy_dev->nphys; index++)
 		if (phynode == miphy_dev->phys[index]->phy->dev.of_node) {
 			miphy_phy = miphy_dev->phys[index];
 			break;
@@ -541,15 +542,15 @@ static int miphy365x_probe(struct platform_device *pdev)
 	struct miphy365x_dev *miphy_dev;
 	struct phy_provider *provider;
 	struct phy *phy;
-	int chancount, port = 0;
-	int ret;
+	int ret, port = 0;
 
 	miphy_dev = devm_kzalloc(&pdev->dev, sizeof(*miphy_dev), GFP_KERNEL);
 	if (!miphy_dev)
 		return -ENOMEM;
 
-	chancount = of_get_child_count(np);
-	miphy_dev->phys = devm_kzalloc(&pdev->dev, sizeof(phy) * chancount,
+	miphy_dev->nphys = of_get_child_count(np);
+	miphy_dev->phys = devm_kzalloc(&pdev->dev,
+				       sizeof(phy) * miphy_dev->nphys,
 				       GFP_KERNEL);
 	if (!miphy_dev->phys)
 		return -ENOMEM;
-- 
1.7.9.5


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

* [PATCH 03/20] phy: armada375-usb2: Set drvdata for phy and use it
  2015-03-13 12:01 [GIT PULL 00/20] phy: for 4.0 -rc cycle Kishon Vijay Abraham I
  2015-03-13 12:01 ` [PATCH 01/20] phy: miphy28lp: Avoid calling of_get_child_count() multiple times Kishon Vijay Abraham I
  2015-03-13 12:01 ` [PATCH 02/20] phy: miphy365x: " Kishon Vijay Abraham I
@ 2015-03-13 12:01 ` Kishon Vijay Abraham I
  2015-03-13 12:01 ` [PATCH 04/20] phy: xgene: Remove duplicate code to set ctx->dev Kishon Vijay Abraham I
                   ` (17 subsequent siblings)
  20 siblings, 0 replies; 25+ messages in thread
From: Kishon Vijay Abraham I @ 2015-03-13 12:01 UTC (permalink / raw)
  To: gregkh; +Cc: kishon, linux-kernel

From: Axel Lin <axel.lin@ingics.com>

At the context we have pointer to struct phy, it's useful to call
phy_get_drvdata() to get the address of cluster_phy. This has slightly
better readability than calling dev_get_drvdata(phy->dev.parent).

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
---
 drivers/phy/phy-armada375-usb2.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/phy/phy-armada375-usb2.c b/drivers/phy/phy-armada375-usb2.c
index 7c99ca2..8ccc395 100644
--- a/drivers/phy/phy-armada375-usb2.c
+++ b/drivers/phy/phy-armada375-usb2.c
@@ -37,7 +37,7 @@ static int armada375_usb_phy_init(struct phy *phy)
 	struct armada375_cluster_phy *cluster_phy;
 	u32 reg;
 
-	cluster_phy = dev_get_drvdata(phy->dev.parent);
+	cluster_phy = phy_get_drvdata(phy);
 	if (!cluster_phy)
 		return -ENODEV;
 
@@ -131,6 +131,7 @@ static int armada375_usb_phy_probe(struct platform_device *pdev)
 	cluster_phy->reg = usb_cluster_base;
 
 	dev_set_drvdata(dev, cluster_phy);
+	phy_set_drvdata(phy, cluster_phy);
 
 	phy_provider = devm_of_phy_provider_register(&pdev->dev,
 						     armada375_usb_phy_xlate);
-- 
1.7.9.5


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

* [PATCH 04/20] phy: xgene: Remove duplicate code to set ctx->dev
  2015-03-13 12:01 [GIT PULL 00/20] phy: for 4.0 -rc cycle Kishon Vijay Abraham I
                   ` (2 preceding siblings ...)
  2015-03-13 12:01 ` [PATCH 03/20] phy: armada375-usb2: Set drvdata for phy and use it Kishon Vijay Abraham I
@ 2015-03-13 12:01 ` Kishon Vijay Abraham I
  2015-03-13 12:01 ` [PATCH 05/20] phy: miphy28lp: Add missing .owner field in miphy28lp_ops Kishon Vijay Abraham I
                   ` (16 subsequent siblings)
  20 siblings, 0 replies; 25+ messages in thread
From: Kishon Vijay Abraham I @ 2015-03-13 12:01 UTC (permalink / raw)
  To: gregkh; +Cc: kishon, linux-kernel

From: Axel Lin <axel.lin@ingics.com>

Set it once is enough and it's done after devm_kzalloc().

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
---
 drivers/phy/phy-xgene.c |    1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/phy/phy-xgene.c b/drivers/phy/phy-xgene.c
index 29214a3..2263cd0 100644
--- a/drivers/phy/phy-xgene.c
+++ b/drivers/phy/phy-xgene.c
@@ -1704,7 +1704,6 @@ static int xgene_phy_probe(struct platform_device *pdev)
 	for (i = 0; i < MAX_LANE; i++)
 		ctx->sata_param.speed[i] = 2; /* Default to Gen3 */
 
-	ctx->dev = &pdev->dev;
 	platform_set_drvdata(pdev, ctx);
 
 	ctx->phy = devm_phy_create(ctx->dev, NULL, &xgene_phy_ops);
-- 
1.7.9.5


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

* [PATCH 05/20] phy: miphy28lp: Add missing .owner field in miphy28lp_ops
  2015-03-13 12:01 [GIT PULL 00/20] phy: for 4.0 -rc cycle Kishon Vijay Abraham I
                   ` (3 preceding siblings ...)
  2015-03-13 12:01 ` [PATCH 04/20] phy: xgene: Remove duplicate code to set ctx->dev Kishon Vijay Abraham I
@ 2015-03-13 12:01 ` Kishon Vijay Abraham I
  2015-03-13 12:01 ` [PATCH 06/20] phy: exynos-mipi-video: Fixup the test for state->regmap Kishon Vijay Abraham I
                   ` (15 subsequent siblings)
  20 siblings, 0 replies; 25+ messages in thread
From: Kishon Vijay Abraham I @ 2015-03-13 12:01 UTC (permalink / raw)
  To: gregkh; +Cc: kishon, linux-kernel

From: Axel Lin <axel.lin@ingics.com>

Add missing .owner field in miphy28lp_ops, which is used for refcounting.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
---
 drivers/phy/phy-miphy28lp.c |    1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/phy/phy-miphy28lp.c b/drivers/phy/phy-miphy28lp.c
index d444932..4fe1755 100644
--- a/drivers/phy/phy-miphy28lp.c
+++ b/drivers/phy/phy-miphy28lp.c
@@ -1139,6 +1139,7 @@ static struct phy *miphy28lp_xlate(struct device *dev,
 
 static struct phy_ops miphy28lp_ops = {
 	.init = miphy28lp_init,
+	.owner = THIS_MODULE,
 };
 
 static int miphy28lp_probe_resets(struct device_node *node,
-- 
1.7.9.5


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

* [PATCH 06/20] phy: exynos-mipi-video: Fixup the test for state->regmap
  2015-03-13 12:01 [GIT PULL 00/20] phy: for 4.0 -rc cycle Kishon Vijay Abraham I
                   ` (4 preceding siblings ...)
  2015-03-13 12:01 ` [PATCH 05/20] phy: miphy28lp: Add missing .owner field in miphy28lp_ops Kishon Vijay Abraham I
@ 2015-03-13 12:01 ` Kishon Vijay Abraham I
  2015-03-13 12:01 ` [PATCH 07/20] phy: exynos-mipi-video: Use spin_lock to protct state->regmap rmw operations Kishon Vijay Abraham I
                   ` (14 subsequent siblings)
  20 siblings, 0 replies; 25+ messages in thread
From: Kishon Vijay Abraham I @ 2015-03-13 12:01 UTC (permalink / raw)
  To: gregkh; +Cc: kishon, linux-kernel

From: Axel Lin <axel.lin@ingics.com>

syscon_regmap_lookup_by_phandle() returns ERR_PTR on error.
Thus don't use null test against state->regmap.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
---
 drivers/phy/phy-exynos-mipi-video.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/phy/phy-exynos-mipi-video.c b/drivers/phy/phy-exynos-mipi-video.c
index f017b2f..d196493 100644
--- a/drivers/phy/phy-exynos-mipi-video.c
+++ b/drivers/phy/phy-exynos-mipi-video.c
@@ -59,7 +59,7 @@ static int __set_phy_state(struct exynos_mipi_video_phy *state,
 	else
 		reset = EXYNOS4_MIPI_PHY_SRESETN;
 
-	if (state->regmap) {
+	if (!IS_ERR(state->regmap)) {
 		mutex_lock(&state->mutex);
 		regmap_read(state->regmap, offset, &val);
 		if (on)
-- 
1.7.9.5


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

* [PATCH 07/20] phy: exynos-mipi-video: Use spin_lock to protct state->regmap rmw operations
  2015-03-13 12:01 [GIT PULL 00/20] phy: for 4.0 -rc cycle Kishon Vijay Abraham I
                   ` (5 preceding siblings ...)
  2015-03-13 12:01 ` [PATCH 06/20] phy: exynos-mipi-video: Fixup the test for state->regmap Kishon Vijay Abraham I
@ 2015-03-13 12:01 ` Kishon Vijay Abraham I
  2015-03-13 12:01 ` [PATCH 08/20] phy: exynos-dp-video: Kill exynos_dp_video_phy_pwr_isol function Kishon Vijay Abraham I
                   ` (13 subsequent siblings)
  20 siblings, 0 replies; 25+ messages in thread
From: Kishon Vijay Abraham I @ 2015-03-13 12:01 UTC (permalink / raw)
  To: gregkh; +Cc: kishon, linux-kernel

From: Axel Lin <axel.lin@ingics.com>

The state->regmap is initialized by devm_regmap_init_mmio().
So it's fine to use spin_lock rather than mutex to protct state->regmap rmw
operations.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Tested-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
[Julia.Lawall@lip6.fr: Found an issue with the original patch w.r.t unbalanced
 spin_lock call]
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
---
 drivers/phy/phy-exynos-mipi-video.c |    9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/phy/phy-exynos-mipi-video.c b/drivers/phy/phy-exynos-mipi-video.c
index d196493..df7519a 100644
--- a/drivers/phy/phy-exynos-mipi-video.c
+++ b/drivers/phy/phy-exynos-mipi-video.c
@@ -43,7 +43,6 @@ struct exynos_mipi_video_phy {
 	} phys[EXYNOS_MIPI_PHYS_NUM];
 	spinlock_t slock;
 	void __iomem *regs;
-	struct mutex mutex;
 	struct regmap *regmap;
 };
 
@@ -59,8 +58,9 @@ static int __set_phy_state(struct exynos_mipi_video_phy *state,
 	else
 		reset = EXYNOS4_MIPI_PHY_SRESETN;
 
+	spin_lock(&state->slock);
+
 	if (!IS_ERR(state->regmap)) {
-		mutex_lock(&state->mutex);
 		regmap_read(state->regmap, offset, &val);
 		if (on)
 			val |= reset;
@@ -72,11 +72,9 @@ static int __set_phy_state(struct exynos_mipi_video_phy *state,
 		else if (!(val & EXYNOS4_MIPI_PHY_RESET_MASK))
 			val &= ~EXYNOS4_MIPI_PHY_ENABLE;
 		regmap_write(state->regmap, offset, val);
-		mutex_unlock(&state->mutex);
 	} else {
 		addr = state->regs + EXYNOS_MIPI_PHY_CONTROL(id / 2);
 
-		spin_lock(&state->slock);
 		val = readl(addr);
 		if (on)
 			val |= reset;
@@ -90,9 +88,9 @@ static int __set_phy_state(struct exynos_mipi_video_phy *state,
 			val &= ~EXYNOS4_MIPI_PHY_ENABLE;
 
 		writel(val, addr);
-		spin_unlock(&state->slock);
 	}
 
+	spin_unlock(&state->slock);
 	return 0;
 }
 
@@ -158,7 +156,6 @@ static int exynos_mipi_video_phy_probe(struct platform_device *pdev)
 
 	dev_set_drvdata(dev, state);
 	spin_lock_init(&state->slock);
-	mutex_init(&state->mutex);
 
 	for (i = 0; i < EXYNOS_MIPI_PHYS_NUM; i++) {
 		struct phy *phy = devm_phy_create(dev, NULL,
-- 
1.7.9.5


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

* [PATCH 08/20] phy: exynos-dp-video: Kill exynos_dp_video_phy_pwr_isol function
  2015-03-13 12:01 [GIT PULL 00/20] phy: for 4.0 -rc cycle Kishon Vijay Abraham I
                   ` (6 preceding siblings ...)
  2015-03-13 12:01 ` [PATCH 07/20] phy: exynos-mipi-video: Use spin_lock to protct state->regmap rmw operations Kishon Vijay Abraham I
@ 2015-03-13 12:01 ` Kishon Vijay Abraham I
  2015-03-13 12:01 ` [PATCH 09/20] phy: hix5hd2-sata: Check return value of platform_get_resource Kishon Vijay Abraham I
                   ` (12 subsequent siblings)
  20 siblings, 0 replies; 25+ messages in thread
From: Kishon Vijay Abraham I @ 2015-03-13 12:01 UTC (permalink / raw)
  To: gregkh; +Cc: kishon, linux-kernel

From: Axel Lin <axel.lin@ingics.com>

If IS_ERR(state->regs) the .probe fails.
So IS_ERR(state->regs) test in exynos_dp_video_phy_pwr_isol() is not necessary.
exynos_dp_video_phy_pwr_isol() simply does a regmap_update_bits() call now,
just call regmap_update_bits() instead and return proper return value.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Reviewed-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
---
 drivers/phy/phy-exynos-dp-video.c |   24 ++++--------------------
 1 file changed, 4 insertions(+), 20 deletions(-)

diff --git a/drivers/phy/phy-exynos-dp-video.c b/drivers/phy/phy-exynos-dp-video.c
index f86cbe6..179cbf9 100644
--- a/drivers/phy/phy-exynos-dp-video.c
+++ b/drivers/phy/phy-exynos-dp-video.c
@@ -30,28 +30,13 @@ struct exynos_dp_video_phy {
 	const struct exynos_dp_video_phy_drvdata *drvdata;
 };
 
-static void exynos_dp_video_phy_pwr_isol(struct exynos_dp_video_phy *state,
-							unsigned int on)
-{
-	unsigned int val;
-
-	if (IS_ERR(state->regs))
-		return;
-
-	val = on ? 0 : EXYNOS5_PHY_ENABLE;
-
-	regmap_update_bits(state->regs, state->drvdata->phy_ctrl_offset,
-			   EXYNOS5_PHY_ENABLE, val);
-}
-
 static int exynos_dp_video_phy_power_on(struct phy *phy)
 {
 	struct exynos_dp_video_phy *state = phy_get_drvdata(phy);
 
 	/* Disable power isolation on DP-PHY */
-	exynos_dp_video_phy_pwr_isol(state, 0);
-
-	return 0;
+	return regmap_update_bits(state->regs, state->drvdata->phy_ctrl_offset,
+				  EXYNOS5_PHY_ENABLE, EXYNOS5_PHY_ENABLE);
 }
 
 static int exynos_dp_video_phy_power_off(struct phy *phy)
@@ -59,9 +44,8 @@ static int exynos_dp_video_phy_power_off(struct phy *phy)
 	struct exynos_dp_video_phy *state = phy_get_drvdata(phy);
 
 	/* Enable power isolation on DP-PHY */
-	exynos_dp_video_phy_pwr_isol(state, 1);
-
-	return 0;
+	return regmap_update_bits(state->regs, state->drvdata->phy_ctrl_offset,
+				  EXYNOS5_PHY_ENABLE, 0);
 }
 
 static struct phy_ops exynos_dp_video_phy_ops = {
-- 
1.7.9.5


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

* [PATCH 09/20] phy: hix5hd2-sata: Check return value of platform_get_resource
  2015-03-13 12:01 [GIT PULL 00/20] phy: for 4.0 -rc cycle Kishon Vijay Abraham I
                   ` (7 preceding siblings ...)
  2015-03-13 12:01 ` [PATCH 08/20] phy: exynos-dp-video: Kill exynos_dp_video_phy_pwr_isol function Kishon Vijay Abraham I
@ 2015-03-13 12:01 ` Kishon Vijay Abraham I
  2015-03-13 12:01 ` [PATCH 10/20] phy: samsung-usb2: Remove NULL terminating entry from phys array Kishon Vijay Abraham I
                   ` (11 subsequent siblings)
  20 siblings, 0 replies; 25+ messages in thread
From: Kishon Vijay Abraham I @ 2015-03-13 12:01 UTC (permalink / raw)
  To: gregkh; +Cc: kishon, linux-kernel

From: Axel Lin <axel.lin@ingics.com>

This prevent NULL pointer dereference if res is NULL.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Zhangfei Gao <zhangfei.gao@linaro.org>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
---
 drivers/phy/phy-hix5hd2-sata.c |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/phy/phy-hix5hd2-sata.c b/drivers/phy/phy-hix5hd2-sata.c
index 34915b4..d6b2265 100644
--- a/drivers/phy/phy-hix5hd2-sata.c
+++ b/drivers/phy/phy-hix5hd2-sata.c
@@ -147,6 +147,9 @@ static int hix5hd2_sata_phy_probe(struct platform_device *pdev)
 		return -ENOMEM;
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+	if (!res)
+		return -EINVAL;
+
 	priv->base = devm_ioremap(dev, res->start, resource_size(res));
 	if (!priv->base)
 		return -ENOMEM;
-- 
1.7.9.5


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

* [PATCH 10/20] phy: samsung-usb2: Remove NULL terminating entry from phys array
  2015-03-13 12:01 [GIT PULL 00/20] phy: for 4.0 -rc cycle Kishon Vijay Abraham I
                   ` (8 preceding siblings ...)
  2015-03-13 12:01 ` [PATCH 09/20] phy: hix5hd2-sata: Check return value of platform_get_resource Kishon Vijay Abraham I
@ 2015-03-13 12:01 ` Kishon Vijay Abraham I
  2015-03-13 12:01 ` [PATCH 11/20] phy: ti-pipe3: Simplify ti_pipe3_dpll_wait_lock implementation Kishon Vijay Abraham I
                   ` (10 subsequent siblings)
  20 siblings, 0 replies; 25+ messages in thread
From: Kishon Vijay Abraham I @ 2015-03-13 12:01 UTC (permalink / raw)
  To: gregkh; +Cc: kishon, linux-kernel

From: Axel Lin <axel.lin@ingics.com>

Current code uses num_phys settings to tell the number of entries in phys.
Thus remove the NULL terminating entry from phys array which is not necessary.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
---
 drivers/phy/phy-exynos4210-usb2.c |    1 -
 drivers/phy/phy-exynos4x12-usb2.c |    1 -
 drivers/phy/phy-exynos5250-usb2.c |    1 -
 3 files changed, 3 deletions(-)

diff --git a/drivers/phy/phy-exynos4210-usb2.c b/drivers/phy/phy-exynos4210-usb2.c
index 236a52a..f30bbb0 100644
--- a/drivers/phy/phy-exynos4210-usb2.c
+++ b/drivers/phy/phy-exynos4210-usb2.c
@@ -250,7 +250,6 @@ static const struct samsung_usb2_common_phy exynos4210_phys[] = {
 		.power_on	= exynos4210_power_on,
 		.power_off	= exynos4210_power_off,
 	},
-	{},
 };
 
 const struct samsung_usb2_phy_config exynos4210_usb2_phy_config = {
diff --git a/drivers/phy/phy-exynos4x12-usb2.c b/drivers/phy/phy-exynos4x12-usb2.c
index 0b9de88..765da90 100644
--- a/drivers/phy/phy-exynos4x12-usb2.c
+++ b/drivers/phy/phy-exynos4x12-usb2.c
@@ -361,7 +361,6 @@ static const struct samsung_usb2_common_phy exynos4x12_phys[] = {
 		.power_on	= exynos4x12_power_on,
 		.power_off	= exynos4x12_power_off,
 	},
-	{},
 };
 
 const struct samsung_usb2_phy_config exynos3250_usb2_phy_config = {
diff --git a/drivers/phy/phy-exynos5250-usb2.c b/drivers/phy/phy-exynos5250-usb2.c
index 1c139aa..2ed1735 100644
--- a/drivers/phy/phy-exynos5250-usb2.c
+++ b/drivers/phy/phy-exynos5250-usb2.c
@@ -391,7 +391,6 @@ static const struct samsung_usb2_common_phy exynos5250_phys[] = {
 		.power_on	= exynos5250_power_on,
 		.power_off	= exynos5250_power_off,
 	},
-	{},
 };
 
 const struct samsung_usb2_phy_config exynos5250_usb2_phy_config = {
-- 
1.7.9.5


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

* [PATCH 11/20] phy: ti-pipe3: Simplify ti_pipe3_dpll_wait_lock implementation
  2015-03-13 12:01 [GIT PULL 00/20] phy: for 4.0 -rc cycle Kishon Vijay Abraham I
                   ` (9 preceding siblings ...)
  2015-03-13 12:01 ` [PATCH 10/20] phy: samsung-usb2: Remove NULL terminating entry from phys array Kishon Vijay Abraham I
@ 2015-03-13 12:01 ` Kishon Vijay Abraham I
  2015-03-13 12:01 ` [PATCH 12/20] phy: rockchip-usb: Fixup rockchip_usb_phy_power_on failure path Kishon Vijay Abraham I
                   ` (9 subsequent siblings)
  20 siblings, 0 replies; 25+ messages in thread
From: Kishon Vijay Abraham I @ 2015-03-13 12:01 UTC (permalink / raw)
  To: gregkh; +Cc: kishon, linux-kernel

From: Axel Lin <axel.lin@ingics.com>

Code simplification. No functional change.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Roger Quadros <rogerq@ti.com>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
---
 drivers/phy/phy-ti-pipe3.c |   10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/drivers/phy/phy-ti-pipe3.c b/drivers/phy/phy-ti-pipe3.c
index 95c88f9..ed72b0d 100644
--- a/drivers/phy/phy-ti-pipe3.c
+++ b/drivers/phy/phy-ti-pipe3.c
@@ -165,15 +165,11 @@ static int ti_pipe3_dpll_wait_lock(struct ti_pipe3 *phy)
 		cpu_relax();
 		val = ti_pipe3_readl(phy->pll_ctrl_base, PLL_STATUS);
 		if (val & PLL_LOCK)
-			break;
+			return 0;
 	} while (!time_after(jiffies, timeout));
 
-	if (!(val & PLL_LOCK)) {
-		dev_err(phy->dev, "DPLL failed to lock\n");
-		return -EBUSY;
-	}
-
-	return 0;
+	dev_err(phy->dev, "DPLL failed to lock\n");
+	return -EBUSY;
 }
 
 static int ti_pipe3_dpll_program(struct ti_pipe3 *phy)
-- 
1.7.9.5


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

* [PATCH 12/20] phy: rockchip-usb: Fixup rockchip_usb_phy_power_on failure path
  2015-03-13 12:01 [GIT PULL 00/20] phy: for 4.0 -rc cycle Kishon Vijay Abraham I
                   ` (10 preceding siblings ...)
  2015-03-13 12:01 ` [PATCH 11/20] phy: ti-pipe3: Simplify ti_pipe3_dpll_wait_lock implementation Kishon Vijay Abraham I
@ 2015-03-13 12:01 ` Kishon Vijay Abraham I
  2015-03-13 12:01 ` [PATCH 13/20] phy: Find the right match in devm_phy_destroy() Kishon Vijay Abraham I
                   ` (8 subsequent siblings)
  20 siblings, 0 replies; 25+ messages in thread
From: Kishon Vijay Abraham I @ 2015-03-13 12:01 UTC (permalink / raw)
  To: gregkh; +Cc: kishon, linux-kernel

From: Axel Lin <axel.lin@ingics.com>

If rockchip_usb_phy_power() fails, we need to call clk_disable_unprepare()
before return. This is to ensure we have balanced clk_enable/disable calls.
Also remove unneeded ret checking in rockchip_usb_phy_power_off.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
---
 drivers/phy/phy-rockchip-usb.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/phy/phy-rockchip-usb.c b/drivers/phy/phy-rockchip-usb.c
index 22011c3..7d4c336 100644
--- a/drivers/phy/phy-rockchip-usb.c
+++ b/drivers/phy/phy-rockchip-usb.c
@@ -61,8 +61,6 @@ static int rockchip_usb_phy_power_off(struct phy *_phy)
 		return ret;
 
 	clk_disable_unprepare(phy->clk);
-	if (ret)
-		return ret;
 
 	return 0;
 }
@@ -78,8 +76,10 @@ static int rockchip_usb_phy_power_on(struct phy *_phy)
 
 	/* Power up usb phy analog blocks by set siddq 0 */
 	ret = rockchip_usb_phy_power(phy, 0);
-	if (ret)
+	if (ret) {
+		clk_disable_unprepare(phy->clk);
 		return ret;
+	}
 
 	return 0;
 }
-- 
1.7.9.5


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

* [PATCH 13/20] phy: Find the right match in devm_phy_destroy()
  2015-03-13 12:01 [GIT PULL 00/20] phy: for 4.0 -rc cycle Kishon Vijay Abraham I
                   ` (11 preceding siblings ...)
  2015-03-13 12:01 ` [PATCH 12/20] phy: rockchip-usb: Fixup rockchip_usb_phy_power_on failure path Kishon Vijay Abraham I
@ 2015-03-13 12:01 ` Kishon Vijay Abraham I
  2015-03-13 12:01 ` [PATCH 14/20] phy: exynos5-usbdrd: Fix off-by-one valid value checking for args->args[0] Kishon Vijay Abraham I
                   ` (7 subsequent siblings)
  20 siblings, 0 replies; 25+ messages in thread
From: Kishon Vijay Abraham I @ 2015-03-13 12:01 UTC (permalink / raw)
  To: gregkh; +Cc: kishon, linux-kernel

From: Thierry Reding <treding@nvidia.com>

devm_phy_create() stores the pointer to the new PHY at the address
returned by devres_alloc(). The res parameter passed to devm_phy_match()
is therefore the location where the pointer to the PHY is stored, hence
it needs to be dereferenced before comparing to the match data in order
to find the correct match.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Cc: <stable@vger.kernel.org> # v3.13+
---
 drivers/phy/phy-core.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/phy/phy-core.c b/drivers/phy/phy-core.c
index a12d353..04fc84f 100644
--- a/drivers/phy/phy-core.c
+++ b/drivers/phy/phy-core.c
@@ -52,7 +52,9 @@ static void devm_phy_consume(struct device *dev, void *res)
 
 static int devm_phy_match(struct device *dev, void *res, void *match_data)
 {
-	return res == match_data;
+	struct phy **phy = res;
+
+	return *phy == match_data;
 }
 
 /**
-- 
1.7.9.5


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

* [PATCH 14/20] phy: exynos5-usbdrd: Fix off-by-one valid value checking for args->args[0]
  2015-03-13 12:01 [GIT PULL 00/20] phy: for 4.0 -rc cycle Kishon Vijay Abraham I
                   ` (12 preceding siblings ...)
  2015-03-13 12:01 ` [PATCH 13/20] phy: Find the right match in devm_phy_destroy() Kishon Vijay Abraham I
@ 2015-03-13 12:01 ` Kishon Vijay Abraham I
  2015-03-13 12:01 ` [PATCH 15/20] phy: twl4030-usb: Remove redundant assignment for twl->linkstat Kishon Vijay Abraham I
                   ` (6 subsequent siblings)
  20 siblings, 0 replies; 25+ messages in thread
From: Kishon Vijay Abraham I @ 2015-03-13 12:01 UTC (permalink / raw)
  To: gregkh; +Cc: kishon, linux-kernel

From: Axel Lin <axel.lin@ingics.com>

Current code uses args->args[0] as array subscript of phy_drd->phys[].
So the valid value range for args->args[0] is 0 ... EXYNOS5_DRDPHYS_NUM - 1.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Reviewed by: Vivek Gautam <gautam.vivek@samsung.com>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
---
 drivers/phy/phy-exynos5-usbdrd.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/phy/phy-exynos5-usbdrd.c b/drivers/phy/phy-exynos5-usbdrd.c
index 0437401..e2a0be7 100644
--- a/drivers/phy/phy-exynos5-usbdrd.c
+++ b/drivers/phy/phy-exynos5-usbdrd.c
@@ -531,7 +531,7 @@ static struct phy *exynos5_usbdrd_phy_xlate(struct device *dev,
 {
 	struct exynos5_usbdrd_phy *phy_drd = dev_get_drvdata(dev);
 
-	if (WARN_ON(args->args[0] > EXYNOS5_DRDPHYS_NUM))
+	if (WARN_ON(args->args[0] >= EXYNOS5_DRDPHYS_NUM))
 		return ERR_PTR(-ENODEV);
 
 	return phy_drd->phys[args->args[0]].phy;
-- 
1.7.9.5


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

* [PATCH 15/20] phy: twl4030-usb: Remove redundant assignment for twl->linkstat
  2015-03-13 12:01 [GIT PULL 00/20] phy: for 4.0 -rc cycle Kishon Vijay Abraham I
                   ` (13 preceding siblings ...)
  2015-03-13 12:01 ` [PATCH 14/20] phy: exynos5-usbdrd: Fix off-by-one valid value checking for args->args[0] Kishon Vijay Abraham I
@ 2015-03-13 12:01 ` Kishon Vijay Abraham I
  2015-03-13 12:01 ` [PATCH 16/20] phy: miphy365x: Convert to devm_kcalloc and fix wrong sizeof Kishon Vijay Abraham I
                   ` (5 subsequent siblings)
  20 siblings, 0 replies; 25+ messages in thread
From: Kishon Vijay Abraham I @ 2015-03-13 12:01 UTC (permalink / raw)
  To: gregkh; +Cc: kishon, linux-kernel

From: Axel Lin <axel.lin@ingics.com>

It's pointless to set twl->linkstat twice.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
---
 drivers/phy/phy-twl4030-usb.c |    1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/phy/phy-twl4030-usb.c b/drivers/phy/phy-twl4030-usb.c
index 8e87f54..bc42d6a 100644
--- a/drivers/phy/phy-twl4030-usb.c
+++ b/drivers/phy/phy-twl4030-usb.c
@@ -666,7 +666,6 @@ static int twl4030_usb_probe(struct platform_device *pdev)
 	twl->dev		= &pdev->dev;
 	twl->irq		= platform_get_irq(pdev, 0);
 	twl->vbus_supplied	= false;
-	twl->linkstat		= -EINVAL;
 	twl->linkstat		= OMAP_MUSB_UNKNOWN;
 
 	twl->phy.dev		= twl->dev;
-- 
1.7.9.5


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

* [PATCH 16/20] phy: miphy365x: Convert to devm_kcalloc and fix wrong sizeof
  2015-03-13 12:01 [GIT PULL 00/20] phy: for 4.0 -rc cycle Kishon Vijay Abraham I
                   ` (14 preceding siblings ...)
  2015-03-13 12:01 ` [PATCH 15/20] phy: twl4030-usb: Remove redundant assignment for twl->linkstat Kishon Vijay Abraham I
@ 2015-03-13 12:01 ` Kishon Vijay Abraham I
  2015-03-13 12:01 ` [PATCH 17/20] phy: miphy28lp: Convert to devm_kcalloc and fix wrong sizof Kishon Vijay Abraham I
                   ` (4 subsequent siblings)
  20 siblings, 0 replies; 25+ messages in thread
From: Kishon Vijay Abraham I @ 2015-03-13 12:01 UTC (permalink / raw)
  To: gregkh; +Cc: kishon, linux-kernel

From: Axel Lin <axel.lin@ingics.com>

Prefer devm_kcalloc over devm_kzalloc with multiply.
In additional, use sizeof(phy) is incorrect, fix it.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
---
 drivers/phy/phy-miphy365x.c |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/phy/phy-miphy365x.c b/drivers/phy/phy-miphy365x.c
index 61177a6..51b459d 100644
--- a/drivers/phy/phy-miphy365x.c
+++ b/drivers/phy/phy-miphy365x.c
@@ -549,9 +549,8 @@ static int miphy365x_probe(struct platform_device *pdev)
 		return -ENOMEM;
 
 	miphy_dev->nphys = of_get_child_count(np);
-	miphy_dev->phys = devm_kzalloc(&pdev->dev,
-				       sizeof(phy) * miphy_dev->nphys,
-				       GFP_KERNEL);
+	miphy_dev->phys = devm_kcalloc(&pdev->dev, miphy_dev->nphys,
+				       sizeof(*miphy_dev->phys), GFP_KERNEL);
 	if (!miphy_dev->phys)
 		return -ENOMEM;
 
-- 
1.7.9.5


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

* [PATCH 17/20] phy: miphy28lp: Convert to devm_kcalloc and fix wrong sizof
  2015-03-13 12:01 [GIT PULL 00/20] phy: for 4.0 -rc cycle Kishon Vijay Abraham I
                   ` (15 preceding siblings ...)
  2015-03-13 12:01 ` [PATCH 16/20] phy: miphy365x: Convert to devm_kcalloc and fix wrong sizeof Kishon Vijay Abraham I
@ 2015-03-13 12:01 ` Kishon Vijay Abraham I
  2015-03-13 12:01 ` [PATCH 18/20] phy: core: Fixup return value of phy_exit when !pm_runtime_enabled Kishon Vijay Abraham I
                   ` (3 subsequent siblings)
  20 siblings, 0 replies; 25+ messages in thread
From: Kishon Vijay Abraham I @ 2015-03-13 12:01 UTC (permalink / raw)
  To: gregkh; +Cc: kishon, linux-kernel

From: Axel Lin <axel.lin@ingics.com>

Prefer devm_kcalloc over devm_kzalloc with multiply.
In additional, use sizeof(phy) is incorrect, fix it.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Gabriel Fernandez<gabriel.fernandez@linaro.org>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
---
 drivers/phy/phy-miphy28lp.c |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/phy/phy-miphy28lp.c b/drivers/phy/phy-miphy28lp.c
index 4fe1755..9334352 100644
--- a/drivers/phy/phy-miphy28lp.c
+++ b/drivers/phy/phy-miphy28lp.c
@@ -1209,9 +1209,8 @@ static int miphy28lp_probe(struct platform_device *pdev)
 		return -ENOMEM;
 
 	miphy_dev->nphys = of_get_child_count(np);
-	miphy_dev->phys = devm_kzalloc(&pdev->dev,
-				       sizeof(phy) * miphy_dev->nphys,
-				       GFP_KERNEL);
+	miphy_dev->phys = devm_kcalloc(&pdev->dev, miphy_dev->nphys,
+				       sizeof(*miphy_dev->phys), GFP_KERNEL);
 	if (!miphy_dev->phys)
 		return -ENOMEM;
 
-- 
1.7.9.5


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

* [PATCH 18/20] phy: core: Fixup return value of phy_exit when !pm_runtime_enabled
  2015-03-13 12:01 [GIT PULL 00/20] phy: for 4.0 -rc cycle Kishon Vijay Abraham I
                   ` (16 preceding siblings ...)
  2015-03-13 12:01 ` [PATCH 17/20] phy: miphy28lp: Convert to devm_kcalloc and fix wrong sizof Kishon Vijay Abraham I
@ 2015-03-13 12:01 ` Kishon Vijay Abraham I
  2015-03-13 12:01 ` [PATCH 19/20] phy: ti/omap: Fix modalias Kishon Vijay Abraham I
                   ` (2 subsequent siblings)
  20 siblings, 0 replies; 25+ messages in thread
From: Kishon Vijay Abraham I @ 2015-03-13 12:01 UTC (permalink / raw)
  To: gregkh; +Cc: kishon, linux-kernel

From: Axel Lin <axel.lin@ingics.com>

When phy_pm_runtime_get_sync() returns -ENOTSUPP, phy_exit() also returns
-ENOTSUPP if !phy->ops->exit. Fix it.
Also move the code to override ret close to the code we got ret.
I think it is less error prone this way.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Roger Quadros <rogerq@ti.com>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
---
 drivers/phy/phy-core.c |    7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/phy/phy-core.c b/drivers/phy/phy-core.c
index 04fc84f..3791838 100644
--- a/drivers/phy/phy-core.c
+++ b/drivers/phy/phy-core.c
@@ -225,6 +225,7 @@ int phy_init(struct phy *phy)
 	ret = phy_pm_runtime_get_sync(phy);
 	if (ret < 0 && ret != -ENOTSUPP)
 		return ret;
+	ret = 0; /* Override possible ret == -ENOTSUPP */
 
 	mutex_lock(&phy->mutex);
 	if (phy->init_count == 0 && phy->ops->init) {
@@ -233,8 +234,6 @@ int phy_init(struct phy *phy)
 			dev_err(&phy->dev, "phy init failed --> %d\n", ret);
 			goto out;
 		}
-	} else {
-		ret = 0; /* Override possible ret == -ENOTSUPP */
 	}
 	++phy->init_count;
 
@@ -255,6 +254,7 @@ int phy_exit(struct phy *phy)
 	ret = phy_pm_runtime_get_sync(phy);
 	if (ret < 0 && ret != -ENOTSUPP)
 		return ret;
+	ret = 0; /* Override possible ret == -ENOTSUPP */
 
 	mutex_lock(&phy->mutex);
 	if (phy->init_count == 1 && phy->ops->exit) {
@@ -289,6 +289,7 @@ int phy_power_on(struct phy *phy)
 	ret = phy_pm_runtime_get_sync(phy);
 	if (ret < 0 && ret != -ENOTSUPP)
 		return ret;
+	ret = 0; /* Override possible ret == -ENOTSUPP */
 
 	mutex_lock(&phy->mutex);
 	if (phy->power_count == 0 && phy->ops->power_on) {
@@ -297,8 +298,6 @@ int phy_power_on(struct phy *phy)
 			dev_err(&phy->dev, "phy poweron failed --> %d\n", ret);
 			goto out;
 		}
-	} else {
-		ret = 0; /* Override possible ret == -ENOTSUPP */
 	}
 	++phy->power_count;
 	mutex_unlock(&phy->mutex);
-- 
1.7.9.5


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

* [PATCH 19/20] phy: ti/omap: Fix modalias
  2015-03-13 12:01 [GIT PULL 00/20] phy: for 4.0 -rc cycle Kishon Vijay Abraham I
                   ` (17 preceding siblings ...)
  2015-03-13 12:01 ` [PATCH 18/20] phy: core: Fixup return value of phy_exit when !pm_runtime_enabled Kishon Vijay Abraham I
@ 2015-03-13 12:01 ` Kishon Vijay Abraham I
  2015-03-13 12:01 ` [PATCH 20/20] phy: omap-usb2: Fix missing clk_prepare call when using old dt name Kishon Vijay Abraham I
  2015-03-14  8:50 ` [GIT PULL 00/20] phy: for 4.0 -rc cycle Greg KH
  20 siblings, 0 replies; 25+ messages in thread
From: Kishon Vijay Abraham I @ 2015-03-13 12:01 UTC (permalink / raw)
  To: gregkh; +Cc: kishon, linux-kernel

From: Axel Lin <axel.lin@ingics.com>

Remove extra space in MODULE_ALIAS.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Roger Quadros <rogerq@ti.com>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
---
 drivers/phy/phy-omap-control.c |    2 +-
 drivers/phy/phy-omap-usb2.c    |    2 +-
 drivers/phy/phy-ti-pipe3.c     |    2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/phy/phy-omap-control.c b/drivers/phy/phy-omap-control.c
index efe724f..93252e0 100644
--- a/drivers/phy/phy-omap-control.c
+++ b/drivers/phy/phy-omap-control.c
@@ -360,7 +360,7 @@ static void __exit omap_control_phy_exit(void)
 }
 module_exit(omap_control_phy_exit);
 
-MODULE_ALIAS("platform: omap_control_phy");
+MODULE_ALIAS("platform:omap_control_phy");
 MODULE_AUTHOR("Texas Instruments Inc.");
 MODULE_DESCRIPTION("OMAP Control Module PHY Driver");
 MODULE_LICENSE("GPL v2");
diff --git a/drivers/phy/phy-omap-usb2.c b/drivers/phy/phy-omap-usb2.c
index 6f4aef3..c4917b2 100644
--- a/drivers/phy/phy-omap-usb2.c
+++ b/drivers/phy/phy-omap-usb2.c
@@ -383,7 +383,7 @@ static struct platform_driver omap_usb2_driver = {
 
 module_platform_driver(omap_usb2_driver);
 
-MODULE_ALIAS("platform: omap_usb2");
+MODULE_ALIAS("platform:omap_usb2");
 MODULE_AUTHOR("Texas Instruments Inc.");
 MODULE_DESCRIPTION("OMAP USB2 phy driver");
 MODULE_LICENSE("GPL v2");
diff --git a/drivers/phy/phy-ti-pipe3.c b/drivers/phy/phy-ti-pipe3.c
index ed72b0d..2ba610b 100644
--- a/drivers/phy/phy-ti-pipe3.c
+++ b/drivers/phy/phy-ti-pipe3.c
@@ -604,7 +604,7 @@ static struct platform_driver ti_pipe3_driver = {
 
 module_platform_driver(ti_pipe3_driver);
 
-MODULE_ALIAS("platform: ti_pipe3");
+MODULE_ALIAS("platform:ti_pipe3");
 MODULE_AUTHOR("Texas Instruments Inc.");
 MODULE_DESCRIPTION("TI PIPE3 phy driver");
 MODULE_LICENSE("GPL v2");
-- 
1.7.9.5


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

* [PATCH 20/20] phy: omap-usb2: Fix missing clk_prepare call when using old dt name
  2015-03-13 12:01 [GIT PULL 00/20] phy: for 4.0 -rc cycle Kishon Vijay Abraham I
                   ` (18 preceding siblings ...)
  2015-03-13 12:01 ` [PATCH 19/20] phy: ti/omap: Fix modalias Kishon Vijay Abraham I
@ 2015-03-13 12:01 ` Kishon Vijay Abraham I
  2015-03-14  8:50 ` [GIT PULL 00/20] phy: for 4.0 -rc cycle Greg KH
  20 siblings, 0 replies; 25+ messages in thread
From: Kishon Vijay Abraham I @ 2015-03-13 12:01 UTC (permalink / raw)
  To: gregkh; +Cc: kishon, linux-kernel

From: Axel Lin <axel.lin@ingics.com>

Current code does not call clk_prepare(phy->optclk) when using the old
usb_otg_ss_refclk960m name. Fix it.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
---
 drivers/phy/phy-omap-usb2.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/phy/phy-omap-usb2.c b/drivers/phy/phy-omap-usb2.c
index c4917b2..4757e76 100644
--- a/drivers/phy/phy-omap-usb2.c
+++ b/drivers/phy/phy-omap-usb2.c
@@ -296,10 +296,11 @@ static int omap_usb2_probe(struct platform_device *pdev)
 			dev_warn(&pdev->dev,
 				 "found usb_otg_ss_refclk960m, please fix DTS\n");
 		}
-	} else {
-		clk_prepare(phy->optclk);
 	}
 
+	if (!IS_ERR(phy->optclk))
+		clk_prepare(phy->optclk);
+
 	usb_add_phy_dev(&phy->phy);
 
 	return 0;
-- 
1.7.9.5


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

* Re: [GIT PULL 00/20] phy: for 4.0 -rc cycle
  2015-03-13 12:01 [GIT PULL 00/20] phy: for 4.0 -rc cycle Kishon Vijay Abraham I
                   ` (19 preceding siblings ...)
  2015-03-13 12:01 ` [PATCH 20/20] phy: omap-usb2: Fix missing clk_prepare call when using old dt name Kishon Vijay Abraham I
@ 2015-03-14  8:50 ` Greg KH
  2015-03-14 11:23   ` Kishon Vijay Abraham I
  2015-03-14 11:31   ` [RESEND GIT PULL] " Kishon Vijay Abraham I
  20 siblings, 2 replies; 25+ messages in thread
From: Greg KH @ 2015-03-14  8:50 UTC (permalink / raw)
  To: Kishon Vijay Abraham I; +Cc: linux-kernel

On Fri, Mar 13, 2015 at 05:31:37PM +0530, Kishon Vijay Abraham I wrote:
> Hi Greg,
> 
> Please find the pull request for 4.0 -rc cycle. We should thank Axel Lin for
> reviewing all the PHY drivers and sending fixes. This also includes a fix
> from Thierry Reding in phy core.
> 
> Let me know if I have to change something.
> 
> Thanks
> Kishon
> 
> The following changes since commit c517d838eb7d07bbe9507871fab3931deccff539:
> 
>   Linux 4.0-rc1 (2015-02-22 18:21:14 -0800)
> 
> are available in the git repository at:
> 
>   git://git.kernel.org/pub/scm/linux/kernel/git/kishon/linux-phy.git tags/for-4.0-rc
> 
> for you to fetch changes up to b1ff3231b2d4197ef5024f9c57ffc6cfa562590c:
> 
>   phy: omap-usb2: Fix missing clk_prepare call when using old dt name (2015-03-13 17:14:39 +0530)
> 
> ----------------------------------------------------------------
> contains fixes all over drivers/phy
> 

That's a horrible pull request summary.  Please at least give me
something "real" to go on here.  As it is, would you accept such a
changelog entry?

I'll just take the individual patches, to keep this out of the commit
log...

thanks,

greg k-h

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

* Re: [GIT PULL 00/20] phy: for 4.0 -rc cycle
  2015-03-14  8:50 ` [GIT PULL 00/20] phy: for 4.0 -rc cycle Greg KH
@ 2015-03-14 11:23   ` Kishon Vijay Abraham I
  2015-03-14 11:31   ` [RESEND GIT PULL] " Kishon Vijay Abraham I
  1 sibling, 0 replies; 25+ messages in thread
From: Kishon Vijay Abraham I @ 2015-03-14 11:23 UTC (permalink / raw)
  To: Greg KH; +Cc: linux-kernel

Hi Greg,

On Saturday 14 March 2015 02:20 PM, Greg KH wrote:
> On Fri, Mar 13, 2015 at 05:31:37PM +0530, Kishon Vijay Abraham I wrote:
>> Hi Greg,
>>
>> Please find the pull request for 4.0 -rc cycle. We should thank Axel Lin for
>> reviewing all the PHY drivers and sending fixes. This also includes a fix
>> from Thierry Reding in phy core.
>>
>> Let me know if I have to change something.
>>
>> Thanks
>> Kishon
>>
>> The following changes since commit c517d838eb7d07bbe9507871fab3931deccff539:
>>
>>    Linux 4.0-rc1 (2015-02-22 18:21:14 -0800)
>>
>> are available in the git repository at:
>>
>>    git://git.kernel.org/pub/scm/linux/kernel/git/kishon/linux-phy.git tags/for-4.0-rc
>>
>> for you to fetch changes up to b1ff3231b2d4197ef5024f9c57ffc6cfa562590c:
>>
>>    phy: omap-usb2: Fix missing clk_prepare call when using old dt name (2015-03-13 17:14:39 +0530)
>>
>> ----------------------------------------------------------------
>> contains fixes all over drivers/phy
>>
>
> That's a horrible pull request summary.  Please at least give me
> something "real" to go on here.  As it is, would you accept such a
> changelog entry?
>
> I'll just take the individual patches, to keep this out of the commit
> log...

sorry, I'll send an updated pull request if that is okay.

Thanks
Kishon

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

* [RESEND GIT PULL] phy: for 4.0 -rc cycle
  2015-03-14  8:50 ` [GIT PULL 00/20] phy: for 4.0 -rc cycle Greg KH
  2015-03-14 11:23   ` Kishon Vijay Abraham I
@ 2015-03-14 11:31   ` Kishon Vijay Abraham I
  2015-03-18 16:28     ` Greg KH
  1 sibling, 1 reply; 25+ messages in thread
From: Kishon Vijay Abraham I @ 2015-03-14 11:31 UTC (permalink / raw)
  To: Greg KH; +Cc: linux-kernel

Hi Greg,

Please find the updated pull request for 4.0 -rc. This mostly consists of fixes
done by Axel Lin all over the PHY drivers. It also includes a couple of fixes
in phy core.

Let me know if I have to change something.

Thanks
Kishon

The following changes since commit c517d838eb7d07bbe9507871fab3931deccff539:

   Linux 4.0-rc1 (2015-02-22 18:21:14 -0800)

are available in the git repository at:

   git://git.kernel.org/pub/scm/linux/kernel/git/kishon/linux-phy.git 
tags/for-4.0-rc

for you to fetch changes up to b1ff3231b2d4197ef5024f9c57ffc6cfa562590c:

   phy: omap-usb2: Fix missing clk_prepare call when using old dt name 
(2015-03-13 17:14:39 +0530)

----------------------------------------------------------------
contains fixes all over drivers/phy and includes the following
*) Using phy_get_drvdata instead of dev_get_drvdata in armada375-usb2.c
*) Fixes w.r.t checking return values in regmap APIs, protecting regmap ops
    with spin lock and directly using regmap_update_bits instead of having a
    separate function to do the same in the various PHYs used in exynos.
*) check return value in platform_get_resource of hix5hd2-sata PHY
*) Removed NULL terminating entry from phys array and fix off-by-one
    valid value checking for args->args[0] in of_xlate of exynos USB PHY.
*) Fixup rockchip_usb_phy_power_on failure path
*) Fix devm_phy_match to find the correct match in phy core and also fix to
    return the correct value from PHY APIs if PM runtime is not enabled.
*) Removed redundant code in twl4030 and xgene
*) Fixed sizeof during memory allocation in miphy PHYs
*) simplify ti_pipe3_dpll_wait_lock implementation, fix missing clk_prepare
    when using old dt name and nit pick in MOUDLE_ALIAS in TI PHYs.

----------------------------------------------------------------
Axel Lin (19):
       phy: miphy28lp: Avoid calling of_get_child_count() multiple times
       phy: miphy365x: Avoid calling of_get_child_count() multiple times
       phy: armada375-usb2: Set drvdata for phy and use it
       phy: xgene: Remove duplicate code to set ctx->dev
       phy: miphy28lp: Add missing .owner field in miphy28lp_ops
       phy: exynos-mipi-video: Fixup the test for state->regmap
       phy: exynos-mipi-video: Use spin_lock to protct state->regmap rmw operations
       phy: exynos-dp-video: Kill exynos_dp_video_phy_pwr_isol function
       phy: hix5hd2-sata: Check return value of platform_get_resource
       phy: samsung-usb2: Remove NULL terminating entry from phys array
       phy: ti-pipe3: Simplify ti_pipe3_dpll_wait_lock implementation
       phy: rockchip-usb: Fixup rockchip_usb_phy_power_on failure path
       phy: exynos5-usbdrd: Fix off-by-one valid value checking for args->args[0]
       phy: twl4030-usb: Remove redundant assignment for twl->linkstat
       phy: miphy365x: Convert to devm_kcalloc and fix wrong sizeof
       phy: miphy28lp: Convert to devm_kcalloc and fix wrong sizof
       phy: core: Fixup return value of phy_exit when !pm_runtime_enabled
       phy: ti/omap: Fix modalias
       phy: omap-usb2: Fix missing clk_prepare call when using old dt name

Thierry Reding (1):
       phy: Find the right match in devm_phy_destroy()

  drivers/phy/phy-armada375-usb2.c    |    3 ++-
  drivers/phy/phy-core.c              |   11 ++++++-----
  drivers/phy/phy-exynos-dp-video.c   |   24 ++++--------------------
  drivers/phy/phy-exynos-mipi-video.c |   11 ++++-------
  drivers/phy/phy-exynos4210-usb2.c   |    1 -
  drivers/phy/phy-exynos4x12-usb2.c   |    1 -
  drivers/phy/phy-exynos5-usbdrd.c    |    2 +-
  drivers/phy/phy-exynos5250-usb2.c   |    1 -
  drivers/phy/phy-hix5hd2-sata.c      |    3 +++
  drivers/phy/phy-miphy28lp.c         |   13 +++++++------
  drivers/phy/phy-miphy365x.c         |   12 ++++++------
  drivers/phy/phy-omap-control.c      |    2 +-
  drivers/phy/phy-omap-usb2.c         |    7 ++++---
  drivers/phy/phy-rockchip-usb.c      |    6 +++---
  drivers/phy/phy-ti-pipe3.c          |   12 ++++--------
  drivers/phy/phy-twl4030-usb.c       |    1 -
  drivers/phy/phy-xgene.c             |    1 -
  17 files changed, 45 insertions(+), 66 deletions(-)

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

* Re: [RESEND GIT PULL] phy: for 4.0 -rc cycle
  2015-03-14 11:31   ` [RESEND GIT PULL] " Kishon Vijay Abraham I
@ 2015-03-18 16:28     ` Greg KH
  0 siblings, 0 replies; 25+ messages in thread
From: Greg KH @ 2015-03-18 16:28 UTC (permalink / raw)
  To: Kishon Vijay Abraham I; +Cc: linux-kernel

On Sat, Mar 14, 2015 at 05:01:08PM +0530, Kishon Vijay Abraham I wrote:
> Hi Greg,
> 
> Please find the updated pull request for 4.0 -rc. This mostly consists of fixes
> done by Axel Lin all over the PHY drivers. It also includes a couple of fixes
> in phy core.
> 
> Let me know if I have to change something.
> 
> Thanks
> Kishon
> 
> The following changes since commit c517d838eb7d07bbe9507871fab3931deccff539:
> 
>   Linux 4.0-rc1 (2015-02-22 18:21:14 -0800)
> 
> are available in the git repository at:
> 
>   git://git.kernel.org/pub/scm/linux/kernel/git/kishon/linux-phy.git
> tags/for-4.0-rc

All pulled and pushed out, thanks.

greg k-h

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

end of thread, other threads:[~2015-03-18 16:28 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-13 12:01 [GIT PULL 00/20] phy: for 4.0 -rc cycle Kishon Vijay Abraham I
2015-03-13 12:01 ` [PATCH 01/20] phy: miphy28lp: Avoid calling of_get_child_count() multiple times Kishon Vijay Abraham I
2015-03-13 12:01 ` [PATCH 02/20] phy: miphy365x: " Kishon Vijay Abraham I
2015-03-13 12:01 ` [PATCH 03/20] phy: armada375-usb2: Set drvdata for phy and use it Kishon Vijay Abraham I
2015-03-13 12:01 ` [PATCH 04/20] phy: xgene: Remove duplicate code to set ctx->dev Kishon Vijay Abraham I
2015-03-13 12:01 ` [PATCH 05/20] phy: miphy28lp: Add missing .owner field in miphy28lp_ops Kishon Vijay Abraham I
2015-03-13 12:01 ` [PATCH 06/20] phy: exynos-mipi-video: Fixup the test for state->regmap Kishon Vijay Abraham I
2015-03-13 12:01 ` [PATCH 07/20] phy: exynos-mipi-video: Use spin_lock to protct state->regmap rmw operations Kishon Vijay Abraham I
2015-03-13 12:01 ` [PATCH 08/20] phy: exynos-dp-video: Kill exynos_dp_video_phy_pwr_isol function Kishon Vijay Abraham I
2015-03-13 12:01 ` [PATCH 09/20] phy: hix5hd2-sata: Check return value of platform_get_resource Kishon Vijay Abraham I
2015-03-13 12:01 ` [PATCH 10/20] phy: samsung-usb2: Remove NULL terminating entry from phys array Kishon Vijay Abraham I
2015-03-13 12:01 ` [PATCH 11/20] phy: ti-pipe3: Simplify ti_pipe3_dpll_wait_lock implementation Kishon Vijay Abraham I
2015-03-13 12:01 ` [PATCH 12/20] phy: rockchip-usb: Fixup rockchip_usb_phy_power_on failure path Kishon Vijay Abraham I
2015-03-13 12:01 ` [PATCH 13/20] phy: Find the right match in devm_phy_destroy() Kishon Vijay Abraham I
2015-03-13 12:01 ` [PATCH 14/20] phy: exynos5-usbdrd: Fix off-by-one valid value checking for args->args[0] Kishon Vijay Abraham I
2015-03-13 12:01 ` [PATCH 15/20] phy: twl4030-usb: Remove redundant assignment for twl->linkstat Kishon Vijay Abraham I
2015-03-13 12:01 ` [PATCH 16/20] phy: miphy365x: Convert to devm_kcalloc and fix wrong sizeof Kishon Vijay Abraham I
2015-03-13 12:01 ` [PATCH 17/20] phy: miphy28lp: Convert to devm_kcalloc and fix wrong sizof Kishon Vijay Abraham I
2015-03-13 12:01 ` [PATCH 18/20] phy: core: Fixup return value of phy_exit when !pm_runtime_enabled Kishon Vijay Abraham I
2015-03-13 12:01 ` [PATCH 19/20] phy: ti/omap: Fix modalias Kishon Vijay Abraham I
2015-03-13 12:01 ` [PATCH 20/20] phy: omap-usb2: Fix missing clk_prepare call when using old dt name Kishon Vijay Abraham I
2015-03-14  8:50 ` [GIT PULL 00/20] phy: for 4.0 -rc cycle Greg KH
2015-03-14 11:23   ` Kishon Vijay Abraham I
2015-03-14 11:31   ` [RESEND GIT PULL] " Kishon Vijay Abraham I
2015-03-18 16:28     ` Greg KH

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