[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <c517e8a1-4f4f-897e-1ae5-9f60c6f19185@gmail.com>
Date: Mon, 26 Jun 2017 09:45:29 -0700
From: Florian Fainelli <f.fainelli@...il.com>
To: Lin Yun Sheng <linyunsheng@...wei.com>, davem@...emloft.net,
andrew@...n.ch
Cc: huangdaode@...ilicon.com, xuwei5@...ilicon.com,
liguozhu@...ilicon.com, Yisen.Zhuang@...wei.com,
gabriele.paoloni@...wei.com, john.garry@...wei.com,
linuxarm@...wei.com, salil.mehta@...wei.com, lipeng321@...wei.com,
tremyfr@...il.com, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH NET V5 1/2] net: phy: Add phy loopback support in net phy
framework
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@...wei.com>
Reviewed-by: Florian Fainelli <f.fainelli@...il.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
Powered by blists - more mailing lists