Skip to contentSkip to conversation

phy: fixes for 3.16 -rc cycle

GIT PULL New Kishon Vijay Abraham I 1 participant 6 messages Jul 10, 2014 Generic PHY framework

lore
Share & tools
lore
#0 lore raw

Hi Greg,

Please find the updated pull requeust for 3.16 -rc cycle for PHY subsystem.

It now contains only minor fixes in phy-core and few other PHY drivers.

Let me know if I have to change something.

Cheers
Kishon

The following changes since commit a497c3ba1d97fc69c1e78e7b96435ba8c2cb42ee:

Linux 3.16-rc2 (2014-06-21 19:02:54 -1000)

are available in the git repository at:

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

for you to fetch changes up to 667a11b5a3671f4eb966ad8104cca8dbe9d3a21c:

phy: omap-usb2: Balance pm_runtime_enable() on probe failure and remove (2014-07-10 11:46:50 +0530)

----------------------------------------------------------------
for 3.16-rc

Contains fixes in phy-core and other minor fixes in some of the other PHY drivers.

----------------------------------------------------------------
Himangi Saraogi (1):
phy: omap-usb2: fix devm_ioremap_resource error detection code

Maxime Ripard (1):
phy: sun4i: depend on RESET_CONTROLLER

Roger Quadros (2):
phy: core: Fix error path in phy_create()
phy: omap-usb2: Balance pm_runtime_enable() on probe failure and remove

Sjoerd Simons (1):
drivers: phy: phy-samsung-usb2.c: Add missing MODULE_DEVICE_TABLE

 drivers/phy/Kconfig            |    1 +
 drivers/phy/phy-core.c         |    7 ++++---
 drivers/phy/phy-omap-usb2.c    |   11 +++++++----
 drivers/phy/phy-samsung-usb2.c |    1 +
 4 files changed, 13 insertions(+), 7 deletions(-)
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH 1/5 phy: sun4i: depend on RESET_CONTROLLER

From: Maxime Ripard <[email protected]>

The driver depend on the reset framework in a mandatory way. Make sure reset_control_get is defined by adding this dependency in Kconfig

---
 drivers/phy/Kconfig |    1 +
 1 file changed, 1 insertion(+)
drivers/phy/Kconfig +1 -0
index 16a2f06..1d8099a 100644
@@ -112,6 +112,7 @@ config PHY_EXYNOS5250_SATA
 config PHY_SUN4I_USB
 	tristate "Allwinner sunxi SoC USB PHY driver"
 	depends on ARCH_SUNXI && HAS_IOMEM && OF
+	depends on RESET_CONTROLLER
 	select GENERIC_PHY
 	help
 	  Enable this to support the transceiver that is part of Allwinner
Signature · 1 line
1.7.9.5
#2 lore raw

PATCH 2/5 phy: omap-usb2: fix devm_ioremap_resource error detection code

In reply to Kishon Vijay Abraham I

From: Himangi Saraogi <[email protected]>

devm_ioremap_resource returns an ERR_PTR value, not NULL, on failure.

A simplified version of the semantic match that finds this problem is as follows:

// <smpl>
@@
expression e,e1;
statement S;
@@

*e = devm_ioremap_resource(...);
if (!e1) S

// </smpl>

---
 drivers/phy/phy-omap-usb2.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/phy/phy-omap-usb2.c +2 -2
index 7007c11..2063d54 100644
@@ -233,8 +233,8 @@ static int omap_usb2_probe(struct platform_device *pdev)
 	if (phy_data->flags & OMAP_USB2_CALIBRATE_FALSE_DISCONNECT) {
 		res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 		phy->phy_base = devm_ioremap_resource(&pdev->dev, res);
-		if (!phy->phy_base)
-			return -ENOMEM;
+		if (IS_ERR(phy->phy_base))
+			return PTR_ERR(phy->phy_base);
 		phy->flags |= OMAP_USB2_CALIBRATE_FALSE_DISCONNECT;
 	}
 
Signature · 1 line
1.7.9.5
#3 lore raw

PATCH 3/5 drivers: phy: phy-samsung-usb2.c: Add missing MODULE_DEVICE_TABLE

In reply to Kishon Vijay Abraham I

