* [PATCH net-next v2 1/3] net: stmmac: dwmac-qcom-ethqos: Use of_get_phy_mode() over device_get_phy_mode()
2023-07-10 20:06 [PATCH net-next v2 0/3] net: stmmac: dwmac-qcom-ethqos: Improve error handling Andrew Halaney
@ 2023-07-10 20:06 ` Andrew Halaney
2023-07-10 20:59 ` Andrew Lunn
2023-07-10 20:06 ` [PATCH net-next v2 2/3] net: stmmac: dwmac-qcom-ethqos: Use dev_err_probe() Andrew Halaney
` (2 subsequent siblings)
3 siblings, 1 reply; 7+ messages in thread
From: Andrew Halaney @ 2023-07-10 20:06 UTC (permalink / raw)
To: linux-kernel
Cc: linux-arm-kernel, linux-stm32, netdev, mcoquelin.stm32, pabeni,
kuba, edumazet, davem, joabreu, alexandre.torgue, peppe.cavallaro,
bhupesh.sharma, vkoul, linux-arm-msm, andrew, simon.horman,
Andrew Halaney
Since this driver only uses devicetree, let's move over to
of_get_phy_mode(). That API has an explicit error return and produces a
phy_interface_t directly instead of an int when representing the phy
mode.
Signed-off-by: Andrew Halaney <ahalaney@redhat.com>
---
Changes since v1:
* Convert to using of_get_phy_mode() instead of continuing to use
device_get_phy_mode() (Andrew Lunn)
.../net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
index e62940414e54..ebafdadb28d5 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
@@ -4,10 +4,10 @@
#include <linux/module.h>
#include <linux/of.h>
#include <linux/of_device.h>
+#include <linux/of_net.h>
#include <linux/platform_device.h>
#include <linux/phy.h>
#include <linux/phy/phy.h>
-#include <linux/property.h>
#include "stmmac.h"
#include "stmmac_platform.h"
@@ -104,7 +104,7 @@ struct qcom_ethqos {
struct clk *link_clk;
struct phy *serdes_phy;
unsigned int speed;
- int phy_mode;
+ phy_interface_t phy_mode;
const struct ethqos_emac_por *por;
unsigned int num_por;
@@ -720,7 +720,9 @@ static int qcom_ethqos_probe(struct platform_device *pdev)
if (!ethqos)
return -ENOMEM;
- ethqos->phy_mode = device_get_phy_mode(dev);
+ ret = of_get_phy_mode(np, ðqos->phy_mode);
+ if (ret)
+ return dev_err_probe(dev, ret, "Failed to get phy mode\n");
switch (ethqos->phy_mode) {
case PHY_INTERFACE_MODE_RGMII:
case PHY_INTERFACE_MODE_RGMII_ID:
@@ -731,8 +733,6 @@ static int qcom_ethqos_probe(struct platform_device *pdev)
case PHY_INTERFACE_MODE_SGMII:
ethqos->configure_func = ethqos_configure_sgmii;
break;
- case -ENODEV:
- return -ENODEV;
default:
return -EINVAL;
}
--
2.41.0
^ permalink raw reply related [flat|nested] 7+ messages in thread* Re: [PATCH net-next v2 1/3] net: stmmac: dwmac-qcom-ethqos: Use of_get_phy_mode() over device_get_phy_mode()
2023-07-10 20:06 ` [PATCH net-next v2 1/3] net: stmmac: dwmac-qcom-ethqos: Use of_get_phy_mode() over device_get_phy_mode() Andrew Halaney
@ 2023-07-10 20:59 ` Andrew Lunn
0 siblings, 0 replies; 7+ messages in thread
From: Andrew Lunn @ 2023-07-10 20:59 UTC (permalink / raw)
To: Andrew Halaney
Cc: linux-kernel, linux-arm-kernel, linux-stm32, netdev,
mcoquelin.stm32, pabeni, kuba, edumazet, davem, joabreu,
alexandre.torgue, peppe.cavallaro, bhupesh.sharma, vkoul,
linux-arm-msm, simon.horman
On Mon, Jul 10, 2023 at 03:06:37PM -0500, Andrew Halaney wrote:
> Since this driver only uses devicetree, let's move over to
> of_get_phy_mode(). That API has an explicit error return and produces a
> phy_interface_t directly instead of an int when representing the phy
> mode.
>
> Signed-off-by: Andrew Halaney <ahalaney@redhat.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Andrew
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH net-next v2 2/3] net: stmmac: dwmac-qcom-ethqos: Use dev_err_probe()
2023-07-10 20:06 [PATCH net-next v2 0/3] net: stmmac: dwmac-qcom-ethqos: Improve error handling Andrew Halaney
2023-07-10 20:06 ` [PATCH net-next v2 1/3] net: stmmac: dwmac-qcom-ethqos: Use of_get_phy_mode() over device_get_phy_mode() Andrew Halaney
@ 2023-07-10 20:06 ` Andrew Halaney
2023-07-10 20:06 ` [PATCH net-next v2 3/3] net: stmmac: dwmac-qcom-ethqos: Log more errors in probe Andrew Halaney
2023-07-12 9:20 ` [PATCH net-next v2 0/3] net: stmmac: dwmac-qcom-ethqos: Improve error handling patchwork-bot+netdevbpf
3 siblings, 0 replies; 7+ messages in thread
From: Andrew Halaney @ 2023-07-10 20:06 UTC (permalink / raw)
To: linux-kernel
Cc: linux-arm-kernel, linux-stm32, netdev, mcoquelin.stm32, pabeni,
kuba, edumazet, davem, joabreu, alexandre.torgue, peppe.cavallaro,
bhupesh.sharma, vkoul, linux-arm-msm, andrew, simon.horman,
Andrew Halaney
Using dev_err_probe() logs to devices_deferred which is helpful
when debugging.
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Andrew Halaney <ahalaney@redhat.com>
---
Changes since v1:
* Collect tags (Andrew Lunn)
drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
index ebafdadb28d5..1e103fd356b7 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
@@ -710,8 +710,8 @@ static int qcom_ethqos_probe(struct platform_device *pdev)
plat_dat = devm_stmmac_probe_config_dt(pdev, stmmac_res.mac);
if (IS_ERR(plat_dat)) {
- dev_err(dev, "dt configuration failed\n");
- return PTR_ERR(plat_dat);
+ return dev_err_probe(dev, PTR_ERR(plat_dat),
+ "dt configuration failed\n");
}
plat_dat->clks_config = ethqos_clks_config;
--
2.41.0
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH net-next v2 3/3] net: stmmac: dwmac-qcom-ethqos: Log more errors in probe
2023-07-10 20:06 [PATCH net-next v2 0/3] net: stmmac: dwmac-qcom-ethqos: Improve error handling Andrew Halaney
2023-07-10 20:06 ` [PATCH net-next v2 1/3] net: stmmac: dwmac-qcom-ethqos: Use of_get_phy_mode() over device_get_phy_mode() Andrew Halaney
2023-07-10 20:06 ` [PATCH net-next v2 2/3] net: stmmac: dwmac-qcom-ethqos: Use dev_err_probe() Andrew Halaney
@ 2023-07-10 20:06 ` Andrew Halaney
2023-07-10 21:00 ` Andrew Lunn
2023-07-12 9:20 ` [PATCH net-next v2 0/3] net: stmmac: dwmac-qcom-ethqos: Improve error handling patchwork-bot+netdevbpf
3 siblings, 1 reply; 7+ messages in thread
From: Andrew Halaney @ 2023-07-10 20:06 UTC (permalink / raw)
To: linux-kernel
Cc: linux-arm-kernel, linux-stm32, netdev, mcoquelin.stm32, pabeni,
kuba, edumazet, davem, joabreu, alexandre.torgue, peppe.cavallaro,
bhupesh.sharma, vkoul, linux-arm-msm, andrew, simon.horman,
Andrew Halaney
These are useful to see when debugging a probe failure.
Signed-off-by: Andrew Halaney <ahalaney@redhat.com>
---
Changes since v1:
* No changes
.../ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
index 1e103fd356b7..757504ebb676 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
@@ -706,7 +706,8 @@ static int qcom_ethqos_probe(struct platform_device *pdev)
ret = stmmac_get_platform_resources(pdev, &stmmac_res);
if (ret)
- return ret;
+ return dev_err_probe(dev, ret,
+ "Failed to get platform resources\n");
plat_dat = devm_stmmac_probe_config_dt(pdev, stmmac_res.mac);
if (IS_ERR(plat_dat)) {
@@ -734,13 +735,16 @@ static int qcom_ethqos_probe(struct platform_device *pdev)
ethqos->configure_func = ethqos_configure_sgmii;
break;
default:
+ dev_err(dev, "Unsupported phy mode %s\n",
+ phy_modes(ethqos->phy_mode));
return -EINVAL;
}
ethqos->pdev = pdev;
ethqos->rgmii_base = devm_platform_ioremap_resource_byname(pdev, "rgmii");
if (IS_ERR(ethqos->rgmii_base))
- return PTR_ERR(ethqos->rgmii_base);
+ return dev_err_probe(dev, PTR_ERR(ethqos->rgmii_base),
+ "Failed to map rgmii resource\n");
ethqos->mac_base = stmmac_res.addr;
@@ -752,7 +756,8 @@ static int qcom_ethqos_probe(struct platform_device *pdev)
ethqos->link_clk = devm_clk_get(dev, data->link_clk_name ?: "rgmii");
if (IS_ERR(ethqos->link_clk))
- return PTR_ERR(ethqos->link_clk);
+ return dev_err_probe(dev, PTR_ERR(ethqos->link_clk),
+ "Failed to get link_clk\n");
ret = ethqos_clks_config(ethqos, true);
if (ret)
@@ -764,7 +769,8 @@ static int qcom_ethqos_probe(struct platform_device *pdev)
ethqos->serdes_phy = devm_phy_optional_get(dev, "serdes");
if (IS_ERR(ethqos->serdes_phy))
- return PTR_ERR(ethqos->serdes_phy);
+ return dev_err_probe(dev, PTR_ERR(ethqos->serdes_phy),
+ "Failed to get serdes phy\n");
ethqos->speed = SPEED_1000;
ethqos_update_link_clk(ethqos, SPEED_1000);
--
2.41.0
^ permalink raw reply related [flat|nested] 7+ messages in thread* Re: [PATCH net-next v2 3/3] net: stmmac: dwmac-qcom-ethqos: Log more errors in probe
2023-07-10 20:06 ` [PATCH net-next v2 3/3] net: stmmac: dwmac-qcom-ethqos: Log more errors in probe Andrew Halaney
@ 2023-07-10 21:00 ` Andrew Lunn
0 siblings, 0 replies; 7+ messages in thread
From: Andrew Lunn @ 2023-07-10 21:00 UTC (permalink / raw)
To: Andrew Halaney
Cc: linux-kernel, linux-arm-kernel, linux-stm32, netdev,
mcoquelin.stm32, pabeni, kuba, edumazet, davem, joabreu,
alexandre.torgue, peppe.cavallaro, bhupesh.sharma, vkoul,
linux-arm-msm, simon.horman
On Mon, Jul 10, 2023 at 03:06:39PM -0500, Andrew Halaney wrote:
> These are useful to see when debugging a probe failure.
>
> Signed-off-by: Andrew Halaney <ahalaney@redhat.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Andrew
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH net-next v2 0/3] net: stmmac: dwmac-qcom-ethqos: Improve error handling
2023-07-10 20:06 [PATCH net-next v2 0/3] net: stmmac: dwmac-qcom-ethqos: Improve error handling Andrew Halaney
` (2 preceding siblings ...)
2023-07-10 20:06 ` [PATCH net-next v2 3/3] net: stmmac: dwmac-qcom-ethqos: Log more errors in probe Andrew Halaney
@ 2023-07-12 9:20 ` patchwork-bot+netdevbpf
3 siblings, 0 replies; 7+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-07-12 9:20 UTC (permalink / raw)
To: Andrew Halaney
Cc: linux-kernel, linux-arm-kernel, linux-stm32, netdev,
mcoquelin.stm32, pabeni, kuba, edumazet, davem, joabreu,
alexandre.torgue, peppe.cavallaro, bhupesh.sharma, vkoul,
linux-arm-msm, andrew, simon.horman
Hello:
This series was applied to netdev/net-next.git (main)
by David S. Miller <davem@davemloft.net>:
On Mon, 10 Jul 2023 15:06:36 -0500 you wrote:
> This series includes some very minor quality of life patches in the
> error handling.
>
> I recently ran into a few issues where these patches would have made my
> life easier (messing with the devicetree, dependent driver of this
> failing, and incorrect kernel configs resulting in this driver not
> probing).
>
> [...]
Here is the summary with links:
- [net-next,v2,1/3] net: stmmac: dwmac-qcom-ethqos: Use of_get_phy_mode() over device_get_phy_mode()
https://git.kernel.org/netdev/net-next/c/a8aa20a64ef2
- [net-next,v2,2/3] net: stmmac: dwmac-qcom-ethqos: Use dev_err_probe()
https://git.kernel.org/netdev/net-next/c/b2f3d915b4fe
- [net-next,v2,3/3] net: stmmac: dwmac-qcom-ethqos: Log more errors in probe
https://git.kernel.org/netdev/net-next/c/27381e72a2db
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 7+ messages in thread