Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3340d2aa authored by Sergei Shtylyov's avatar Sergei Shtylyov Committed by David S. Miller
Browse files

sh_eth: make 'link' field of 'struct sh_eth_private' *int*



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: default avatarSergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 3893b273
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -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;
@@ -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;
@@ -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)
@@ -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;

+1 −1
Original line number Diff line number Diff line
@@ -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;