return NULL;
}
+static struct mii_dev *miiphy_get_active_dev(const char *devname)
+{
+ /* If the current mii is the one we want, return it */
+ if (current_mii)
+ if (strcmp(current_mii->name, devname) == 0)
+ return current_mii;
+
+ /* Otherwise, set the active one to the one we want */
+ if (miiphy_set_current_dev(devname))
+ return NULL;
+ else
+ return current_mii;
+}
+
/*****************************************************************************
*
* Read to variable <value> from the PHY attached to device <devname>,
{
struct mii_dev *dev;
- dev = miiphy_get_dev_by_name(devname, 0);
+ dev = miiphy_get_active_dev(devname);
if (dev)
return dev->read(devname, addr, reg, value);
{
struct mii_dev *dev;
- dev = miiphy_get_dev_by_name(devname, 0);
+ dev = miiphy_get_active_dev(devname);
if (dev)
return dev->write(devname, addr, reg, value);