netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Russell King - ARM Linux admin <linux@armlinux.org.uk>
To: Peter Geis <pgwipeout@gmail.com>
Cc: Andrew Lunn <andrew@lunn.ch>,
	Heiner Kallweit <hkallweit1@gmail.com>,
	"David S . Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>,
	linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
	linux-rockchip@lists.infradead.org
Subject: Re: [PATCH] net: phy: add driver for Motorcomm yt8511 phy
Date: Tue, 11 May 2021 22:56:44 +0100	[thread overview]
Message-ID: <20210511215644.GO1336@shell.armlinux.org.uk> (raw)
In-Reply-To: <20210511214605.2937099-1-pgwipeout@gmail.com>

Hi,

On Tue, May 11, 2021 at 05:46:06PM -0400, Peter Geis wrote:
> +static int yt8511_config_init(struct phy_device *phydev)
> +{
> +	int ret, val, oldpage;
> +
> +	/* set clock mode to 125mhz */
> +	oldpage = phy_select_page(phydev, YT8511_EXT_CLK_GATE);
> +	if (oldpage < 0)
> +		goto err_restore_page;
> +
> +	val = __phy_read(phydev, YT8511_PAGE);
> +	val |= (YT8511_CLK_125M);
> +	ret = __phy_write(phydev, YT8511_PAGE, val);

Please consider __phy_modify(), and handle any error it returns.

> +
> +	/* disable auto sleep */
> +	ret = __phy_write(phydev, YT8511_PAGE_SELECT, YT8511_EXT_SLEEP_CTRL);

Please consider handling a failure to write here.

> +	val = __phy_read(phydev, YT8511_PAGE);
> +	val &= (~BIT(15));
> +	ret = __phy_write(phydev, YT8511_PAGE, val);

Also a use for __phy_modify().

> +
> +err_restore_page:
> +	return phy_restore_page(phydev, oldpage, ret);
> +}
> +
> +static struct phy_driver motorcomm_phy_drvs[] = {
> +	{
> +		PHY_ID_MATCH_EXACT(PHY_ID_YT8511),
> +		.name		= "YT8511 Gigabit Ethernet",
> +		.config_init	= &yt8511_config_init,

Please drop the '&' here, it's unnecessary.

Thanks.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!

  reply	other threads:[~2021-05-11 21:56 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-11 21:46 [PATCH] net: phy: add driver for Motorcomm yt8511 phy Peter Geis
2021-05-11 21:56 ` Russell King - ARM Linux admin [this message]
2021-05-11 22:56   ` Peter Geis
2021-05-18  8:59 ` Leon Romanovsky
2021-05-19  0:20   ` Peter Geis
2021-05-19  8:18     ` Leon Romanovsky
2021-05-19 10:37       ` Heiner Kallweit
2021-05-19 11:50         ` Leon Romanovsky
2021-05-19 12:45           ` Peter Geis
2021-05-19 12:56             ` Leon Romanovsky
2021-05-19 13:15               ` Russell King (Oracle)
2021-05-19 13:25                 ` Peter Geis

Reply instructions:

You may reply publicly 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=20210511215644.GO1336@shell.armlinux.org.uk \
    --to=linux@armlinux.org.uk \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=hkallweit1@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=netdev@vger.kernel.org \
    --cc=pgwipeout@gmail.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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).