netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Russell King (Oracle)" <rmk+kernel@armlinux.org.uk>
To: Florian Fainelli <f.fainelli@gmail.com>
Cc: Andrew Lunn <andrew@lunn.ch>,
	Vivien Didelot <vivien.didelot@gmail.com>,
	Vladimir Oltean <olteanv@gmail.com>,
	"David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>,
	netdev@vger.kernel.org
Subject: [PATCH RFC net-next 1/5] net: dsa: b53: clean up if() condition to be more readable
Date: Thu, 03 Feb 2022 14:48:20 +0000	[thread overview]
Message-ID: <E1nFdPI-006Wh0-HW@rmk-PC.armlinux.org.uk> (raw)
In-Reply-To: <YfvrIf/FDddglaKE@shell.armlinux.org.uk>

I've stared at this if() statement for a while trying to work out if
it really does correspond with the comment above, and it does seem to.
However, let's make it more readable and phrase it in the same way as
the comment.

Also add a FIXME into the comment - we appear to deny Gigabit modes for
802.3z interface modes, but 802.3z interface modes only operate at
gigabit and above.

Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
 drivers/net/dsa/b53/b53_common.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/net/dsa/b53/b53_common.c b/drivers/net/dsa/b53/b53_common.c
index a3b98992f180..7d62b0aeaae9 100644
--- a/drivers/net/dsa/b53/b53_common.c
+++ b/drivers/net/dsa/b53/b53_common.c
@@ -1327,11 +1327,14 @@ void b53_phylink_validate(struct dsa_switch *ds, int port,
 
 	/* With the exclusion of 5325/5365, MII, Reverse MII and 802.3z, we
 	 * support Gigabit, including Half duplex.
+	 *
+	 * FIXME: this is weird - 802.3z is always Gigabit, but we exclude
+	 * it here. Why? This makes no sense.
 	 */
-	if (state->interface != PHY_INTERFACE_MODE_MII &&
-	    state->interface != PHY_INTERFACE_MODE_REVMII &&
-	    !phy_interface_mode_is_8023z(state->interface) &&
-	    !(is5325(dev) || is5365(dev))) {
+	if (!(state->interface == PHY_INTERFACE_MODE_MII ||
+	      state->interface == PHY_INTERFACE_MODE_REVMII ||
+	      phy_interface_mode_is_8023z(state->interface) ||
+	      is5325(dev) || is5365(dev))) {
 		phylink_set(mask, 1000baseT_Full);
 		phylink_set(mask, 1000baseT_Half);
 	}
-- 
2.30.2


  reply	other threads:[~2022-02-03 14:48 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-03 14:48 [PATCH RFC net-next 0/5] net: dsa: b53: convert to phylink_generic_validate() and mark as non-legacy Russell King (Oracle)
2022-02-03 14:48 ` Russell King (Oracle) [this message]
2022-02-16 17:52   ` [PATCH RFC net-next 1/5] net: dsa: b53: clean up if() condition to be more readable Florian Fainelli
2022-02-03 14:48 ` [PATCH RFC net-next 2/5] net: dsa: b53: populate supported_interfaces and mac_capabilities Russell King (Oracle)
2022-02-16 19:51   ` Florian Fainelli
2022-02-17 10:17     ` Russell King (Oracle)
2022-02-03 14:48 ` [PATCH RFC net-next 3/5] net: dsa: b53: drop use of phylink_helper_basex_speed() Russell King (Oracle)
2022-02-03 14:48 ` [PATCH RFC net-next 4/5] net: dsa: b53: switch to using phylink_generic_validate() Russell King (Oracle)
2022-02-03 14:48 ` [PATCH RFC net-next 5/5] net: dsa: b53: mark as non-legacy Russell King (Oracle)
2022-02-03 17:30 ` [PATCH RFC net-next 1/5] net: dsa: b53: clean up if() condition to be more readable Russell King (Oracle)
2022-02-03 17:33   ` Russell King (Oracle)
2022-02-03 17:30 ` [PATCH RFC net-next 2/5] net: dsa: b53: populate supported_interfaces and mac_capabilities Russell King (Oracle)
2022-02-03 17:31 ` [PATCH RFC net-next 3/5] net: dsa: b53: drop use of phylink_helper_basex_speed() Russell King (Oracle)
2022-02-03 17:31 ` [PATCH RFC net-next 4/5] net: dsa: b53: switch to using phylink_generic_validate() Russell King (Oracle)
2022-02-03 17:31 ` [PATCH RFC net-next 5/5] net: dsa: b53: mark as non-legacy Russell King (Oracle)
2022-02-03 18:27 ` [PATCH RFC net-next 0/5] net: dsa: b53: convert to phylink_generic_validate() and " Florian Fainelli
2022-02-03 18:30   ` Russell King (Oracle)

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=E1nFdPI-006Wh0-HW@rmk-PC.armlinux.org.uk \
    --to=rmk+kernel@armlinux.org.uk \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=f.fainelli@gmail.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=olteanv@gmail.com \
    --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).