@@ -101,6 +101,7 @@ static struct class mdio_bus_class = {intmdiobus_register(structmii_bus*bus){inti,err;+u32phynum=0;if(NULL==bus||NULL==bus->name||NULL==bus->read||
@@ -134,12 +135,20 @@ int mdiobus_register(struct mii_bus *bus)if(IS_ERR(phydev)){err=PTR_ERR(phydev);gotoerror;+}elseif(phydev!=NULL){+phynum++;}}}+if(!phynum){+err=-ENODEV;+printk(KERN_ERR"%s: no phys found\n",bus->name);+gotoerror;+}
I am not sure if this is a good idea to change it, especially if:
- the MII bus probing is also done later (quite some drivers do this)
- if we want to attach a fixed PHY because we could not probe one at
registration time
@@ -101,6 +101,7 @@ static struct class mdio_bus_class = {intmdiobus_register(structmii_bus*bus){inti,err;+u32phynum=0;if(NULL==bus||NULL==bus->name||NULL==bus->read||
@@ -134,12 +135,20 @@ int mdiobus_register(struct mii_bus *bus)if(IS_ERR(phydev)){err=PTR_ERR(phydev);gotoerror;+}elseif(phydev!=NULL){+phynum++;}}}+if(!phynum){+err=-ENODEV;+printk(KERN_ERR"%s: no phys found\n",bus->name);+gotoerror;+}
I am not sure if this is a good idea to change it, especially if:
- the MII bus probing is also done later (quite some drivers do this)
- if we want to attach a fixed PHY because we could not probe one at
registration time
You're correct.
It seems keep it as before is the right solution right now.
Thanks for the info.
Regards
Dong Aisheng