diff mbox series

[v4,2/4] net: axienet: factor out phy_node in struct axienet_local

Message ID 20220321152515.287119-2-andy.chiu@sifive.com (mailing list archive)
State Changes Requested
Delegated to: Netdev Maintainers
Headers show
Series [v4,1/4] net: axienet: setup mdio unconditionally | expand

Checks

Context Check Description
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix success Link
netdev/cover_letter warning Series does not have a cover letter
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 2 this patch: 2
netdev/cc_maintainers warning 4 maintainers not CCed: linux-riscv@lists.infradead.org palmer@dabbelt.com linux-arm-kernel@lists.infradead.org paul.walmsley@sifive.com
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 2 this patch: 2
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 49 lines checked
netdev/kdoc success Errors and warnings before: 2 this patch: 2
netdev/source_inline success Was 0 now: 0
netdev/tree_selection success Guessing tree name failed - patch did not apply

Commit Message

Andy Chiu March 21, 2022, 3:25 p.m. UTC
the struct member `phy_node` of struct axienet_local is not used by the
driver anymore after initialization. It might be a remnent of old code
and could be removed.

Signed-off-by: Andy Chiu <andy.chiu@sifive.com>
Reviewed-by: Greentime Hu <greentime.hu@sifive.com>
---
 drivers/net/ethernet/xilinx/xilinx_axienet.h      |  2 --
 drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 13 +++++--------
 2 files changed, 5 insertions(+), 10 deletions(-)

Comments

