@@ -199,8 +199,6 @@ struct rtmdio_config {
199199};
200200
201201struct rtmdio_phy_info {
202- unsigned int phy_id ;
203- bool phy_unknown ;
204202 int mac_type ;
205203 bool has_giga_lite ;
206204 bool has_res_reg ;
@@ -604,10 +602,11 @@ static u32 rtmdio_get_phy_id(struct phy_device *phydev)
604602 return phydev -> phy_id ;
605603}
606604
607- static void rtmdio_get_phy_info (struct mii_bus * bus , int addr , struct rtmdio_phy_info * phyinfo )
605+ static int rtmdio_get_phy_info (struct mii_bus * bus , int addr , struct rtmdio_phy_info * phyinfo )
608606{
609607 struct phy_device * phydev = mdiobus_get_phy (bus , addr );
610608 u32 phyid = rtmdio_get_phy_id (phydev );
609+ int ret = 0 ;
611610
612611 /*
613612 * Depending on the attached PHY the polling mechanism must be fine tuned. Basically
@@ -641,9 +640,12 @@ static void rtmdio_get_phy_info(struct mii_bus *bus, int addr, struct rtmdio_phy
641640 phyinfo -> poll_lpa_1000 = RTMDIO_PHY_POLL_MMD (31 , 0xa414 , 11 );
642641 break ;
643642 default :
644- phyinfo -> phy_unknown = true;
643+ pr_warn ("skip polling setup for unknown PHY %08x on port %d\n" , phyid , addr );
644+ ret = - EINVAL ;
645645 break ;
646646 }
647+
648+ return ret ;
647649}
648650
649651static int rtmdio_838x_reset (struct mii_bus * bus )
@@ -721,12 +723,8 @@ static void rtmdio_930x_setup_polling(struct mii_bus *bus)
721723
722724 /* Define PHY specific polling parameters */
723725 for_each_port (ctrl , addr ) {
724- rtmdio_get_phy_info (bus , addr , & phyinfo );
725- if (phyinfo .phy_unknown ) {
726- pr_warn ("skip polling setup for unknown PHY %08x on port %d\n" ,
727- phyinfo .phy_id , addr );
726+ if (rtmdio_get_phy_info (bus , addr , & phyinfo ))
728727 continue ;
729- }
730728
731729 /* port MAC type */
732730 mask = addr > 23 ? 0x7 << ((addr - 24 ) * 3 + 12 ): 0x3 << ((addr / 4 ) * 2 );
@@ -806,12 +804,8 @@ static void rtmdio_931x_setup_polling(struct mii_bus *bus)
806804 int smi = ctrl -> smi_bus [addr ];
807805 unsigned int mask , val ;
808806
809- rtmdio_get_phy_info (bus , addr , & phyinfo );
810- if (phyinfo .phy_unknown ) {
811- pr_warn ("skip polling setup for unknown PHY %08x on port %d\n" ,
812- phyinfo .phy_id , addr );
807+ if (rtmdio_get_phy_info (bus , addr , & phyinfo ))
813808 continue ;
814- }
815809
816810 mask = val = 0 ;
817811
0 commit comments