lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <cb1edacc-d85c-0f79-687f-88e4ce349f00@denx.de>
Date:   Fri, 11 Oct 2019 08:52:13 +0200
From:   Marek Vasut <marex@...x.de>
To:     Simon Horman <horms@...ge.net.au>
Cc:     netdev@...r.kernel.org, Andrew Lunn <andrew@...n.ch>,
        "David S . Miller" <davem@...emloft.net>,
        Florian Fainelli <f.fainelli@...il.com>,
        George McCollister <george.mccollister@...il.com>,
        Heiner Kallweit <hkallweit1@...il.com>,
        Tristram Ha <Tristram.Ha@...rochip.com>,
        Woojung Huh <woojung.huh@...rochip.com>
Subject: Re: [PATCH V2 1/2] net: phy: micrel: Discern KSZ8051 and KSZ8795 PHYs

On 10/11/19 7:57 AM, Simon Horman wrote:
[...]
>> +static int ksz8795_match_phy_device(struct phy_device *phydev)
>> +{
>> +	int ret;
>> +
>> +	if ((phydev->phy_id & MICREL_PHY_ID_MASK) != PHY_ID_KSZ8795)
>> +		return 0;
>> +
>> +	ret = phy_read(phydev, MII_BMSR);
>> +	if (ret < 0)
>> +		return ret;
>> +
>> +	/* See comment in ksz8051_match_phy_device() for details. */
>> +	return !(ret & BMSR_ERCAP);
>> +}
>> +
> 
> Hi Marek,
> 
> given the similarity between ksz8051_match_phy_device() and
> ksz8795_match_phy_device() I wonder if a common helper is appropriate.

Then one (or both) of them look like this:

static int ksz8795_match_phy_device(struct phy_device *phydev)
{
        int ret;

        /* See comment in ksz8051_match_phy_device() for details. */
        ret = ksz8051_match_phy_device(phydev);
        if (ret < 0)
                return ret;

        return !ret;
}

It's not that much better.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