From: Corentin Labbe <clabbe.montjoie@gmail.com>
To: peppe.cavallaro@st.com, alexandre.torgue@st.com
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
Corentin Labbe <clabbe.montjoie@gmail.com>
Subject: [PATCH 3/8] net: stmmac: use SPEED_UNKNOWN/DUPLEX_UNKNOWN
Date: Tue, 14 Feb 2017 20:54:36 +0100 [thread overview]
Message-ID: <20170214195441.30425-4-clabbe.montjoie@gmail.com> (raw)
In-Reply-To: <20170214195441.30425-1-clabbe.montjoie@gmail.com>
It is better to use DUPLEX_UNKNOWN instead of just "-1".
Using 0 for an invalid speed is bad since 0 is a valid value for speed.
So this patch replace 0 by SPEED_UNKNOWN.
Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 511c47c..a87071d 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -754,8 +754,8 @@ static void stmmac_adjust_link(struct net_device *dev)
} else if (priv->oldlink) {
new_state = 1;
priv->oldlink = 0;
- priv->speed = 0;
- priv->oldduplex = -1;
+ priv->speed = SPEED_UNKNOWN;
+ priv->oldduplex = DUPLEX_UNKNOWN;
}
if (new_state && netif_msg_link(priv))
@@ -817,8 +817,8 @@ static int stmmac_init_phy(struct net_device *dev)
int interface = priv->plat->interface;
int max_speed = priv->plat->max_speed;
priv->oldlink = 0;
- priv->speed = 0;
- priv->oldduplex = -1;
+ priv->speed = SPEED_UNKNOWN;
+ priv->oldduplex = DUPLEX_UNKNOWN;
if (priv->plat->phy_node) {
phydev = of_phy_connect(dev, priv->plat->phy_node,
@@ -3434,8 +3434,8 @@ int stmmac_suspend(struct device *dev)
spin_unlock_irqrestore(&priv->lock, flags);
priv->oldlink = 0;
- priv->speed = 0;
- priv->oldduplex = -1;
+ priv->speed = SPEED_UNKNOWN;
+ priv->oldduplex = DUPLEX_UNKNOWN;
return 0;
}
EXPORT_SYMBOL_GPL(stmmac_suspend);
--
2.10.2
next prev parent reply other threads:[~2017-02-14 19:58 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-14 19:54 [PATCH 0/8] net: stmmac: misc patchs Corentin Labbe
2017-02-14 19:54 ` [PATCH 1/8] net: stmmac: remove useless parenthesis Corentin Labbe
2017-02-14 19:54 ` [PATCH 2/8] net: stmmac: likely is useless in occasional function Corentin Labbe
2017-02-14 19:54 ` Corentin Labbe [this message]
2017-02-14 19:54 ` [PATCH 4/8] net: stmmac: set speed at SPEED_UNKNOWN in case of broken speed Corentin Labbe
2017-02-14 19:54 ` [PATCH 5/8] net: stmmac: run stmmac_hw_fix_mac_speed when speed is valid Corentin Labbe
2017-02-14 19:54 ` [PATCH 6/8] net: stmmac: split the stmmac_adjust_link 10/100 case Corentin Labbe
2017-02-14 19:54 ` [PATCH 7/8] net: stmmac: reduce indentation by adding a continue Corentin Labbe
2017-02-14 19:54 ` [PATCH 8/8] net: stmmac: invert the logic for dumping regs Corentin Labbe
2017-02-15 6:34 ` [PATCH 0/8] net: stmmac: misc patchs Giuseppe CAVALLARO
2017-02-15 7:39 ` Corentin Labbe
2017-02-15 9:11 ` Giuseppe CAVALLARO
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170214195441.30425-4-clabbe.montjoie@gmail.com \
--to=clabbe.montjoie@gmail.com \
--cc=alexandre.torgue@st.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=peppe.cavallaro@st.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®