Robert Hancock March 21, 2022, 6:09 p.m. UTC | #1
On Mon, 2022-03-21 at 23:25 +0800, Andy Chiu wrote:
> the struct member `phy_node` of struct axienet_local is not used by the
> driver anymore after initialization. It might be a remnent of old code
> and could be removed.
> 
> Signed-off-by: Andy Chiu <andy.chiu@sifive.com>
> Reviewed-by: Greentime Hu <greentime.hu@sifive.com>
> ---
>  drivers/net/ethernet/xilinx/xilinx_axienet.h      |  2 --
>  drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 13 +++++--------
>  2 files changed, 5 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet.h
> b/drivers/net/ethernet/xilinx/xilinx_axienet.h
> index 0f9c88dd1a4a..d5c1e5c4a508 100644
> --- a/drivers/net/ethernet/xilinx/xilinx_axienet.h
> +++ b/drivers/net/ethernet/xilinx/xilinx_axienet.h
> @@ -433,8 +433,6 @@ struct axienet_local {
>  	struct net_device *ndev;
>  	struct device *dev;
>  
> -	struct device_node *phy_node;
> -
>  	struct phylink *phylink;
>  	struct phylink_config phylink_config;
>  
> diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
> b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
> index 5d41b8de840a..496a9227e760 100644
> --- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
> +++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
> @@ -2071,19 +2071,21 @@ static int axienet_probe(struct platform_device
> *pdev)
>  
>  	if (lp->phy_mode == PHY_INTERFACE_MODE_SGMII ||
>  	    lp->phy_mode == PHY_INTERFACE_MODE_1000BASEX) {
> -		lp->phy_node = of_parse_phandle(pdev->dev.of_node, "phy-
> handle", 0);
> -		if (!lp->phy_node) {
> +		np = of_parse_phandle(pdev->dev.of_node, "phy-handle", 0);
> +		if (!np) {
>  			dev_err(&pdev->dev, "phy-handle required for
> 1000BaseX/SGMII\n");
>  			ret = -EINVAL;
>  			goto cleanup_mdio;
>  		}
> -		lp->pcs_phy = of_mdio_find_device(lp->phy_node);
> +		lp->pcs_phy = of_mdio_find_device(np);
>  		if (!lp->pcs_phy) {
>  			ret = -EPROBE_DEFER;
> +			of_node_put(np);
>  			goto cleanup_mdio;
>  		}
>  		lp->pcs.ops = &axienet_pcs_ops;
>  		lp->pcs.poll = true;
> +		of_node_put(np);
>  	}
>  
>  	lp->phylink_config.dev = &ndev->dev;
> @@ -2124,8 +2126,6 @@ static int axienet_probe(struct platform_device *pdev)
>  		put_device(&lp->pcs_phy->dev);
>  	if (lp->mii_bus)
>  		axienet_mdio_teardown(lp);
> -	of_node_put(lp->phy_node);
> -
>  cleanup_clk:
>  	clk_bulk_disable_unprepare(XAE_NUM_MISC_CLOCKS, lp->misc_clks);
>  	clk_disable_unprepare(lp->axi_clk);
> @@ -2154,9 +2154,6 @@ static int axienet_remove(struct platform_device *pdev)
>  	clk_bulk_disable_unprepare(XAE_NUM_MISC_CLOCKS, lp->misc_clks);
>  	clk_disable_unprepare(lp->axi_clk);
>  
> -	of_node_put(lp->phy_node);
> -	lp->phy_node = NULL;
> -
>  	free_netdev(ndev);
>  
>  	return 0;

Reviewed-by: Robert Hancock <robert.hancock@calian.com>
diff mbox series

Patch

diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet.h b/drivers/net/ethernet/xilinx/xilinx_axienet.h
index 0f9c88dd1a4a..d5c1e5c4a508 100644
--- a/drivers/net/ethernet/xilinx/xilinx_axienet.h
+++ b/drivers/net/ethernet/xilinx/xilinx_axienet.h
@@ -433,8 +433,6 @@  struct axienet_local {
 	struct net_device *ndev;
 	struct device *dev;
 
-	struct device_node *phy_node;
-
 	struct phylink *phylink;
 	struct phylink_config phylink_config;
 
diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
index 5d41b8de840a..496a9227e760 100644
--- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
+++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
@@ -2071,19 +2071,21 @@  static int axienet_probe(struct platform_device *pdev)
 
 	if (lp->phy_mode == PHY_INTERFACE_MODE_SGMII ||
 	    lp->phy_mode == PHY_INTERFACE_MODE_1000BASEX) {
-		lp->phy_node = of_parse_phandle(pdev->dev.of_node, "phy-handle", 0);
-		if (!lp->phy_node) {
+		np = of_parse_phandle(pdev->dev.of_node, "phy-handle", 0);
+		if (!np) {
 			dev_err(&pdev->dev, "phy-handle required for 1000BaseX/SGMII\n");
 			ret = -EINVAL;
 			goto cleanup_mdio;
 		}
-		lp->pcs_phy = of_mdio_find_device(lp->phy_node);
+		lp->pcs_phy = of_mdio_find_device(np);
 		if (!lp->pcs_phy) {
 			ret = -EPROBE_DEFER;
+			of_node_put(np);
 			goto cleanup_mdio;
 		}
 		lp->pcs.ops = &axienet_pcs_ops;
 		lp->pcs.poll = true;
+		of_node_put(np);
 	}
 
 	lp->phylink_config.dev = &ndev->dev;
@@ -2124,8 +2126,6 @@  static int axienet_probe(struct platform_device *pdev)
 		put_device(&lp->pcs_phy->dev);
 	if (lp->mii_bus)
 		axienet_mdio_teardown(lp);
-	of_node_put(lp->phy_node);
-
 cleanup_clk:
 	clk_bulk_disable_unprepare(XAE_NUM_MISC_CLOCKS, lp->misc_clks);
 	clk_disable_unprepare(lp->axi_clk);
@@ -2154,9 +2154,6 @@  static int axienet_remove(struct platform_device *pdev)
 	clk_bulk_disable_unprepare(XAE_NUM_MISC_CLOCKS, lp->misc_clks);
 	clk_disable_unprepare(lp->axi_clk);
 
-	of_node_put(lp->phy_node);
-	lp->phy_node = NULL;
-
 	free_netdev(ndev);
 
 	return 0;