* [PATCH 1/5] phy: sun4i: depend on RESET_CONTROLLER
2014-07-10 6:24 [GIT PULL v2 0/5] phy: fixes for 3.16 -rc cycle Kishon Vijay Abraham I
@ 2014-07-10 6:24 ` Kishon Vijay Abraham I
2014-07-10 6:25 ` [PATCH 2/5] phy: omap-usb2: fix devm_ioremap_resource error detection code Kishon Vijay Abraham I
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Kishon Vijay Abraham I @ 2014-07-10 6:24 UTC (permalink / raw)
To: gregkh; +Cc: kishon, linux-kernel
From: Maxime Ripard <maxime.ripard@free-electrons.com>
The driver depend on the reset framework in a mandatory way. Make sure
reset_control_get is defined by adding this dependency in Kconfig
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Reported-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
---
drivers/phy/Kconfig | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig
index 16a2f06..1d8099a 100644
--- a/drivers/phy/Kconfig
+++ b/drivers/phy/Kconfig
@@ -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
--
1.7.9.5
^ permalink raw reply [flat|nested] 6+ messages in thread* [PATCH 2/5] phy: omap-usb2: fix devm_ioremap_resource error detection code
2014-07-10 6:24 [GIT PULL v2 0/5] phy: fixes for 3.16 -rc cycle Kishon Vijay Abraham I
2014-07-10 6:24 ` [PATCH 1/5] phy: sun4i: depend on RESET_CONTROLLER Kishon Vijay Abraham I
@ 2014-07-10 6:25 ` Kishon Vijay Abraham I
2014-07-10 6:25 ` [PATCH 3/5] drivers: phy: phy-samsung-usb2.c: Add missing MODULE_DEVICE_TABLE Kishon Vijay Abraham I
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Kishon Vijay Abraham I @ 2014-07-10 6:25 UTC (permalink / raw)
To: gregkh; +Cc: kishon, linux-kernel
From: Himangi Saraogi <himangi774@gmail.com>
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>
Signed-off-by: Himangi Saraogi <himangi774@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
---
drivers/phy/phy-omap-usb2.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/phy/phy-omap-usb2.c b/drivers/phy/phy-omap-usb2.c
index 7007c11..2063d54 100644
--- a/drivers/phy/phy-omap-usb2.c
+++ b/drivers/phy/phy-omap-usb2.c
@@ -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;
}
--
1.7.9.5
^ permalink raw reply [flat|nested] 6+ messages in thread* [PATCH 3/5] drivers: phy: phy-samsung-usb2.c: Add missing MODULE_DEVICE_TABLE
2014-07-10 6:24 [GIT PULL v2 0/5] phy: fixes for 3.16 -rc cycle Kishon Vijay Abraham I
2014-07-10 6:24 ` [PATCH 1/5] phy: sun4i: depend on RESET_CONTROLLER Kishon Vijay Abraham I
2014-07-10 6:25 ` [PATCH 2/5] phy: omap-usb2: fix devm_ioremap_resource error detection code Kishon Vijay Abraham I
@ 2014-07-10 6:25 ` Kishon Vijay Abraham I
2014-07-10 6:25 ` [PATCH 4/5] phy: core: Fix error path in phy_create() Kishon Vijay Abraham I
2014-07-10 6:25 ` [PATCH 5/5] phy: omap-usb2: Balance pm_runtime_enable() on probe failure and remove Kishon Vijay Abraham I
4 siblings, 0 replies; 6+ messages in thread
From: Kishon Vijay Abraham I @ 2014-07-10 6:25 UTC (permalink / raw)
To: gregkh; +Cc: kishon, linux-kernel
From: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
Allow phy-exynos-usb2 to be autoloaded based on devicetree information.
Tested on Odroid X2 with its USB subsystem build as modules.
Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
---
drivers/phy/phy-samsung-usb2.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/phy/phy-samsung-usb2.c b/drivers/phy/phy-samsung-usb2.c
index 8a8c6bc..1e69a32 100644
--- a/drivers/phy/phy-samsung-usb2.c
+++ b/drivers/phy/phy-samsung-usb2.c
@@ -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)
{
--
1.7.9.5
^ permalink raw reply [flat|nested] 6+ messages in thread* [PATCH 4/5] phy: core: Fix error path in phy_create()
2014-07-10 6:24 [GIT PULL v2 0/5] phy: fixes for 3.16 -rc cycle Kishon Vijay Abraham I
` (2 preceding siblings ...)
2014-07-10 6:25 ` [PATCH 3/5] drivers: phy: phy-samsung-usb2.c: Add missing MODULE_DEVICE_TABLE Kishon Vijay Abraham I
@ 2014-07-10 6:25 ` Kishon Vijay Abraham I
2014-07-10 6:25 ` [PATCH 5/5] phy: omap-usb2: Balance pm_runtime_enable() on probe failure and remove Kishon Vijay Abraham I
4 siblings, 0 replies; 6+ messages in thread
From: Kishon Vijay Abraham I @ 2014-07-10 6:25 UTC (permalink / raw)
To: gregkh; +Cc: kishon, linux-kernel
From: Roger Quadros <rogerq@ti.com>
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.
Cc: 3.13+ <stable@vger.kernel.org> # 3.13+
Signed-off-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, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/phy/phy-core.c b/drivers/phy/phy-core.c
index c64a2f3..49c4465 100644
--- a/drivers/phy/phy-core.c
+++ b/drivers/phy/phy-core.c
@@ -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);
}
--
1.7.9.5
^ permalink raw reply [flat|nested] 6+ messages in thread* [PATCH 5/5] phy: omap-usb2: Balance pm_runtime_enable() on probe failure and remove
2014-07-10 6:24 [GIT PULL v2 0/5] phy: fixes for 3.16 -rc cycle Kishon Vijay Abraham I
` (3 preceding siblings ...)
2014-07-10 6:25 ` [PATCH 4/5] phy: core: Fix error path in phy_create() Kishon Vijay Abraham I
@ 2014-07-10 6:25 ` Kishon Vijay Abraham I
4 siblings, 0 replies; 6+ messages in thread
From: Kishon Vijay Abraham I @ 2014-07-10 6:25 UTC (permalink / raw)
To: gregkh; +Cc: kishon, linux-kernel
From: Roger Quadros <rogerq@ti.com>
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.
Signed-off-by: Roger Quadros <rogerq@ti.com>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
---
drivers/phy/phy-omap-usb2.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/phy/phy-omap-usb2.c b/drivers/phy/phy-omap-usb2.c
index 2063d54..34b3961 100644
--- a/drivers/phy/phy-omap-usb2.c
+++ b/drivers/phy/phy-omap-usb2.c
@@ -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;
}
--
1.7.9.5
^ permalink raw reply [flat|nested] 6+ messages in thread