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.