All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marek Vasut <marek.vasut@gmail.com>
To: u-boot@lists.denx.de
Subject: [PATCH 06/10] net: rtl8139: Pass private data into rtl8139_eeprom_delay()
Date: Sat,  9 May 2020 22:34:40 +0200	[thread overview]
Message-ID: <20200509203444.821733-6-marek.vasut+renesas@gmail.com> (raw)
In-Reply-To: <20200509203444.821733-1-marek.vasut+renesas@gmail.com>

Instead of always calling rtl8139_eeprom_delay() with priv->ioaddr,
call it with priv and let the function access priv->ioaddr. This
reduces code duplication and has no impact, since the compiler will
inline this as needed anyway.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Joe Hershberger <joe.hershberger@ni.com>
---
 drivers/net/rtl8139.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/net/rtl8139.c b/drivers/net/rtl8139.c
index 1c83d1d426..679cafc6c8 100644
--- a/drivers/net/rtl8139.c
+++ b/drivers/net/rtl8139.c
@@ -217,13 +217,13 @@ static unsigned char rx_ring[RX_BUF_LEN + 16] __aligned(4);
 #define EE_READ_CMD	6
 #define EE_ERASE_CMD	7
 
-static void rtl8139_eeprom_delay(uintptr_t regbase)
+static void rtl8139_eeprom_delay(struct rtl8139_priv *priv)
 {
 	/*
 	 * Delay between EEPROM clock transitions.
 	 * No extra delay is needed with 33MHz PCI, but 66MHz may change this.
 	 */
-	inl(regbase + RTL_REG_CFG9346);
+	inl(priv->ioaddr + RTL_REG_CFG9346);
 }
 
 static int rtl8139_read_eeprom(struct rtl8139_priv *priv,
@@ -237,32 +237,32 @@ static int rtl8139_read_eeprom(struct rtl8139_priv *priv,
 
 	outb(EE_ENB & ~EE_CS, ee_addr);
 	outb(EE_ENB, ee_addr);
-	rtl8139_eeprom_delay(priv->ioaddr);
+	rtl8139_eeprom_delay(priv);
 
 	/* Shift the read command bits out. */
 	for (i = 4 + addr_len; i >= 0; i--) {
 		dataval = (read_cmd & BIT(i)) ? EE_DATA_WRITE : 0;
 		outb(EE_ENB | dataval, ee_addr);
-		rtl8139_eeprom_delay(priv->ioaddr);
+		rtl8139_eeprom_delay(priv);
 		outb(EE_ENB | dataval | EE_SHIFT_CLK, ee_addr);
-		rtl8139_eeprom_delay(priv->ioaddr);
+		rtl8139_eeprom_delay(priv);
 	}
 
 	outb(EE_ENB, ee_addr);
-	rtl8139_eeprom_delay(priv->ioaddr);
+	rtl8139_eeprom_delay(priv);
 
 	for (i = 16; i > 0; i--) {
 		outb(EE_ENB | EE_SHIFT_CLK, ee_addr);
-		rtl8139_eeprom_delay(priv->ioaddr);
+		rtl8139_eeprom_delay(priv);
 		retval <<= 1;
 		retval |= inb(ee_addr) & EE_DATA_READ;
 		outb(EE_ENB, ee_addr);
-		rtl8139_eeprom_delay(priv->ioaddr);
+		rtl8139_eeprom_delay(priv);
 	}
 
 	/* Terminate the EEPROM access. */
 	outb(~EE_CS, ee_addr);
-	rtl8139_eeprom_delay(priv->ioaddr);
+	rtl8139_eeprom_delay(priv);
 
 	return retval;
 }
-- 
2.25.1

  parent reply	other threads:[~2020-05-09 20:34 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-09 20:34 [PATCH 01/10] net: rtl8139: Factor out device name assignment Marek Vasut
2020-05-09 20:34 ` [PATCH 02/10] net: rtl8139: Switch from malloc()+memset() to calloc() Marek Vasut
2020-06-12 21:16   ` Tom Rini
2020-05-09 20:34 ` [PATCH 03/10] net: rtl8139: Use dev->iobase instead of custom ioaddr Marek Vasut
2020-06-12 21:16   ` Tom Rini
2020-05-09 20:34 ` [PATCH 04/10] net: rtl8139: Clean up bus_to_phys()/phys_to_bus() macros Marek Vasut
2020-06-12 21:16   ` Tom Rini
2020-05-09 20:34 ` [PATCH 05/10] net: rtl8139: Introduce device private data Marek Vasut
2020-06-12 21:16   ` Tom Rini
2020-05-09 20:34 ` Marek Vasut [this message]
2020-06-12 21:17   ` [PATCH 06/10] net: rtl8139: Pass private data into rtl8139_eeprom_delay() Tom Rini
2020-05-09 20:34 ` [PATCH 07/10] net: rtl8139: Split out common and non-DM functions Marek Vasut
2020-06-12 21:17   ` Tom Rini
2020-05-09 20:34 ` [PATCH 08/10] net: rtl8139: Use PCI_DEVICE() to define PCI device compat list Marek Vasut
2020-06-12 21:17   ` Tom Rini
2020-05-09 20:34 ` [PATCH 09/10] net: rtl8139: Read HW address from EEPROM only on probe Marek Vasut
2020-06-12 21:17   ` Tom Rini
2020-05-09 20:34 ` [PATCH 10/10] net: rtl8139: Add DM support Marek Vasut
2020-06-12 21:17   ` Tom Rini
2020-06-12 21:16 ` [PATCH 01/10] net: rtl8139: Factor out device name assignment Tom Rini

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=20200509203444.821733-6-marek.vasut+renesas@gmail.com \
    --to=marek.vasut@gmail.com \
    --cc=u-boot@lists.denx.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.