Netdev List
 help / color / mirror / Atom feed
From: David Laight <david.laight.linux@gmail.com>
To: Wei Fang <wei.fang@nxp.com>
Cc: Greg Ungerer <gerg@kernel.org>,
	"linux-m68k@lists.linux-m68k.org"
	<linux-m68k@lists.linux-m68k.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"arnd@kernel.org" <arnd@kernel.org>,
	Greg Ungerer <gerg@linux-m68k.org>, Frank Li <frank.li@nxp.com>,
	Shenwei Wang <shenwei.wang@nxp.com>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>
Subject: Re: [RFC 1/4] net: fec: do not use readl()/writel() for ColdFire
Date: Fri, 8 May 2026 09:40:43 +0100	[thread overview]
Message-ID: <20260508094043.20f5f3fc@pumpkin> (raw)
In-Reply-To: <DBBPR04MB750044F98B1E719AD9DBD93E883D2@DBBPR04MB7500.eurprd04.prod.outlook.com>

On Fri, 8 May 2026 02:46:38 +0000
Wei Fang <wei.fang@nxp.com> wrote:

> >  static void
> >  fec_stop(struct net_device *ndev)
> >  {
> >  	struct fec_enet_private *fep = netdev_priv(ndev);
> > -	u32 rmii_mode = readl(fep->hwp + FEC_R_CNTRL) & FEC_RCR_RMII;
> > +	u32 rmii_mode = fec_readl(fep->hwp + FEC_R_CNTRL) & FEC_RCR_RMII;  
> 
> This is not an issue, but since you changed this line, the new code should
> follow the "reverse xmas tree" style.

Looking rmii_mode isn't even used until much later in the function.
(and then not very often)
Much better to read it just before it is needed.

	David


> 
> See: https://elixir.bootlin.com/linux/v7.0.1/source/Documentation/process/maintainer-netdev.rst#L380
> 
> >  	u32 val;
> > 
> >  	/* We cannot expect a graceful transmit stop without link !!! */
> >  	if (fep->link) {
> > -		writel(1, fep->hwp + FEC_X_CNTRL); /* Graceful transmit stop */
> > +		fec_writel(1, fep->hwp + FEC_X_CNTRL); /* Graceful transmit stop */
> >  		udelay(10);
> > -		if (!(readl(fep->hwp + FEC_IEVENT) & FEC_ENET_GRA))
> > +		if (!(fec_readl(fep->hwp + FEC_IEVENT) & FEC_ENET_GRA))
> >  			netdev_err(ndev, "Graceful transmit stop did not complete!\n");
> >  	}
> >   
> 
> 


  reply	other threads:[~2026-05-08  8:40 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-06 14:26 [RFC 1/4] net: fec: do not use readl()/writel() for ColdFire Greg Ungerer
2026-05-06 14:26 ` [RFC 2/4] net: smc91x: do not use readw()/writew() on ColdFire platforms Greg Ungerer
2026-05-08  2:46 ` [RFC 1/4] net: fec: do not use readl()/writel() for ColdFire Wei Fang
2026-05-08  8:40   ` David Laight [this message]
2026-05-08 13:14     ` Greg Ungerer
2026-05-08 13:11   ` Greg Ungerer

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=20260508094043.20f5f3fc@pumpkin \
    --to=david.laight.linux@gmail.com \
    --cc=arnd@kernel.org \
    --cc=frank.li@nxp.com \
    --cc=gerg@kernel.org \
    --cc=gerg@linux-m68k.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-m68k@lists.linux-m68k.org \
    --cc=netdev@vger.kernel.org \
    --cc=shenwei.wang@nxp.com \
    --cc=wei.fang@nxp.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