mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
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 6/8] net: stmmac: split the stmmac_adjust_link 10/100 case
Date: Tue, 14 Feb 2017 20:54:39 +0100	[thread overview]
Message-ID: <20170214195441.30425-7-clabbe.montjoie@gmail.com> (raw)
In-Reply-To: <20170214195441.30425-1-clabbe.montjoie@gmail.com>

The 10/100 case have too many ifcase.
This patch split it for removing an if.

Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index bebe810..3cbe096 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -721,15 +721,19 @@ static void stmmac_adjust_link(struct net_device *dev)
 					ctrl &= ~priv->hw->link.port;
 				break;
 			case 100:
+				if (priv->plat->has_gmac ||
+				    priv->plat->has_gmac4) {
+					ctrl |= priv->hw->link.port;
+					ctrl |= priv->hw->link.speed;
+				} else {
+					ctrl &= ~priv->hw->link.port;
+				}
+				break;
 			case 10:
 				if (priv->plat->has_gmac ||
 				    priv->plat->has_gmac4) {
 					ctrl |= priv->hw->link.port;
-					if (phydev->speed == SPEED_100) {
-						ctrl |= priv->hw->link.speed;
-					} else {
-						ctrl &= ~(priv->hw->link.speed);
-					}
+					ctrl &= ~(priv->hw->link.speed);
 				} else {
 					ctrl &= ~priv->hw->link.port;
 				}
-- 
2.10.2

  parent reply	other threads:[~2017-02-14 19:57 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 ` [PATCH 3/8] net: stmmac: use SPEED_UNKNOWN/DUPLEX_UNKNOWN Corentin Labbe
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 ` Corentin Labbe [this message]
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-7-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®