lkml.org 
[lkml]   [2017]   [Jun]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH NET 1/2] net: phy: Add phy loopback support in net phy framework
> +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

\
 
 \ /
  Last update: 2017-06-23 05:17    [W:0.045 / U:0.464 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site