linux-sh.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
To: netdev@vger.kernel.org
Cc: linux-sh@vger.kernel.org
Subject: [PATCH 1/2] ravb: stop reading ECMR in ravb_emac_init()
Date: Sun, 10 Jan 2016 21:27:38 +0000	[thread overview]
Message-ID: <1554972.rhPQTyRgNp@wasted.cogentembedded.com> (raw)
In-Reply-To: <5859243.yu8qorLmay@wasted.cogentembedded.com>

The code in ravb_emac_init() twiddling the ECMR bits always looked a bit
strange to me: if one intends to respect 'priv->duplex', why save old value
of the ECMR.DM bit?   As all the other bits are zeroed anyway, we don't
really need to read ECMR before writing to it.

Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>

---
 drivers/net/ethernet/renesas/ravb_main.c |    7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

Index: net/drivers/net/ethernet/renesas/ravb_main.c
=================================--- net.orig/drivers/net/ethernet/renesas/ravb_main.c
+++ net/drivers/net/ethernet/renesas/ravb_main.c
@@ -338,16 +338,13 @@ error:
 static void ravb_emac_init(struct net_device *ndev)
 {
 	struct ravb_private *priv = netdev_priv(ndev);
-	u32 ecmr;
 
 	/* Receive frame limit set register */
 	ravb_write(ndev, ndev->mtu + ETH_HLEN + VLAN_HLEN + ETH_FCS_LEN, RFLR);
 
 	/* PAUSE prohibition */
-	ecmr =  ravb_read(ndev, ECMR);
-	ecmr &= ECMR_DM;
-	ecmr |= ECMR_ZPF | (priv->duplex ? ECMR_DM : 0) | ECMR_TE | ECMR_RE;
-	ravb_write(ndev, ecmr, ECMR);
+	ravb_write(ndev, ECMR_ZPF | (priv->duplex ? ECMR_DM : 0) |
+		   ECMR_TE | ECMR_RE, ECMR);
 
 	ravb_set_rate(ndev);
 


  reply	other threads:[~2016-01-10 21:27 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-10 21:26 [PATCH 0/2] Fix some dubious code in the Renesas Ethernet drivers Sergei Shtylyov
2016-01-10 21:27 ` Sergei Shtylyov [this message]
2016-01-11  9:45   ` [PATCH 1/2] ravb: stop reading ECMR in ravb_emac_init() Geert Uytterhoeven
2016-01-11 11:11     ` Sergei Shtylyov
2016-01-10 21:28 ` [PATCH 2/2] sh_eth: stop reading ECMR in sh_eth_dev_init() Sergei Shtylyov
2016-01-11 22:31 ` [PATCH 0/2] Fix some dubious code in the Renesas Ethernet drivers David Miller

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=1554972.rhPQTyRgNp@wasted.cogentembedded.com \
    --to=sergei.shtylyov@cogentembedded.com \
    --cc=linux-sh@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /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).