From: Sjoerd Simons <[email protected]>

Allow phy-exynos-usb2 to be autoloaded based on devicetree information. Tested on Odroid X2 with its USB subsystem build as modules.

---
 drivers/phy/phy-samsung-usb2.c |    1 +
 1 file changed, 1 insertion(+)
drivers/phy/phy-samsung-usb2.c +1 -0
index 8a8c6bc..1e69a32 100644
@@ -107,6 +107,7 @@ static const struct of_device_id samsung_usb2_phy_of_match[] = {
 #endif
 	{ },
 };
+MODULE_DEVICE_TABLE(of, samsung_usb2_phy_of_match);
 
 static int samsung_usb2_phy_probe(struct platform_device *pdev)
 {
Signature · 1 line
1.7.9.5
#4 lore raw

PATCH 4/5 phy: core: Fix error path in phy_create()

In reply to Kishon Vijay Abraham I

From: Roger Quadros <[email protected]>

Prevent resources from being freed twice in case device_add() call fails within phy_create(). Also use ida_simple_remove() instead of ida_remove() as we had used ida_simple_get() to allocate the ida.

---
 drivers/phy/phy-core.c |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/phy/phy-core.c +4 -3
index c64a2f3..49c4465 100644
@@ -614,8 +614,9 @@ struct phy *phy_create(struct device *dev, const struct phy_ops *ops,
 	return phy;
 
 put_dev:
-	put_device(&phy->dev);
-	ida_remove(&phy_ida, phy->id);
+	put_device(&phy->dev);  /* calls phy_release() which frees resources */
+	return ERR_PTR(ret);
+
 free_phy:
 	kfree(phy);
 	return ERR_PTR(ret);
@@ -799,7 +800,7 @@ static void phy_release(struct device *dev)
 
 	phy = to_phy(dev);
 	dev_vdbg(dev, "releasing '%s'\n", dev_name(dev));
-	ida_remove(&phy_ida, phy->id);
+	ida_simple_remove(&phy_ida, phy->id);
 	kfree(phy);
 }
 
Signature · 1 line
1.7.9.5
#5 lore raw

PATCH 5/5 phy: omap-usb2: Balance pm_runtime_enable() on probe failure and remove

In reply to Kishon Vijay Abraham I

From: Roger Quadros <[email protected]>

If probe fails then we need to call pm_runtime_disable() to balance out the previous pm_runtime_enable() call. Else it will cause unbalanced pm_runtime_enable() call in the succeding probe call.

This anomaly was observed when the call to devm_phy_create() failed with -EPROBE_DEFER.

Balance out the pm_runtime_enable() call in .remove() as well.

---
 drivers/phy/phy-omap-usb2.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/phy/phy-omap-usb2.c +5 -2
index 2063d54..34b3961 100644
@@ -262,7 +262,6 @@ static int omap_usb2_probe(struct platform_device *pdev)
 	otg->phy		= &phy->phy;
 
 	platform_set_drvdata(pdev, phy);
-	pm_runtime_enable(phy->dev);
 
 	generic_phy = devm_phy_create(phy->dev, &ops, NULL);
 	if (IS_ERR(generic_phy))
@@ -270,10 +269,13 @@ static int omap_usb2_probe(struct platform_device *pdev)
 
 	phy_set_drvdata(generic_phy, phy);
 
+	pm_runtime_enable(phy->dev);
 	phy_provider = devm_of_phy_provider_register(phy->dev,
 			of_phy_simple_xlate);
-	if (IS_ERR(phy_provider))
+	if (IS_ERR(phy_provider)) {
+		pm_runtime_disable(phy->dev);
 		return PTR_ERR(phy_provider);
+	}
 
 	phy->wkupclk = devm_clk_get(phy->dev, "wkupclk");
 	if (IS_ERR(phy->wkupclk)) {
@@ -317,6 +319,7 @@ static int omap_usb2_remove(struct platform_device *pdev)
 	if (!IS_ERR(phy->optclk))
 		clk_unprepare(phy->optclk);
 	usb_remove_phy(&phy->phy);
+	pm_runtime_disable(phy->dev);
 
 	return 0;
 }
Signature · 1 line
1.7.9.5