From: Andrew Lunn <andrew@lunn.ch>
To: Michael Walle <michael@walle.cc>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
Florian Fainelli <f.fainelli@gmail.com>,
Heiner Kallweit <hkallweit1@gmail.com>,
Russell King <linux@armlinux.org.uk>,
"David S . Miller" <davem@davemloft.net>
Subject: Re: [RFC net-next] net: phy: at803x: add cable diagnostics support
Date: Tue, 5 May 2020 15:07:41 +0200 [thread overview]
Message-ID: <20200505130741.GD208718@lunn.ch> (raw)
In-Reply-To: <20200503181517.4538-1-michael@walle.cc>
> +static int at803x_cable_test_get_status(struct phy_device *phydev,
> + bool *finished)
> +{
> + struct at803x_priv *priv = phydev->priv;
> + static const int ethtool_pair[] = {
> + ETHTOOL_A_CABLE_PAIR_0, ETHTOOL_A_CABLE_PAIR_1,
> + ETHTOOL_A_CABLE_PAIR_2, ETHTOOL_A_CABLE_PAIR_3};
If you put one per line, you will keep the reverse christmas tree, and
David will be happy.
> + int pair, val, ret;
> + unsigned int delay_ms;
Well, David will be happy if you move this as well.
> + *finished = false;
> +
> + if (priv->cdt_start) {
> + delay_ms = AT803X_CDT_DELAY_MS;
> + delay_ms -= jiffies_delta_to_msecs(jiffies - priv->cdt_start);
> + if (delay_ms > 0)
> + msleep(delay_ms);
> + }
> +
> + for (pair = 0; pair < 4; pair++) {
> + ret = at803x_cdt_start(phydev, pair);
> + if (ret)
> + return ret;
> +
> + ret = at803x_cdt_wait_for_completion(phydev);
> + if (ret)
> + return ret;
> +
> + val = phy_read(phydev, AT803X_CDT_STATUS);
> + if (val < 0)
> + return val;
> +
> + ethnl_cable_test_result(phydev, ethtool_pair[pair],
> + at803x_cdt_test_result(val));
> +
> + if (at803x_cdt_fault_length_valid(val))
> + continue;
The name is not very intuitive. It return false if it is valid?
Otherwise, this looks good.
Andrew
next prev parent reply other threads:[~2020-05-05 13:07 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-03 18:15 [RFC net-next] net: phy: at803x: add cable diagnostics support Michael Walle
2020-05-05 13:07 ` Andrew Lunn [this message]
2020-05-05 14:20 ` Michael Walle
2020-05-06 9:01 ` Matthias May
2020-05-06 10:15 ` Michael Walle
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=20200505130741.GD208718@lunn.ch \
--to=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=f.fainelli@gmail.com \
--cc=hkallweit1@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=michael@walle.cc \
--cc=netdev@vger.kernel.org \
/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).