Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1671679
| From | Andrew Lunn <andrew@lunn.ch> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH NET] net/hns:bugfix of ethtool -t phy self_test |
| Date | 2017-06-21 15:40 +0200 |
| Message-ID | <tUO1t-6FS-47@gated-at.bofh.it> (permalink) |
| References | (2 earlier) <tUhId-34p-3@gated-at.bofh.it> <tUroe-Jj-27@gated-at.bofh.it> <tUDfI-8jH-5@gated-at.bofh.it> <tUElr-C1-5@gated-at.bofh.it> <tUEOt-Lf-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
> drivers/net/ph/marvell.c
> marvell_set_loopback(struct phy_device *dev, bool enable)
> {
> /* do some device specific setting */
> ........
>
> return genphy_loopback(dev, enable);
> }
>
> I don't know if this makes sense or not?
Nope, you want something in phy.c like this. Not compiled, not
tested....
int phy_loopback(struct phy_device *dev, bool enable)
{
int err;
mutex_lock(dev->mutex);
if (enable && dev->loopback_enabled) {
err = -EBUSY;
goto out;
}
if (!enable && !dev->loopback_enabled) {
err = -EINVAL;
goto out;
}
if (dev->drv->loopback)
err = dev->drv->loopback(dev, enable);
if (!err)
dev->loopback_enabled = enable
mutex_unlock(dev->mutex);
out:
return err;
}
EXPORT_SYMBOL(phy_loopback);
The interesting part is how to handle two attempts to enable loopback.
Should the MAC driver be responsible for preventing that? Or do it in
the PHY driver? And what will the MAC driver do if it gets EBUSY?
Return it to user space?
Andrew
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Re: [PATCH NET] net/hns:bugfix of ethtool -t phy self_test l00371289 <linyunsheng@huawei.com> - 2017-06-20 05:10 +0200
Re: [PATCH NET] net/hns:bugfix of ethtool -t phy self_test Andrew Lunn <andrew@lunn.ch> - 2017-06-20 15:30 +0200
Re: [PATCH NET] net/hns:bugfix of ethtool -t phy self_test l00371289 <linyunsheng@huawei.com> - 2017-06-21 04:10 +0200
Re: [PATCH NET] net/hns:bugfix of ethtool -t phy self_test Andrew Lunn <andrew@lunn.ch> - 2017-06-21 05:20 +0200
Re: [PATCH NET] net/hns:bugfix of ethtool -t phy self_test l00371289 <linyunsheng@huawei.com> - 2017-06-21 05:50 +0200
Re: [PATCH NET] net/hns:bugfix of ethtool -t phy self_test Andrew Lunn <andrew@lunn.ch> - 2017-06-21 15:40 +0200
Re: [PATCH NET] net/hns:bugfix of ethtool -t phy self_test l00371289 <linyunsheng@huawei.com> - 2017-06-22 03:50 +0200
Re: [PATCH NET] net/hns:bugfix of ethtool -t phy self_test Andrew Lunn <andrew@lunn.ch> - 2017-06-22 05:40 +0200
Re: [PATCH NET] net/hns:bugfix of ethtool -t phy self_test l00371289 <linyunsheng@huawei.com> - 2017-06-22 06:00 +0200
csiph-web