aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/phy/phy.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/phy/phy.c')
-rw-r--r--drivers/net/phy/phy.c23
1 files changed, 10 insertions, 13 deletions
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index 6b71b0034060..64be4664ccab 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -19,7 +19,6 @@
19#include <linux/string.h> 19#include <linux/string.h>
20#include <linux/errno.h> 20#include <linux/errno.h>
21#include <linux/unistd.h> 21#include <linux/unistd.h>
22#include <linux/slab.h>
23#include <linux/interrupt.h> 22#include <linux/interrupt.h>
24#include <linux/init.h> 23#include <linux/init.h>
25#include <linux/delay.h> 24#include <linux/delay.h>
@@ -254,12 +253,12 @@ int phy_ethtool_sset(struct phy_device *phydev, struct ethtool_cmd *cmd)
254 if (cmd->autoneg == AUTONEG_ENABLE && cmd->advertising == 0) 253 if (cmd->autoneg == AUTONEG_ENABLE && cmd->advertising == 0)
255 return -EINVAL; 254 return -EINVAL;
256 255
257 if (cmd->autoneg == AUTONEG_DISABLE 256 if (cmd->autoneg == AUTONEG_DISABLE &&
258 && ((cmd->speed != SPEED_1000 257 ((cmd->speed != SPEED_1000 &&
259 && cmd->speed != SPEED_100 258 cmd->speed != SPEED_100 &&
260 && cmd->speed != SPEED_10) 259 cmd->speed != SPEED_10) ||
261 || (cmd->duplex != DUPLEX_HALF 260 (cmd->duplex != DUPLEX_HALF &&
262 && cmd->duplex != DUPLEX_FULL))) 261 cmd->duplex != DUPLEX_FULL)))
263 return -EINVAL; 262 return -EINVAL;
264 263
265 phydev->autoneg = cmd->autoneg; 264 phydev->autoneg = cmd->autoneg;
@@ -353,9 +352,9 @@ int phy_mii_ioctl(struct phy_device *phydev,
353 352
354 phy_write(phydev, mii_data->reg_num, val); 353 phy_write(phydev, mii_data->reg_num, val);
355 354
356 if (mii_data->reg_num == MII_BMCR 355 if (mii_data->reg_num == MII_BMCR &&
357 && val & BMCR_RESET 356 val & BMCR_RESET &&
358 && phydev->drv->config_init) { 357 phydev->drv->config_init) {
359 phy_scan_fixups(phydev); 358 phy_scan_fixups(phydev);
360 phydev->drv->config_init(phydev); 359 phydev->drv->config_init(phydev);
361 } 360 }
@@ -410,7 +409,6 @@ EXPORT_SYMBOL(phy_start_aneg);
410 409
411 410
412static void phy_change(struct work_struct *work); 411static void phy_change(struct work_struct *work);
413static void phy_state_machine(struct work_struct *work);
414 412
415/** 413/**
416 * phy_start_machine - start PHY state machine tracking 414 * phy_start_machine - start PHY state machine tracking
@@ -430,7 +428,6 @@ void phy_start_machine(struct phy_device *phydev,
430{ 428{
431 phydev->adjust_state = handler; 429 phydev->adjust_state = handler;
432 430
433 INIT_DELAYED_WORK(&phydev->state_queue, phy_state_machine);
434 schedule_delayed_work(&phydev->state_queue, HZ); 431 schedule_delayed_work(&phydev->state_queue, HZ);
435} 432}
436 433
@@ -761,7 +758,7 @@ EXPORT_SYMBOL(phy_start);
761 * phy_state_machine - Handle the state machine 758 * phy_state_machine - Handle the state machine
762 * @work: work_struct that describes the work to be done 759 * @work: work_struct that describes the work to be done
763 */ 760 */
764static void phy_state_machine(struct work_struct *work) 761void phy_state_machine(struct work_struct *work)
765{ 762{
766 struct delayed_work *dwork = to_delayed_work(work); 763 struct delayed_work *dwork = to_delayed_work(work);
767 struct phy_device *phydev = 764 struct phy_device *phydev =