From: Vladimir Oltean <olteanv@gmail.com>
To: f.fainelli@gmail.com, vivien.didelot@gmail.com, andrew@lunn.ch,
davem@davemloft.net
Cc: netdev@vger.kernel.org, Vladimir Oltean <olteanv@gmail.com>
Subject: [PATCH net-next 1/4] net: dsa: sja1105: Use SPEED_{10,100,1000,UNKNOWN} macros
Date: Sat, 8 Jun 2019 16:03:41 +0300 [thread overview]
Message-ID: <20190608130344.661-2-olteanv@gmail.com> (raw)
In-Reply-To: <20190608130344.661-1-olteanv@gmail.com>
This is a cosmetic patch that replaces the link speed numbers used in
the driver with the corresponding ethtool macros.
Signed-off-by: Vladimir Oltean <olteanv@gmail.com>
Suggested-by: Andrew Lunn <andrew@lunn.ch>
---
drivers/net/dsa/sja1105/sja1105_main.c | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/drivers/net/dsa/sja1105/sja1105_main.c b/drivers/net/dsa/sja1105/sja1105_main.c
index 15bee785fd6d..580568922f35 100644
--- a/drivers/net/dsa/sja1105/sja1105_main.c
+++ b/drivers/net/dsa/sja1105/sja1105_main.c
@@ -689,12 +689,12 @@ static int sja1105_parse_dt(struct sja1105_private *priv,
return rc;
}
-/* Convert back and forth MAC speed from Mbps to SJA1105 encoding */
+/* Convert link speed from SJA1105 to ethtool encoding */
static int sja1105_speed[] = {
- [SJA1105_SPEED_AUTO] = 0,
- [SJA1105_SPEED_10MBPS] = 10,
- [SJA1105_SPEED_100MBPS] = 100,
- [SJA1105_SPEED_1000MBPS] = 1000,
+ [SJA1105_SPEED_AUTO] = SPEED_UNKNOWN,
+ [SJA1105_SPEED_10MBPS] = SPEED_10,
+ [SJA1105_SPEED_100MBPS] = SPEED_100,
+ [SJA1105_SPEED_1000MBPS] = SPEED_1000,
};
/* Set link speed and enable/disable traffic I/O in the MAC configuration
@@ -720,17 +720,17 @@ static int sja1105_adjust_port_config(struct sja1105_private *priv, int port,
mac = priv->static_config.tables[BLK_IDX_MAC_CONFIG].entries;
switch (speed_mbps) {
- case 0:
+ case SPEED_UNKNOWN:
/* No speed update requested */
speed = SJA1105_SPEED_AUTO;
break;
- case 10:
+ case SPEED_10:
speed = SJA1105_SPEED_10MBPS;
break;
- case 100:
+ case SPEED_100:
speed = SJA1105_SPEED_100MBPS;
break;
- case 1000:
+ case SPEED_1000:
speed = SJA1105_SPEED_1000MBPS;
break;
default:
@@ -786,7 +786,7 @@ static void sja1105_mac_config(struct dsa_switch *ds, int port,
struct sja1105_private *priv = ds->priv;
if (!state->link)
- sja1105_adjust_port_config(priv, port, 0, false);
+ sja1105_adjust_port_config(priv, port, SPEED_UNKNOWN, false);
else
sja1105_adjust_port_config(priv, port, state->speed, true);
}
@@ -1311,7 +1311,7 @@ static int sja1105_static_config_reload(struct sja1105_private *priv)
goto out;
for (i = 0; i < SJA1105_NUM_PORTS; i++) {
- bool enabled = (speed_mbps[i] != 0);
+ bool enabled = (speed_mbps[i] != SPEED_UNKNOWN);
if (i != dsa_upstream_port(priv->ds, i))
sja1105_bridge_stp_state_set(priv->ds, i, stp_state[i]);
--
2.17.1
next prev parent reply other threads:[~2019-06-08 13:03 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-08 13:03 [PATCH net-next 0/4] Rethink PHYLINK callbacks for SJA1105 DSA Vladimir Oltean
2019-06-08 13:03 ` Vladimir Oltean [this message]
2019-06-08 18:52 ` [PATCH net-next 1/4] net: dsa: sja1105: Use SPEED_{10,100,1000,UNKNOWN} macros Andrew Lunn
2019-06-09 2:52 ` Florian Fainelli
2019-06-08 13:03 ` [PATCH net-next 2/4] net: dsa: sja1105: Update some comments about PHYLIB Vladimir Oltean
2019-06-08 18:53 ` Andrew Lunn
2019-06-09 2:53 ` Florian Fainelli
2019-06-08 13:03 ` [PATCH net-next 3/4] net: dsa: sja1105: Export the sja1105_inhibit_tx function Vladimir Oltean
2019-06-08 18:54 ` Andrew Lunn
2019-06-09 2:54 ` Florian Fainelli
2019-06-08 13:03 ` [PATCH net-next 4/4] net: dsa: sja1105: Rethink the PHYLINK callbacks Vladimir Oltean
2019-06-08 18:57 ` Andrew Lunn
2019-06-09 2:55 ` Florian Fainelli
2019-06-10 2:59 ` [PATCH net-next 0/4] Rethink PHYLINK callbacks for SJA1105 DSA David Miller
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=20190608130344.661-2-olteanv@gmail.com \
--to=olteanv@gmail.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=f.fainelli@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=vivien.didelot@gmail.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;
as well as URLs for NNTP newsgroup(s).