Messon: Simplify error handling with dev_err_probe()
Subsystems (2)
cover Messon: Simplify error handling with dev_err_probe()
Hi All,
Use dev_err_probe() for phy resources to indicate the deferral reason when waiting for the resource to come up.
Note: The following patch for RTC:
phy: amlogic: phy-meson-axg-pcie: Fix PHY creation order in axg-pcie probe
has not been tested as I do not have access to the Amlogic AGX hardware. However, I have made improvements to this change based on my understanding of other code.
Thanks
-Anand
Anand Moon (6):
phy: amlogic: phy-meson-gxl-usb2: Simplify error handling with
dev_err_probe()
phy: amlogic: phy-meson-g12a-usb2: Simplify error handling with
dev_err_probe()
phy: amlogic: phy-meson-axg-mipi-pcie-analog: Simplify error handling
with dev_err_probe()
phy: amlogic: phy-meson-axg-mipi-dphy: Simplify error handling with
dev_err_probe()
phy: amlogic: phy-meson-axg-pcie: Simplify error handling with
dev_err_probe() phy: amlogic: phy-meson-axg-pcie: Fix PHY creation order in axg-pcie
probe
drivers/phy/amlogic/phy-meson-axg-mipi-dphy.c | 10 +++------- .../phy/amlogic/phy-meson-axg-mipi-pcie-analog.c | 10 +++------- drivers/phy/amlogic/phy-meson-axg-pcie.c | 14 +++++--------- drivers/phy/amlogic/phy-meson-g12a-usb2.c | 10 +++------- drivers/phy/amlogic/phy-meson-gxl-usb2.c | 11 +++-------- 5 files changed, 17 insertions(+), 38 deletions(-)
base-commit: 3b07108ada81a8ebcebf1fe61367b4e436c895bd
Signature · 1 line
2.49.0
PATCH 1/6 phy: amlogic: phy-meson-gxl-usb2: Simplify error handling with dev_err_probe()
Use dev_err_probe() for phy resources to indicate the deferral reason when waiting for the resource to come up.
--- drivers/phy/amlogic/phy-meson-gxl-usb2.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-)
drivers/phy/amlogic/phy-meson-gxl-usb2.c +3 -8
@@ -237,7 +237,6 @@ static int phy_meson_gxl_usb2_probe(struct platform_device *pdev)struct phy_meson_gxl_usb2_priv *priv;struct phy *phy;void __iomem *base; -int ret; priv =devm_kzalloc (dev,sizeof (*priv),GFP_KERNEL );if (!priv)
@@ -266,13 +265,9 @@ static int phy_meson_gxl_usb2_probe(struct platform_device *pdev)return PTR_ERR (priv->reset); phy =devm_phy_create (dev,NULL , &phy_meson_gxl_usb2_ops); -if (IS_ERR (phy)) { - ret =PTR_ERR (phy); -if (ret != -EPROBE_DEFER ) -dev_err (dev,"failed to create PHY\n" ); - -return ret; - } +if (IS_ERR (phy)) +return dev_err_probe (dev,PTR_ERR (phy), +"failed to create PHY\n" );phy_set_drvdata (phy, priv);
Signature · 1 line
2.49.0
Re: [PATCH v1 1/6] phy: amlogic: phy-meson-gxl-usb2: Simplify error handling with dev_err_probe()
Quoted 27 lines · Anand Moon
Use
dev_err_probe()for phy resources to indicate the deferral reason when waiting for the resource to come up.Signed-off-by Anand Moon <[email protected]>--- drivers/phy/amlogic/phy-meson-gxl-usb2.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-)drivers/phy/amlogic/phy-meson-gxl-usb2.c +0
-4@@ -237,7 +237,6 @@ static int phy_meson_gxl_usb2_probe(struct platform_device *pdev)struct phy_meson_gxl_usb2_priv *priv;struct phy *phy;void __iomem *base; -int ret; priv =devm_kzalloc (dev,sizeof (*priv),GFP_KERNEL );if (!priv)@@ -266,13 +265,9 @@ static int phy_meson_gxl_usb2_probe(struct platform_device *pdev)return PTR_ERR (priv->reset); phy =devm_phy_create (dev,NULL , &phy_meson_gxl_usb2_ops); -if (IS_ERR (phy)) { - ret =PTR_ERR (phy); -if (ret != -EPROBE_DEFER )
drivers/phy/amlogic/phy-meson-gxl-usb2.c static int phy_meson_gxl_usb2_probe(struct platform_device *pdev) · line 273
Quoted 10 lines
drivers/phy/amlogic/phy-meson-gxl-usb2.c +3
-4-dev_err (dev,"failed to create PHY\n" ); - -return ret; - } +if (IS_ERR (phy)) +return dev_err_probe (dev,PTR_ERR (phy), +"failed to create PHY\n" );phy_set_drvdata (phy, priv);
PATCH 2/6 phy: amlogic: phy-meson-g12a-usb2: Simplify error handling with dev_err_probe()
In reply to Anand MoonUse dev_err_probe() for phy resources to indicate the deferral reason when waiting for the resource to come up.
--- drivers/phy/amlogic/phy-meson-g12a-usb2.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-)
drivers/phy/amlogic/phy-meson-g12a-usb2.c +3 -7
@@ -339,13 +339,9 @@ static int phy_meson_g12a_usb2_probe(struct platform_device *pdev)return ret; phy =devm_phy_create (dev,NULL , &phy_meson_g12a_usb2_ops); -if (IS_ERR (phy)) { - ret =PTR_ERR (phy); -if (ret != -EPROBE_DEFER ) -dev_err (dev,"failed to create PHY\n" ); - -return ret; - } +if (IS_ERR (phy)) +return dev_err_probe (dev,PTR_ERR (phy), +"failed to create PHY\n" );phy_set_bus_width (phy,8 );phy_set_drvdata (phy, priv);
Signature · 1 line
2.49.0
Re: [PATCH v1 2/6] phy: amlogic: phy-meson-g12a-usb2: Simplify error handling with dev_err_probe()
Quoted 19 lines · Anand Moon
Use
dev_err_probe()for phy resources to indicate the deferral reason when waiting for the resource to come up.Signed-off-by Anand Moon <[email protected]>--- drivers/phy/amlogic/phy-meson-g12a-usb2.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-)drivers/phy/amlogic/phy-meson-g12a-usb2.c +0
-3@@ -339,13 +339,9 @@ static int phy_meson_g12a_usb2_probe(struct platform_device *pdev)return ret; phy =devm_phy_create (dev,NULL , &phy_meson_g12a_usb2_ops); -if (IS_ERR (phy)) { - ret =PTR_ERR (phy); -if (ret != -EPROBE_DEFER )
drivers/phy/amlogic/phy-meson-g12a-usb2.c static int phy_meson_g12a_usb2_probe(struct platform_device *pdev) · line 347
Quoted 10 lines
drivers/phy/amlogic/phy-meson-g12a-usb2.c +3
-4-dev_err (dev,"failed to create PHY\n" ); - -return ret; - } +if (IS_ERR (phy)) +return dev_err_probe (dev,PTR_ERR (phy), +"failed to create PHY\n" );phy_set_bus_width (phy,8 );phy_set_drvdata (phy, priv);
PATCH 3/6 phy: amlogic: phy-meson-axg-mipi-pcie-analog: Simplify error handling with dev_err_probe()
In reply to Anand MoonUse dev_err_probe() for phy resources to indicate the deferral reason when waiting for the resource to come up.
--- drivers/phy/amlogic/phy-meson-axg-mipi-pcie-analog.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-)
drivers/phy/amlogic/phy-meson-axg-mipi-pcie-analog.c +3 -7
@@ -200,7 +200,6 @@ static int phy_axg_mipi_pcie_analog_probe(struct platform_device *pdev)struct phy_axg_mipi_pcie_analog_priv *priv;struct device_node *np = dev->of_node, *parent_np;struct regmap *map; -int ret; priv =devm_kmalloc (dev,sizeof (*priv),GFP_KERNEL );if (!priv)
@@ -219,12 +218,9 @@ static int phy_axg_mipi_pcie_analog_probe(struct platform_device *pdev) priv->regmap = map; priv->phy =devm_phy_create (dev, np, &phy_axg_mipi_pcie_analog_ops); -if (IS_ERR (priv->phy)) { - ret =PTR_ERR (priv->phy); -if (ret != -EPROBE_DEFER ) -dev_err (dev,"failed to create PHY\n" ); -return ret; - } +if (IS_ERR (priv->phy)) +return dev_err_probe (dev,PTR_ERR (priv->phy), +"failed to create PHY\n" );phy_set_drvdata (priv->phy, priv);dev_set_drvdata (dev, priv);
Signature · 1 line
2.49.0
Re: [PATCH v1 3/6] phy: amlogic: phy-meson-axg-mipi-pcie-analog: Simplify error handling with dev_err_probe()
Quoted 26 lines · Anand Moon
Use
dev_err_probe()for phy resources to indicate the deferral reason when waiting for the resource to come up.Signed-off-by Anand Moon <[email protected]>--- drivers/phy/amlogic/phy-meson-axg-mipi-pcie-analog.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-)drivers/phy/amlogic/phy-meson-axg-mipi-pcie-analog.c +0
-3@@ -200,7 +200,6 @@ static int phy_axg_mipi_pcie_analog_probe(struct platform_device *pdev)struct phy_axg_mipi_pcie_analog_priv *priv;struct device_node *np = dev->of_node, *parent_np;struct regmap *map; -int ret; priv =devm_kmalloc (dev,sizeof (*priv),GFP_KERNEL );if (!priv)@@ -219,12 +218,9 @@ static int phy_axg_mipi_pcie_analog_probe(struct platform_device *pdev) priv->regmap = map; priv->phy =devm_phy_create (dev, np, &phy_axg_mipi_pcie_analog_ops); -if (IS_ERR (priv->phy)) { - ret =PTR_ERR (priv->phy);
drivers/phy/amlogic/phy-meson-axg-mipi-pcie-analog.c static int phy_axg_mipi_pcie_analog_probe(struct platform_device *pdev) · line 226
Quoted 10 lines
drivers/phy/amlogic/phy-meson-axg-mipi-pcie-analog.c +3
-4-if (ret != -EPROBE_DEFER ) -dev_err (dev,"failed to create PHY\n" ); -return ret; - } +if (IS_ERR (priv->phy)) +return dev_err_probe (dev,PTR_ERR (priv->phy), +"failed to create PHY\n" );phy_set_drvdata (priv->phy, priv);dev_set_drvdata (dev, priv);
PATCH 4/6 phy: amlogic: phy-meson-axg-mipi-dphy: Simplify error handling with dev_err_probe()
In reply to Anand MoonUse dev_err_probe() for phy resources to indicate the deferral reason when waiting for the resource to come up.
--- drivers/phy/amlogic/phy-meson-axg-mipi-dphy.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-)
drivers/phy/amlogic/phy-meson-axg-mipi-dphy.c +3 -7
@@ -377,13 +377,9 @@ static int phy_meson_axg_mipi_dphy_probe(struct platform_device *pdev)return ret; phy =devm_phy_create (dev,NULL , &phy_meson_axg_mipi_dphy_ops); -if (IS_ERR (phy)) { - ret =PTR_ERR (phy); -if (ret != -EPROBE_DEFER ) -dev_err (dev,"failed to create PHY\n" ); - -return ret; - } +if (IS_ERR (phy)) +return dev_err_probe (dev,PTR_ERR (phy), +"failed to create PHY\n" );phy_set_drvdata (phy, priv);
Signature · 1 line
2.49.0
Re: [PATCH v1 4/6] phy: amlogic: phy-meson-axg-mipi-dphy: Simplify error handling with dev_err_probe()
Quoted 19 lines · Anand Moon
Use
dev_err_probe()for phy resources to indicate the deferral reason when waiting for the resource to come up.Signed-off-by Anand Moon <[email protected]>--- drivers/phy/amlogic/phy-meson-axg-mipi-dphy.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-)drivers/phy/amlogic/phy-meson-axg-mipi-dphy.c +0
-3@@ -377,13 +377,9 @@ static int phy_meson_axg_mipi_dphy_probe(struct platform_device *pdev)return ret; phy =devm_phy_create (dev,NULL , &phy_meson_axg_mipi_dphy_ops); -if (IS_ERR (phy)) { - ret =PTR_ERR (phy); -if (ret != -EPROBE_DEFER )
drivers/phy/amlogic/phy-meson-axg-mipi-dphy.c static int phy_meson_axg_mipi_dphy_probe(struct platform_device *pdev) · line 385
Quoted 10 lines
drivers/phy/amlogic/phy-meson-axg-mipi-dphy.c +3
-4-dev_err (dev,"failed to create PHY\n" ); - -return ret; - } +if (IS_ERR (phy)) +return dev_err_probe (dev,PTR_ERR (phy), +"failed to create PHY\n" );phy_set_drvdata (phy, priv);
PATCH 5/6 phy: amlogic: phy-meson-axg-pcie: Simplify error handling with dev_err_probe()
In reply to Anand MoonUse dev_err_probe() for phy resources to indicate the deferral reason when waiting for the resource to come up.
--- drivers/phy/amlogic/phy-meson-axg-pcie.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-)
drivers/phy/amlogic/phy-meson-axg-pcie.c +3 -7
@@ -131,19 +131,15 @@ static int phy_axg_pcie_probe(struct platform_device *pdev)struct phy_axg_pcie_priv *priv;struct device_node *np = dev->of_node;void __iomem *base; -int ret; priv =devm_kmalloc (dev,sizeof (*priv),GFP_KERNEL );if (!priv)return -ENOMEM ; priv->phy =devm_phy_create (dev, np, &phy_axg_pcie_ops); -if (IS_ERR (priv->phy)) { - ret =PTR_ERR (priv->phy); -if (ret != -EPROBE_DEFER ) -dev_err (dev,"failed to create PHY\n" ); -return ret; - } +if (IS_ERR (priv->phy)) +return dev_err_probe (dev,PTR_ERR (priv->phy), +"failed to create PHY\n" ); base =devm_platform_ioremap_resource (pdev,0 );if (IS_ERR (base))
Signature · 1 line
2.49.0
Re: [PATCH v1 5/6] phy: amlogic: phy-meson-axg-pcie: Simplify error handling with dev_err_probe()
Quoted 25 lines · Anand Moon
Use
dev_err_probe()for phy resources to indicate the deferral reason when waiting for the resource to come up.Signed-off-by Anand Moon <[email protected]>--- drivers/phy/amlogic/phy-meson-axg-pcie.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-)drivers/phy/amlogic/phy-meson-axg-pcie.c +0
-3@@ -131,19 +131,15 @@ static int phy_axg_pcie_probe(struct platform_device *pdev)struct phy_axg_pcie_priv *priv;struct device_node *np = dev->of_node;void __iomem *base; -int ret; priv =devm_kmalloc (dev,sizeof (*priv),GFP_KERNEL );if (!priv)return -ENOMEM ; priv->phy =devm_phy_create (dev, np, &phy_axg_pcie_ops); -if (IS_ERR (priv->phy)) { - ret =PTR_ERR (priv->phy);
drivers/phy/amlogic/phy-meson-axg-pcie.c static int phy_axg_pcie_probe(struct platform_device *pdev) · line 145
Quoted 10 lines
drivers/phy/amlogic/phy-meson-axg-pcie.c +3
-4-if (ret != -EPROBE_DEFER ) -dev_err (dev,"failed to create PHY\n" ); -return ret; - } +if (IS_ERR (priv->phy)) +return dev_err_probe (dev,PTR_ERR (priv->phy), +"failed to create PHY\n" ); base =devm_platform_ioremap_resource (pdev,0 );if (IS_ERR (base))
PATCH 6/6 phy: amlogic: phy-meson-axg-pcie: Fix PHY creation order in axg-pcie probe
In reply to Anand MoonReorder the PHY creation in the axg-pcie probe function to ensure all the resource is mapped before creating the PHY. This change addresses the issue where the PHY creation was attempted before mapping the necessary resources, potentially causing failures.
--- drivers/phy/amlogic/phy-meson-axg-pcie.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/phy/amlogic/phy-meson-axg-pcie.c +5 -5
@@ -136,11 +136,6 @@ static int phy_axg_pcie_probe(struct platform_device *pdev)if (!priv)return -ENOMEM ; - priv->phy =devm_phy_create (dev, np, &phy_axg_pcie_ops); -if (IS_ERR (priv->phy)) -return dev_err_probe (dev,PTR_ERR (priv->phy), -"failed to create PHY\n" ); - base =devm_platform_ioremap_resource (pdev,0 );if (IS_ERR (base))return PTR_ERR (base);
@@ -158,6 +153,11 @@ static int phy_axg_pcie_probe(struct platform_device *pdev)if (IS_ERR (priv->analog))return PTR_ERR (priv->analog); + priv->phy =devm_phy_create (dev, np, &phy_axg_pcie_ops); +if (IS_ERR (priv->phy)) +return dev_err_probe (dev,PTR_ERR (priv->phy), +"failed to create PHY\n" ); +phy_set_drvdata (priv->phy, priv);dev_set_drvdata (dev, priv); pphy =devm_of_phy_provider_register (dev, of_phy_simple_xlate);
Signature · 1 line
2.49.0
Re: [PATCH v1 6/6] phy: amlogic: phy-meson-axg-pcie: Fix PHY creation order in axg-pcie probe
Quoted 28 lines · Anand Moon
Reorder the PHY creation in the axg-pcie probe function to ensure all the resource is mapped before creating the PHY. This change addresses the issue where the PHY creation was attempted before mapping the necessary resources, potentially causing failures.
Signed-off-by Anand Moon <[email protected]>--- drivers/phy/amlogic/phy-meson-axg-pcie.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)drivers/phy/amlogic/phy-meson-axg-pcie.c +0
-5@@ -136,11 +136,6 @@ static int phy_axg_pcie_probe(struct platform_device *pdev)if (!priv)return -ENOMEM ; - priv->phy =devm_phy_create (dev, np, &phy_axg_pcie_ops); -if (IS_ERR (priv->phy)) -return dev_err_probe (dev,PTR_ERR (priv->phy), -"failed to create PHY\n" ); - base =devm_platform_ioremap_resource (pdev,0 );if (IS_ERR (base))return PTR_ERR (base);@@ -158,6 +153,11 @@ static int phy_axg_pcie_probe(struct platform_device *pdev)if (IS_ERR (priv->analog))
drivers/phy/amlogic/phy-meson-axg-pcie.c static int phy_axg_pcie_probe(struct platform_device *pdev) · line 163
Quoted 10 lines
drivers/phy/amlogic/phy-meson-axg-pcie.c +5
-0return PTR_ERR (priv->analog); + priv->phy =devm_phy_create (dev, np, &phy_axg_pcie_ops); +if (IS_ERR (priv->phy)) +return dev_err_probe (dev,PTR_ERR (priv->phy), +"failed to create PHY\n" ); +phy_set_drvdata (priv->phy, priv);dev_set_drvdata (dev, priv); pphy =devm_of_phy_provider_register (dev, of_phy_simple_xlate);
Quoted 8 lines · Anand Moon
Use
dev_err_probe()for phy resources to indicate the deferral reason when waiting for the resource to come up.Note: The following patch for RTC:
phy: amlogic: phy-meson-axg-pcie: Fix PHY creation order in axg-pcie probe
[...]
Applied, thanks!
[1/6] phy: amlogic: phy-meson-gxl-usb2: Simplify error handling with dev_err_probe()
commit: 05457917e50c3d6bf75d2e3b99c7e6709a4a6844
[2/6] phy: amlogic: phy-meson-g12a-usb2: Simplify error handling with dev_err_probe()
commit: 9bff4ef29a6409850c27df705da54277a8e836f2
[3/6] phy: amlogic: phy-meson-axg-mipi-pcie-analog: Simplify error handling with dev_err_probe()
commit: de39730f9258e9984892c0af68a3e884ad19acea
[4/6] phy: amlogic: phy-meson-axg-mipi-dphy: Simplify error handling with dev_err_probe()
commit: a77e2e899841937798bff0924c03d4d0e4963aa3
[5/6] phy: amlogic: phy-meson-axg-pcie: Simplify error handling with dev_err_probe()
commit: fef364bd4c9cf712c91e0013f5f304f4e7f09198
[6/6] phy: amlogic: phy-meson-axg-pcie: Fix PHY creation order in axg-pcie probe
commit: bdeff6d8a211c832f5ce1a65aff17f4a5e6de00fBest regards,
Signature · 1 line
~Vinod