]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/net/phy/phy.c
cxgb3: Fix kernel crash caused by uninitialized l2t_entry.arpq
[linux-2.6-omap-h63xx.git] / drivers / net / phy / phy.c
index 45cc2914d3475d1f12db6749890158087f7ab6ca..df4e6257d4a77e3e9bba739db57dec8543315d79 100644 (file)
@@ -57,55 +57,6 @@ void phy_print_status(struct phy_device *phydev)
 EXPORT_SYMBOL(phy_print_status);
 
 
-/**
- * phy_read - Convenience function for reading a given PHY register
- * @phydev: the phy_device struct
- * @regnum: register number to read
- *
- * NOTE: MUST NOT be called from interrupt context,
- * because the bus read/write functions may wait for an interrupt
- * to conclude the operation.
- */
-int phy_read(struct phy_device *phydev, u16 regnum)
-{
-       int retval;
-       struct mii_bus *bus = phydev->bus;
-
-       BUG_ON(in_interrupt());
-
-       mutex_lock(&bus->mdio_lock);
-       retval = bus->read(bus, phydev->addr, regnum);
-       mutex_unlock(&bus->mdio_lock);
-
-       return retval;
-}
-EXPORT_SYMBOL(phy_read);
-
-/**
- * phy_write - Convenience function for writing a given PHY register
- * @phydev: the phy_device struct
- * @regnum: register number to write
- * @val: value to write to @regnum
- *
- * NOTE: MUST NOT be called from interrupt context,
- * because the bus read/write functions may wait for an interrupt
- * to conclude the operation.
- */
-int phy_write(struct phy_device *phydev, u16 regnum, u16 val)
-{
-       int err;
-       struct mii_bus *bus = phydev->bus;
-
-       BUG_ON(in_interrupt());
-
-       mutex_lock(&bus->mdio_lock);
-       err = bus->write(bus, phydev->addr, regnum, val);
-       mutex_unlock(&bus->mdio_lock);
-
-       return err;
-}
-EXPORT_SYMBOL(phy_write);
-
 /**
  * phy_clear_interrupt - Ack the phy device's interrupt
  * @phydev: the phy_device struct
@@ -366,7 +317,8 @@ int phy_mii_ioctl(struct phy_device *phydev,
        switch (cmd) {
        case SIOCGMIIPHY:
                mii_data->phy_id = phydev->addr;
-               break;
+               /* fall through */
+
        case SIOCGMIIREG:
                mii_data->val_out = phy_read(phydev, mii_data->reg_num);
                break;
@@ -413,7 +365,7 @@ int phy_mii_ioctl(struct phy_device *phydev,
                break;
 
        default:
-               return -ENOTTY;
+               return -EOPNOTSUPP;
        }
 
        return 0;
@@ -728,6 +680,12 @@ static void phy_change(struct work_struct *work)
        if (err)
                goto irq_enable_err;
 
+       /* Stop timer and run the state queue now.  The work function for
+        * state_queue will start the timer up again.
+        */
+       del_timer(&phydev->phy_timer);
+       schedule_work(&phydev->state_queue);
+
        return;
 
 irq_enable_err: