Linux Renesas SOC kernel development
 help / color / mirror / Atom feed
From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
To: netdev@vger.kernel.org, "David S. Miller" <davem@davemloft.net>
Cc: linux-renesas-soc@vger.kernel.org
Subject: [PATCH 4/5] sh_eth: make sh_eth_tsu_write_entry() take 'offset' parameter
Date: Mon, 23 Jul 2018 21:14:38 +0300	[thread overview]
Message-ID: <1b60d8c8-e06f-6bff-df06-9b1cbe953340@cogentembedded.com> (raw)
In-Reply-To: <24093fd0-1b9b-a211-f988-0272483185d6@cogentembedded.com>

We can add the TSU register base address to a TSU register offset right
in sh_eth_tsu_write_entry(),  no need to do it in its callers...

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

---
 drivers/net/ethernet/renesas/sh_eth.c |   15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

Index: net-next/drivers/net/ethernet/renesas/sh_eth.c
===================================================================
--- net-next.orig/drivers/net/ethernet/renesas/sh_eth.c
+++ net-next/drivers/net/ethernet/renesas/sh_eth.c
@@ -2676,18 +2676,19 @@ static int sh_eth_tsu_busy(struct net_de
 	return 0;
 }
 
-static int sh_eth_tsu_write_entry(struct net_device *ndev, void *reg,
+static int sh_eth_tsu_write_entry(struct net_device *ndev, u16 offset,
 				  const u8 *addr)
 {
+	struct sh_eth_private *mdp = netdev_priv(ndev);
 	u32 val;
 
 	val = addr[0] << 24 | addr[1] << 16 | addr[2] << 8 | addr[3];
-	iowrite32(val, reg);
+	iowrite32(val, mdp->tsu_addr + offset);
 	if (sh_eth_tsu_busy(ndev) < 0)
 		return -EBUSY;
 
 	val = addr[4] << 8 | addr[5];
-	iowrite32(val, reg + 4);
+	iowrite32(val, mdp->tsu_addr + offset + 4);
 	if (sh_eth_tsu_busy(ndev) < 0)
 		return -EBUSY;
 
@@ -2747,9 +2748,7 @@ static int sh_eth_tsu_disable_cam_entry_
 			 ~(1 << (31 - entry)), TSU_TEN);
 
 	memset(blank, 0, sizeof(blank));
-	ret = sh_eth_tsu_write_entry(ndev,
-				     mdp->tsu_addr + reg_offset + entry * 8,
-				     blank);
+	ret = sh_eth_tsu_write_entry(ndev, reg_offset + entry * 8, blank);
 	if (ret < 0)
 		return ret;
 	return 0;
@@ -2770,9 +2769,7 @@ static int sh_eth_tsu_add_entry(struct n
 		i = sh_eth_tsu_find_empty(ndev);
 		if (i < 0)
 			return -ENOMEM;
-		ret = sh_eth_tsu_write_entry(ndev,
-					     mdp->tsu_addr + reg_offset + i * 8,
-					     addr);
+		ret = sh_eth_tsu_write_entry(ndev, reg_offset + i * 8, addr);
 		if (ret < 0)
 			return ret;
 

  parent reply	other threads:[~2018-07-23 19:17 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-23 18:08 [PATCH 0/5] sh_eth: clean up the TSU register accessors Sergei Shtylyov
2018-07-23 18:10 ` [PATCH 1/5] sh_eth: uninline sh_eth_tsu_get_offset() Sergei Shtylyov
2018-07-24  6:46   ` Geert Uytterhoeven
2018-07-23 18:11 ` [PATCH 2/5] sh_eth: make sh_eth_tsu_get_offset() match its name Sergei Shtylyov
2018-07-24  6:48   ` Geert Uytterhoeven
2018-07-23 18:12 ` [PATCH 3/5] sh_eth: call sh_eth_tsu_get_offset() from TSU register accessors Sergei Shtylyov
2018-07-24  6:49   ` Geert Uytterhoeven
2018-07-23 18:14 ` Sergei Shtylyov [this message]
2018-07-24  6:50   ` [PATCH 4/5] sh_eth: make sh_eth_tsu_write_entry() take 'offset' parameter Geert Uytterhoeven
2018-07-23 18:15 ` [PATCH 5/5] sh_eth: make sh_eth_tsu_{read|write}_entry() prototypes symmetric Sergei Shtylyov
2018-07-24  6:52   ` Geert Uytterhoeven
2018-07-23 19:35 ` [PATCH 0/5] sh_eth: clean up the TSU register accessors 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=1b60d8c8-e06f-6bff-df06-9b1cbe953340@cogentembedded.com \
    --to=sergei.shtylyov@cogentembedded.com \
    --cc=davem@davemloft.net \
    --cc=linux-renesas-soc@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