Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1674934
| From | Florian Fainelli <f.fainelli@gmail.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH NET V5 1/2] net: phy: Add phy loopback support in net phy framework |
| Date | 2017-06-26 18:50 +0200 |
| Message-ID | <tWFn3-4Lf-3@gated-at.bofh.it> (permalink) |
| References | <tWrk5-4f5-7@gated-at.bofh.it> <tWrk5-4f5-5@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On 06/25/2017 07:10 PM, Lin Yun Sheng wrote:
> This patch add set_loopback in phy_driver, which is used by Mac
> driver to enable or disable a phy. it also add a generic
> genphy_loopback function, which use BMCR loopback bit to enable
> or disable a phy.
>
> Signed-off-by: Lin Yun Sheng <linyunsheng@huawei.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
[snip]
> +int phy_loopback(struct phy_device *phydev, bool enable)
> +{
> + struct phy_driver *phydrv = to_phy_driver(phydev->mdio.dev.driver);
> + int ret = 0;
> +
> + mutex_lock(&phydev->lock);
> +
> + if (enable && phydev->loopback_enabled) {
> + ret = -EBUSY;
> + goto out;
> + }
> +
> + if (!enable && !phydev->loopback_enabled) {
> + ret = -EINVAL;
> + goto out;
> + }
I am not sure if it is necessary to treat that condition as an error,
but I guess why not.
--
Florian
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
[PATCH NET V5 1/2] net: phy: Add phy loopback support in net phy framework Lin Yun Sheng <linyunsheng@huawei.com> - 2017-06-26 03:50 +0200 Re: [PATCH NET V5 1/2] net: phy: Add phy loopback support in net phy framework Andrew Lunn <andrew@lunn.ch> - 2017-06-26 15:50 +0200 Re: [PATCH NET V5 1/2] net: phy: Add phy loopback support in net phy framework Florian Fainelli <f.fainelli@gmail.com> - 2017-06-26 18:50 +0200
csiph-web