Netdev Archive on lore.kernel.org
 help / color / Atom feed
From: Marek Vasut <marex@denx.de>
To: Simon Horman <horms@verge.net.au>
Cc: netdev@vger.kernel.org, Andrew Lunn <andrew@lunn.ch>,
	"David S . Miller" <davem@davemloft.net>,
	Florian Fainelli <f.fainelli@gmail.com>,
	George McCollister <george.mccollister@gmail.com>,
	Heiner Kallweit <hkallweit1@gmail.com>,
	Tristram Ha <Tristram.Ha@microchip.com>,
	Woojung Huh <woojung.huh@microchip.com>
Subject: Re: [PATCH V2 1/2] net: phy: micrel: Discern KSZ8051 and KSZ8795 PHYs
Date: Fri, 11 Oct 2019 08:52:13 +0200
Message-ID: <cb1edacc-d85c-0f79-687f-88e4ce349f00@denx.de> (raw)
In-Reply-To: <20191011055707.stsk5dwwg7acfmnv@verge.net.au>

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.

  reply index

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-10 19:46 Marek Vasut
2019-10-10 19:46 ` [PATCH V2 2/2] net: phy: micrel: Update KSZ87xx PHY name Marek Vasut
2019-10-11  5:57 ` [PATCH V2 1/2] net: phy: micrel: Discern KSZ8051 and KSZ8795 PHYs Simon Horman
2019-10-11  6:52   ` Marek Vasut [this message]
2019-10-11  9:47     ` Simon Horman
2019-10-12 20:58 ` Heiner Kallweit
2019-10-12 21:22   ` Heiner Kallweit
2019-10-13 10:53     ` Marek Vasut

Reply instructions:

You may reply publically to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cb1edacc-d85c-0f79-687f-88e4ce349f00@denx.de \
    --to=marex@denx.de \
    --cc=Tristram.Ha@microchip.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=f.fainelli@gmail.com \
    --cc=george.mccollister@gmail.com \
    --cc=hkallweit1@gmail.com \
    --cc=horms@verge.net.au \
    --cc=netdev@vger.kernel.org \
    --cc=woojung.huh@microchip.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Netdev Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/netdev/0 netdev/git/0.git
	git clone --mirror https://lore.kernel.org/netdev/1 netdev/git/1.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 netdev netdev/ https://lore.kernel.org/netdev \
		netdev@vger.kernel.org
	public-inbox-index netdev

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.netdev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git