PHY subsystem fixes for 3.14-rc4
Subsystems (3)
Hi Greg,
Here's the PULL requeust for PHY subsystem for this -rc cycle. There isn't anything major but a bunch of obvious fixes and cleanup.
Let me know If I have to change anything.
Thanks
Kishon
The following changes since commit 6d0abeca3242a88cab8232e4acd7e2bf088f3bc2:
Linux 3.14-rc3 (2014-02-16 13:30:25 -0800)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/kishon/linux-phy.git tags/for-3.14-rc4
for you to fetch changes up to 0a06bd7ad6d603e79a2890e40190170d0c525a86:
phy: let phy_provider_register be the last step in registering PHY (2014-02-17 13:42:10 +0530)
----------------------------------------------------------------
Bunch of obvious fixes and cleanup in PHY subsystem.
----------------------------------------------------------------
Hans de Goede (3):
phy-core: phy_get: Leave error logging to the caller
phy-core: Don't propagate -ENOSUPP from phy_pm_runtime_get_sync to caller
phy-core: Don't allow building phy-core as a module
Kishon Vijay Abraham I (1):
phy: let phy_provider_register be the last step in registering PHY
Richard Weinberger (1):
phy,phy-bcm-kona-usb2.c: Add dependency on HAS_IOMEM
Sachin Kamat (3):
usb: phy: twl4030-usb: Silence checkpatch warnings
usb: phy: twl4030-usb: Remove redundant semicolon
usb: phy: bcm-kona-usb2: Use PTR_ERR_OR_ZERO
drivers/phy/Kconfig | 3 ++- drivers/phy/phy-bcm-kona-usb2.c | 4 +--- drivers/phy/phy-core.c | 14 ++++++-------- drivers/phy/phy-exynos-dp-video.c | 8 ++++---- drivers/phy/phy-exynos-mipi-video.c | 10 +++++----- drivers/phy/phy-mvebu-sata.c | 10 +++++----- drivers/phy/phy-omap-usb2.c | 10 +++++----- drivers/phy/phy-twl4030-usb.c | 16 ++++++++-------- 8 files changed, 36 insertions(+), 39 deletions(-)
Signature · 1 line
1.7.10.4
PATCH 1/8 usb: phy: twl4030-usb: Silence checkpatch warnings
From: Sachin Kamat <[email protected]>
Silences the following warnings:
WARNING: sizeof *twl should be sizeof(*twl)
WARNING: sizeof *otg should be sizeof(*otg)
--- drivers/phy/phy-twl4030-usb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/phy/phy-twl4030-usb.c +2 -2
@@ -661,7 +661,7 @@ static int twl4030_usb_probe(struct platform_device *pdev)struct phy_provider *phy_provider;struct phy_init_data *init_data =NULL ; - twl =devm_kzalloc (&pdev->dev,sizeof *twl,GFP_KERNEL ); + twl =devm_kzalloc (&pdev->dev,sizeof (*twl),GFP_KERNEL );if (!twl)return -ENOMEM ;
@@ -676,7 +676,7 @@ static int twl4030_usb_probe(struct platform_device *pdev)return -EINVAL ; } - otg =devm_kzalloc (&pdev->dev,sizeof *otg,GFP_KERNEL ); + otg =devm_kzalloc (&pdev->dev,sizeof (*otg),GFP_KERNEL );if (!otg)return -ENOMEM ;
Signature · 1 line
1.7.10.4
Re: [PATCH 1/8] usb: phy: twl4030-usb: Silence checkpatch warnings
Quoted 11 lines · Kishon Vijay Abraham I
From: Sachin Kamat <[email protected]>
Silences the following warnings:
WARNING: sizeof *twl should besizeof(*twl)
WARNING: sizeof *otg should besizeof(*otg)Signed-off-by Sachin Kamat <[email protected]>Signed-off-by Kishon Vijay Abraham I <[email protected]>--- drivers/phy/phy-twl4030-usb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
This isn't a 3.14-final worthy patch, sorry.
PATCH 2/8 usb: phy: twl4030-usb: Remove redundant semicolon
In reply to Kishon Vijay Abraham IFrom: Sachin Kamat <[email protected]>
Semicolon after switch statement is not needed.
--- drivers/phy/phy-twl4030-usb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/phy/phy-twl4030-usb.c +1 -1
@@ -338,7 +338,7 @@ static void twl4030_usb_set_mode(struct twl4030_usb *twl, int mode)dev_err (twl->dev,"unsupported T2 transceiver mode %d\n" , mode);break ; - }; + } }static void twl4030_i2c_access (struct twl4030_usb *twl,int on)
Signature · 1 line
1.7.10.4
Re: [PATCH 2/8] usb: phy: twl4030-usb: Remove redundant semicolon
Quoted 15 lines · Kishon Vijay Abraham I
From: Sachin Kamat <[email protected]>
Semicolon after switch statement is not needed.
Signed-off-by Sachin Kamat <[email protected]>Signed-off-by Kishon Vijay Abraham I <[email protected]>--- drivers/phy/phy-twl4030-usb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/phy/phy-twl4030-usb.c +0
-0
drivers/phy/phy-twl4030-usb.c static void twl4030_usb_set_mode(struct twl4030_usb *twl, int mode) · line 341
Quoted 5 lines
drivers/phy/phy-twl4030-usb.c +1
-1@@ -338,7 +338,7 @@ static void twl4030_usb_set_mode(struct twl4030_usb *twl, int mode)dev_err (twl->dev,"unsupported T2 transceiver mode %d\n" , mode);break ; - }; + }
Not a 3.14-final issue.
PATCH 3/8 usb: phy: bcm-kona-usb2: Use PTR_ERR_OR_ZERO
In reply to Kishon Vijay Abraham IFrom: Sachin Kamat <[email protected]>
PTR_ERR_OR_ZERO simplifies the code.
--- drivers/phy/phy-bcm-kona-usb2.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/phy/phy-bcm-kona-usb2.c +1 -3
@@ -128,10 +128,8 @@ static int bcm_kona_usb2_probe(struct platform_device *pdev) phy_provider =devm_of_phy_provider_register (dev, of_phy_simple_xlate); -if (IS_ERR (phy_provider)) -return PTR_ERR (phy_provider); -return 0 ; +return PTR_ERR_OR_ZERO (phy_provider); }static const struct of_device_id bcm_kona_usb2_dt_ids[] = {
Signature · 1 line
1.7.10.4
Re: [PATCH 3/8] usb: phy: bcm-kona-usb2: Use PTR_ERR_OR_ZERO
Quoted 16 lines · Kishon Vijay Abraham I
From: Sachin Kamat <[email protected]>
PTR_ERR_OR_ZEROsimplifies the code.Signed-off-by Sachin Kamat <[email protected]>Cc Matt Porter <[email protected]>Signed-off-by Kishon Vijay Abraham I <[email protected]>--- drivers/phy/phy-bcm-kona-usb2.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)drivers/phy/phy-bcm-kona-usb2.c +0
-0
drivers/phy/phy-bcm-kona-usb2.c static int bcm_kona_usb2_probe(struct platform_device *pdev) · line 133
Quoted 9 lines
drivers/phy/phy-bcm-kona-usb2.c +1
-3@@ -128,10 +128,8 @@ static int bcm_kona_usb2_probe(struct platform_device *pdev) phy_provider =devm_of_phy_provider_register (dev, of_phy_simple_xlate); -if (IS_ERR (phy_provider)) -return PTR_ERR (phy_provider); -return 0 ; +return PTR_ERR_OR_ZERO (phy_provider); }
Another patch here that isn't a bugfix, sorry, it's not for 3.14-final.
Re: [PATCH 3/8] usb: phy: bcm-kona-usb2: Use PTR_ERR_OR_ZERO
Quoted 23 lines · Greg KH
Quoted 22 lines · Kishon Vijay Abraham I
From: Sachin Kamat <[email protected]>
PTR_ERR_OR_ZEROsimplifies the code.Signed-off-by Sachin Kamat <[email protected]>Cc Matt Porter <[email protected]>Signed-off-by Kishon Vijay Abraham I <[email protected]>--- drivers/phy/phy-bcm-kona-usb2.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)drivers/phy/phy-bcm-kona-usb2.c +0
-2@@ -128,10 +128,8 @@ static int bcm_kona_usb2_probe(struct platform_device *pdev) phy_provider =devm_of_phy_provider_register (dev, of_phy_simple_xlate); -if (IS_ERR (phy_provider)) -return PTR_ERR (phy_provider);
Quoted 5 lines
drivers/phy/phy-bcm-kona-usb2.c static int bcm_kona_usb2_probe(struct platform_device *pdev) · line 133
Quoted 3 lines
drivers/phy/phy-bcm-kona-usb2.c +1
-1-return 0 ; +return PTR_ERR_OR_ZERO (phy_provider); }Another patch here that isn't a bugfix, sorry, it's not for 3.14-final.
Ok. I'll have these patches for the next merge window.
Thanks
Kishon
Quoted 1 line
PATCH 4/8 phy,phy-bcm-kona-usb2.c: Add dependency on HAS_IOMEM
In reply to Kishon Vijay Abraham IFrom: Richard Weinberger <[email protected]>
On archs like S390 or um this driver cannot build nor work. Make it depend on HAS_IOMEM to bypass build failures.
drivers/phy/phy-bcm-kona-usb2.c:114: undefined reference to `devm_ioremap_resource'
--- drivers/phy/Kconfig | 1 + 1 file changed, 1 insertion(+)
drivers/phy/Kconfig +1 -0
@@ -61,6 +61,7 @@ config PHY_EXYNOS_DP_VIDEO config BCM_KONA_USB2_PHY tristate "Broadcom Kona USB2 PHY Driver" depends on GENERIC_PHY + depends on HAS_IOMEM help Enable this to support the Broadcom Kona USB 2.0 PHY.
Signature · 1 line
1.7.10.4
PATCH 5/8 phy-core: phy_get: Leave error logging to the caller
In reply to Kishon Vijay Abraham IFrom: Hans de Goede <[email protected]>
In various cases errors may be expected, ie probe-deferral or a call to phy_get from a driver where the use of a phy is optional.
Rather then adding all sort of complicated checks for this, and/or adding special functions like devm_phy_get_optional, simply don't log an error, and let deciding if get_phy returning an error really should result in a dev_err up to the caller.
--- drivers/phy/phy-core.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-)
drivers/phy/phy-core.c +2 -8
@@ -404,17 +404,11 @@ struct phy *phy_get(struct device *dev, const char *string) index =of_property_match_string (dev->of_node,"phy-names" , string); phy =of_phy_get (dev, index); -if (IS_ERR (phy)) { -dev_err (dev,"unable to find phy\n" ); -return phy; - } }else { phy =phy_lookup (dev, string); -if (IS_ERR (phy)) { -dev_err (dev,"unable to find phy\n" ); -return phy; - } } +if (IS_ERR (phy)) +return phy;if (!try_module_get (phy->ops->owner))return ERR_PTR (-EPROBE_DEFER );
Signature · 1 line
1.7.10.4
PATCH 6/8 phy-core: Don't propagate -ENOSUPP from phy_pm_runtime_get_sync to caller
In reply to Kishon Vijay Abraham IFrom: Hans de Goede <[email protected]>
The phy-core allows phy_init and phy_power_on to be called multiple times, but before this patch -ENOSUPP from phy_pm_runtime_get_sync would be propagated to the caller for the 2nd and later calls.
--- drivers/phy/phy-core.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/phy/phy-core.c +4 -0
@@ -176,6 +176,8 @@ 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;
@@ -232,6 +234,8 @@ 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);
Signature · 1 line
1.7.10.4
PATCH 7/8 phy-core: Don't allow building phy-core as a module
In reply to Kishon Vijay Abraham IFrom: Hans de Goede <[email protected]>
include/phy/phy.h has stub code in there for when building without the phy-core enabled. This is useful for generic drivers such as ahci-platform, ehci-platoform and ohci-platform which have support for driving an optional phy passed to them through the devicetree.
Since on some boards this phy functionality is not needed, being able to disable the phy subsystem without needing a lot of #ifdef magic in the driver using it is quite useful.
However this breaks when the module using the phy subsystem is build-in and the phy-core is not, which leads to the build failing with missing symbol errors in the linking stage of the zImage.
Which leads to gems such as this being added to the Kconfig for achi_platform:
depends on GENERIC_PHY || !GENERIC_PHY
Rather then duplicating this code in a lot of places using the phy-core, I believe it is better to simply not allow the phy-core to be built as a module. The phy core is quite small and has no external dependencies, so always building it in when enabling it should not be an issue.
--- drivers/phy/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/phy/Kconfig +1 -1
@@ -5,7 +5,7 @@ menu "PHY Subsystem" config GENERIC_PHY - tristate "PHY Core" + bool "PHY Core" help Generic PHY support.
Signature · 1 line
1.7.10.4
PATCH 8/8 phy: let phy_provider_register be the last step in registering PHY
In reply to Kishon Vijay Abraham IRegistering phy_provider before creating the PHY can result in PHY callbacks being invoked which will lead to aborts. In order to avoid this invoke phy_provider_register after phy_create and phy_set_drvdata.
--- drivers/phy/phy-exynos-dp-video.c | 8 ++++---- drivers/phy/phy-exynos-mipi-video.c | 10 +++++----- drivers/phy/phy-mvebu-sata.c | 10 +++++----- drivers/phy/phy-omap-usb2.c | 10 +++++----- drivers/phy/phy-twl4030-usb.c | 10 +++++----- 5 files changed, 24 insertions(+), 24 deletions(-)
drivers/phy/phy-exynos-dp-video.c +4 -4
@@ -76,10 +76,6 @@ static int exynos_dp_video_phy_probe(struct platform_device *pdev)if (IS_ERR (state->regs))return PTR_ERR (state->regs); - phy_provider =devm_of_phy_provider_register (dev, of_phy_simple_xlate); -if (IS_ERR (phy_provider)) -return PTR_ERR (phy_provider); - phy =devm_phy_create (dev, &exynos_dp_video_phy_ops,NULL );if (IS_ERR (phy)) {dev_err (dev,"failed to create Display Port PHY\n" );
@@ -87,6 +83,10 @@ static int exynos_dp_video_phy_probe(struct platform_device *pdev) }phy_set_drvdata (phy, state); + phy_provider =devm_of_phy_provider_register (dev, of_phy_simple_xlate); +if (IS_ERR (phy_provider)) +return PTR_ERR (phy_provider); +return 0 ; }
drivers/phy/phy-exynos-mipi-video.c +5 -5
@@ -134,11 +134,6 @@ static int exynos_mipi_video_phy_probe(struct platform_device *pdev)dev_set_drvdata (dev, state);spin_lock_init (&state->slock); - phy_provider =devm_of_phy_provider_register (dev, - exynos_mipi_video_phy_xlate); -if (IS_ERR (phy_provider)) -return PTR_ERR (phy_provider); -for (i =0 ; i <EXYNOS_MIPI_PHYS_NUM ; i++) {struct phy *phy =devm_phy_create (dev, &exynos_mipi_video_phy_ops,NULL );
@@ -152,6 +147,11 @@ static int exynos_mipi_video_phy_probe(struct platform_device *pdev)phy_set_drvdata (phy, &state->phys[i]); } + phy_provider =devm_of_phy_provider_register (dev, + exynos_mipi_video_phy_xlate); +if (IS_ERR (phy_provider)) +return PTR_ERR (phy_provider); +return 0 ; }
drivers/phy/phy-mvebu-sata.c +5 -5
@@ -99,17 +99,17 @@ static int phy_mvebu_sata_probe(struct platform_device *pdev)if (IS_ERR (priv->clk))return PTR_ERR (priv->clk); - phy_provider =devm_of_phy_provider_register (&pdev->dev, - of_phy_simple_xlate); -if (IS_ERR (phy_provider)) -return PTR_ERR (phy_provider); - phy =devm_phy_create (&pdev->dev, &phy_mvebu_sata_ops,NULL );if (IS_ERR (phy))return PTR_ERR (phy);phy_set_drvdata (phy, priv); + phy_provider =devm_of_phy_provider_register (&pdev->dev, + of_phy_simple_xlate); +if (IS_ERR (phy_provider)) +return PTR_ERR (phy_provider); +/* The boot loader may of left it on. Turn it off. */ phy_mvebu_sata_power_off (phy);
drivers/phy/phy-omap-usb2.c +5 -5
@@ -177,11 +177,6 @@ static int omap_usb2_probe(struct platform_device *pdev) phy->phy.otg = otg; phy->phy.type =USB_PHY_TYPE_USB2 ; - phy_provider =devm_of_phy_provider_register (phy->dev, - of_phy_simple_xlate); -if (IS_ERR (phy_provider)) -return PTR_ERR (phy_provider); - control_node =of_parse_phandle (node,"ctrl-module" ,0 );if (!control_node) {dev_err (&pdev->dev,"Failed to get control device phandle\n" );
@@ -214,6 +209,11 @@ static int omap_usb2_probe(struct platform_device *pdev)phy_set_drvdata (generic_phy, phy); + phy_provider =devm_of_phy_provider_register (phy->dev, + of_phy_simple_xlate); +if (IS_ERR (phy_provider)) +return PTR_ERR (phy_provider); + phy->wkupclk =devm_clk_get (phy->dev,"usb_phy_cm_clk32k" );if (IS_ERR (phy->wkupclk)) {dev_err (&pdev->dev,"unable to get usb_phy_cm_clk32k\n" );
drivers/phy/phy-twl4030-usb.c +5 -5
@@ -695,11 +695,6 @@ static int twl4030_usb_probe(struct platform_device *pdev) otg->set_host = twl4030_set_host; otg->set_peripheral = twl4030_set_peripheral; - phy_provider =devm_of_phy_provider_register (twl->dev, - of_phy_simple_xlate); -if (IS_ERR (phy_provider)) -return PTR_ERR (phy_provider); - phy =devm_phy_create (twl->dev, &ops, init_data);if (IS_ERR (phy)) {dev_dbg (&pdev->dev,"Failed to create PHY\n" );
@@ -708,6 +703,11 @@ static int twl4030_usb_probe(struct platform_device *pdev)phy_set_drvdata (phy, twl); + phy_provider =devm_of_phy_provider_register (twl->dev, + of_phy_simple_xlate); +if (IS_ERR (phy_provider)) +return PTR_ERR (phy_provider); +/* init spinlock for workqueue */ spin_lock_init (&twl->lock);
Signature · 1 line
1.7.10.4
Quoted 10 lines · Kishon Vijay Abraham I
Hi Greg,
Here's the PULL requeust for PHY subsystem for this -rc cycle. There isn't anything major but a bunch of obvious fixes and cleanup.
Let me know If I have to change anything.
Thanks
Kishon
Quoted 7 lines
The following changes since commit
6d0abeca3242a88cab8232e4acd7e2bf088f3bc2:Linux 3.14-rc3 (2014-02-16 13:30:25 -0800)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/kishon/linux-phy.gittags/for-3.14-rc4
Is this a signed tag? It doesn't look like it from this side, so it would be great if you could redo it as a signed tag so I "know" I'm pulling the right thing in the future.
For now, I'll just take the "raw" patches.
thanks,
greg k-h
Quoted 15 lines · Greg KH
Quoted 14 lines · Kishon Vijay Abraham I
Hi Greg,
Here's the PULL requeust for PHY subsystem for this -rc cycle. There isn't anything major but a bunch of obvious fixes and cleanup.
Let me know If I have to change anything.
Thanks
KishonThe following changes since commit
6d0abeca3242a88cab8232e4acd7e2bf088f3bc2:Linux 3.14-rc3 (2014-02-16 13:30:25 -0800)
Quoted 7 lines
Quoted 3 lines
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/kishon/linux-phy.gittags/for-3.14-rc4Is this a signed tag? It doesn't look like it from this side, so it would be great if you could redo it as a signed tag so I "know" I'm pulling the right thing in the future.
ah.. sorry. Now changed that into a signed tag.
Thanks
Kishon