linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michael Walle <michael@walle.cc>
To: Andrew Lunn <andrew@lunn.ch>
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, 05 May 2020 16:20:57 +0200	[thread overview]
Message-ID: <7dcb92b092057d50b8f079fa8bf0bfeb@walle.cc> (raw)
In-Reply-To: <20200505130741.GD208718@lunn.ch>

Am 2020-05-05 15:07, schrieb Andrew Lunn:
>> +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.

Damn, this should really be a checkpatch.pl check ;) It was "int 
delay_ms;"
before, then it was changed to "unsigned int delay_ms;"..

> 
>> +	*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?

Mhh, this is actually wrong, it returns true if the length is
valid. I need to double check that. what about
at803x_cdt_fault_length_is_valid()

> Otherwise, this looks good.

I'll wait for your v3 and then I'll rebase on that.

-michael

  reply	other threads:[~2020-05-05 14:21 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
2020-05-05 14:20   ` Michael Walle [this message]
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=7dcb92b092057d50b8f079fa8bf0bfeb@walle.cc \
    --to=michael@walle.cc \
    --cc=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=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).