Skip to content

Commit

Permalink
sh_eth: make 'link' field of 'struct sh_eth_private' *int*
Browse files Browse the repository at this point in the history
The 'link' field of 'struct sh_eth_private' has type 'enum phy_state' while the
'link' field of 'struct phy_device' is merely *int* (having values 0 and 1) and
the former field gets assigned from the latter. Make the field match, getting
rid of incorrectly used PHY_DOWN value in assignments/comparisons.

Signed-off-by: Sergei Shtylyov <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
Sergei Shtylyov authored and davem330 committed Mar 31, 2013
1 parent 3893b27 commit 3340d2a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions drivers/net/ethernet/renesas/sh_eth.c
Original file line number Diff line number Diff line change
Expand Up @@ -1377,7 +1377,7 @@ static void sh_eth_adjust_link(struct net_device *ndev)
struct phy_device *phydev = mdp->phydev;
int new_state = 0;

if (phydev->link != PHY_DOWN) {
if (phydev->link) {
if (phydev->duplex != mdp->duplex) {
new_state = 1;
mdp->duplex = phydev->duplex;
Expand All @@ -1391,7 +1391,7 @@ static void sh_eth_adjust_link(struct net_device *ndev)
if (mdp->cd->set_rate)
mdp->cd->set_rate(ndev);
}
if (mdp->link == PHY_DOWN) {
if (!mdp->link) {
sh_eth_write(ndev,
(sh_eth_read(ndev, ECMR) & ~ECMR_TXF), ECMR);
new_state = 1;
Expand All @@ -1401,7 +1401,7 @@ static void sh_eth_adjust_link(struct net_device *ndev)
}
} else if (mdp->link) {
new_state = 1;
mdp->link = PHY_DOWN;
mdp->link = 0;
mdp->speed = 0;
mdp->duplex = -1;
if (mdp->cd->no_psr || mdp->no_ether_link)
Expand All @@ -1422,7 +1422,7 @@ static int sh_eth_phy_init(struct net_device *ndev)
snprintf(phy_id, sizeof(phy_id), PHY_ID_FMT,
mdp->mii_bus->id , mdp->phy_id);

mdp->link = PHY_DOWN;
mdp->link = 0;
mdp->speed = 0;
mdp->duplex = -1;

Expand Down
2 changes: 1 addition & 1 deletion drivers/net/ethernet/renesas/sh_eth.h
Original file line number Diff line number Diff line change
Expand Up @@ -723,7 +723,7 @@ struct sh_eth_private {
u32 phy_id; /* PHY ID */
struct mii_bus *mii_bus; /* MDIO bus control */
struct phy_device *phydev; /* PHY device control */
enum phy_state link;
int link;
phy_interface_t phy_interface;
int msg_enable;
int speed;
Expand Down

0 comments on commit 3340d2a

Please sign in to comment.