@@ -116,7 +116,7 @@ enum {
116116
117117static int mt7987_2p5ge_phy_load_fw (struct phy_device * phydev )
118118{
119- struct mtk_i2p5ge_phy_priv * priv = phydev -> priv ;
119+ struct mtk_socphy_priv * priv = phydev -> priv ;
120120 struct device * dev = & phydev -> mdio .dev ;
121121 void __iomem * xbz_pcs_reg_base ;
122122 void __iomem * xbz_pma_rx_base ;
@@ -637,6 +637,14 @@ static int mt798x_2p5ge_phy_probe(struct phy_device *phydev)
637637 struct pinctrl * pinctrl ;
638638 int ret ;
639639
640+ priv = devm_kzalloc (& phydev -> mdio .dev , sizeof (struct mtk_socphy_priv ),
641+ GFP_KERNEL );
642+ if (!priv )
643+ return - ENOMEM ;
644+
645+ priv -> fw_loaded = false;
646+ phydev -> priv = priv ;
647+
640648 switch (phydev -> drv -> phy_id ) {
641649 case MTK_2P5GPHY_ID_MT7987 :
642650 case MTK_2P5GPHY_ID_MT7988 :
@@ -690,22 +698,23 @@ static int mt798x_2p5ge_phy_probe(struct phy_device *phydev)
690698 if (IS_ERR (pinctrl ))
691699 dev_err (& phydev -> mdio .dev , "Fail to set LED pins!\n" );
692700
693- priv = devm_kzalloc (& phydev -> mdio .dev , sizeof (struct mtk_socphy_priv ),
694- GFP_KERNEL );
695- if (!priv )
696- return - ENOMEM ;
697- phydev -> priv = priv ;
698-
699701 mtk_phy_leds_state_init (phydev );
700702
701703 return 0 ;
702704}
703705
706+ static void mt798x_2p5ge_phy_remove (struct phy_device * phydev )
707+ {
708+ struct mtk_i2p5ge_phy_priv * priv = phydev -> priv ;
709+ kfree (priv );
710+ }
711+
704712static struct phy_driver mtk_2p5gephy_driver [] = {
705713 {
706714 PHY_ID_MATCH_MODEL (MTK_2P5GPHY_ID_MT7987 ),
707715 .name = "MediaTek MT7987 2.5GbE PHY" ,
708716 .probe = mt798x_2p5ge_phy_probe ,
717+ .remove = mt798x_2p5ge_phy_remove ,
709718 .config_init = mt798x_2p5ge_phy_config_init ,
710719 .config_aneg = mt798x_2p5ge_phy_config_aneg ,
711720 .get_features = mt798x_2p5ge_phy_get_features ,
@@ -720,6 +729,7 @@ static struct phy_driver mtk_2p5gephy_driver[] = {
720729 PHY_ID_MATCH_MODEL (MTK_2P5GPHY_ID_MT7988 ),
721730 .name = "MediaTek MT7988 2.5GbE PHY" ,
722731 .probe = mt798x_2p5ge_phy_probe ,
732+ .remove = mt798x_2p5ge_phy_remove ,
723733 .config_init = mt798x_2p5ge_phy_config_init ,
724734 .config_aneg = mt798x_2p5ge_phy_config_aneg ,
725735 .get_features = mt798x_2p5ge_phy_get_features ,
0 commit comments