Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1673190

Re: [PATCH NET 1/2] net: phy: Add phy loopback support in net phy framework

From Andrew Lunn <andrew@lunn.ch>
Newsgroups linux.kernel
Subject Re: [PATCH NET 1/2] net: phy: Add phy loopback support in net phy framework
Date 2017-06-23 05:20 +0200
Message-ID <tVnix-5cE-7@gated-at.bofh.it> (permalink)
References <tV5EZ-26c-9@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


> +int genphy_loopback(struct phy_device *phydev, bool enable)
> +{
> +	int value;
> +
> +	if (enable) {
> +		value = phy_read(phydev, MII_BMCR);
> +		phy_write(phydev, MII_BMCR, value | BMCR_LOOPBACK);
> +	} else {
> +		value = phy_read(phydev, MII_BMCR);
> +		phy_write(phydev, MII_BMCR, value & ~BMCR_LOOPBACK);
> +	}

You should add error checking here. Both phy_read and phy_write can
return an error. Also, do the read and write once.

> +
> +	return 0;
> +}
> +EXPORT_SYMBOL(genphy_loopback);
> +
> +static int gen10g_loopback(struct phy_device *phydev, bool enable)
> +{
> +	return 0;
> +}

This is pointless. The core code in phy.c should first check if the
function exists before calling it. So not having a 10g method is fine.

	 Andrew

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH NET 1/2] net: phy: Add phy loopback support in net phy framework Lin Yun Sheng <linyunsheng@huawei.com> - 2017-06-22 10:30 +0200
  Re: [PATCH NET 1/2] net: phy: Add phy loopback support in net phy  framework Andrew Lunn <andrew@lunn.ch> - 2017-06-23 05:20 +0200
    Re: [PATCH NET 1/2] net: phy: Add phy loopback support in net phy  framework Yunsheng Lin <linyunsheng@huawei.com> - 2017-06-23 06:00 +0200

csiph-web