Skip to contentSkip to conversation

net: ftmac100: remove unncessary volatiles

PATCH New Po-Yu Chuang 4 participants 9 messages Jan 20, 2011 – Mar 21, 2011 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: ftmac100: remove unncessary volatiles

From: Po-Yu Chuang <[email protected]>

This patch also update get_timer() usage.

---
 drivers/net/ftmac100.c |   20 +++++++++-----------
 1 files changed, 9 insertions(+), 11 deletions(-)
drivers/net/ftmac100.c +9 -11
index 2328cb5..787d69b 100644
@@ -30,8 +30,8 @@
 #define ETH_ZLEN	60
 
 struct ftmac100_data {
-	volatile struct ftmac100_txdes txdes[1];
-	volatile struct ftmac100_rxdes rxdes[PKTBUFSRX];
+	struct ftmac100_txdes txdes[1];
+	struct ftmac100_rxdes rxdes[PKTBUFSRX];
 	int rx_index;
 };
 
@@ -88,8 +88,8 @@ static int ftmac100_init (struct eth_device *dev, bd_t *bd)
 {
 	struct ftmac100 *ftmac100 = (struct ftmac100 *)dev->iobase;
 	struct ftmac100_data *priv = dev->priv;
-	volatile struct ftmac100_txdes *txdes = priv->txdes;
-	volatile struct ftmac100_rxdes *rxdes = priv->rxdes;
+	struct ftmac100_txdes *txdes = priv->txdes;
+	struct ftmac100_rxdes *rxdes = priv->rxdes;
 	unsigned int maccr;
 	int i;
 
@@ -153,7 +153,7 @@ static int ftmac100_init (struct eth_device *dev, bd_t *bd)
 static int ftmac100_recv (struct eth_device *dev)
 {
 	struct ftmac100_data *priv = dev->priv;
-	volatile struct ftmac100_rxdes *curr_des;
+	struct ftmac100_rxdes *curr_des;
 	unsigned short rxlen;
 
 	curr_des = &priv->rxdes[priv->rx_index];
@@ -195,8 +195,8 @@ ftmac100_send (struct eth_device *dev, volatile void *packet, int length)
 {
 	struct ftmac100 *ftmac100 = (struct ftmac100 *)dev->iobase;
 	struct ftmac100_data *priv = dev->priv;
-	volatile struct ftmac100_txdes *curr_des = priv->txdes;
-	int tmo;
+	struct ftmac100_txdes *curr_des = priv->txdes;
+	ulong start;
 
 	if (curr_des->txdes0 & FTMAC100_TXDES0_TXDMA_OWN) {
 		debug ("%s(): no TX descriptor available\n", __func__);
@@ -219,14 +219,12 @@ ftmac100_send (struct eth_device *dev, volatile void *packet, int length)
 	curr_des->txdes0 = FTMAC100_TXDES0_TXDMA_OWN;
 
 	/* start transmit */
-
 	writel (1, &ftmac100->txpd);
 
 	/* wait for transfer to succeed */
-
-	tmo = get_timer (0) + 5 * CONFIG_SYS_HZ;
+	start = get_timer (0);
 	while (curr_des->txdes0 & FTMAC100_TXDES0_TXDMA_OWN) {
-		if (get_timer (0) >= tmo) {
+		if (get_timer (start) >= 5) {
 			debug ("%s(): timed out\n", __func__);
 			return -1;
 		}
Signature · 1 line
1.6.3.3
#1 lore raw

PATCH 1/1 net: ftmac100: remove unncessary volatiles

Hello.

Quoted 3 lines · Po-Yu Chuang

From: Po-Yu Chuang <[email protected]>

This patch also update get_timer() usage.

This seems like a material for a separate patch.

Quoted 9 lines
---
 drivers/net/ftmac100.c |   20 +++++++++-----------
 1 files changed, 9 insertions(+), 11 deletions(-)
drivers/net/ftmac100.c +0 -0
index 2328cb5..787d69b 100644

[...]

Quoted 4 lines
drivers/net/ftmac100.c +0 -0
@@ -219,14 +219,12 @@ ftmac100_send (struct eth_device *dev, volatile void *packet, int length)
 	curr_des->txdes0 = FTMAC100_TXDES0_TXDMA_OWN;
 
 	/* start transmit */

drivers/net/ftmac100.c ftmac100_send (struct eth_device *dev, volatile void *packet, int length) · line 227

Quoted 10 lines
drivers/net/ftmac100.c +2 -4
-
 	writel (1, &ftmac100->txpd);
 
 	/* wait for transfer to succeed */
-
-	tmo = get_timer (0) + 5 * CONFIG_SYS_HZ;
+	start = get_timer (0);
 	while (curr_des->txdes0 & FTMAC100_TXDES0_TXDMA_OWN) {
-		if (get_timer (0) >= tmo) {
+		if (get_timer (start) >= 5) {

I'm not sure this is equivalent to the old code...

drivers/net/ftmac100.c ftmac100_send (struct eth_device *dev, volatile void *packet, int length) · line 230

Quoted 3 lines
drivers/net/ftmac100.c +0 -0
 			debug ("%s(): timed out\n", __func__);
 			return -1;
 		}

checkpatch.pl says:

WARNING: space prohibited between function name and open parenthesis '(' #66: FILE: drivers/net/ftmac100.c:225:
+ start = get_timer (0);

WARNING: space prohibited between function name and open parenthesis '(' #69: FILE: drivers/net/ftmac100.c:227:
+ if (get_timer (start) >= 5) {

I know you're only modifying the existing code, but it's time to fix the
style of it as well...

WBR, Sergei

#2 lore raw

PATCH 1/1 net: ftmac100: remove unncessary volatiles

Hi Sergei,

Quoted 9 lines · Sergei Shtylyov

Hello.

Quoted 3 lines · Po-Yu Chuang

From: Po-Yu Chuang <[email protected]>

This patch also update get_timer() usage.

? This seems like a material for a separate patch.

OK, I will split this to 2 patches later.

Quoted 17 lines

[...]

Quoted 6 lines
(quoted diff) +0 -0
@@ -219,14 +219,12 @@ ftmac100_send (struct eth_device *dev, volatile void
 *packet, int length)
 ? ? ? ?curr_des->txdes0 = FTMAC100_TXDES0_TXDMA_OWN;

? ? ? ?/* start transmit */
-

Quoted 8 lines

? ? ? ?writel (1, &ftmac100->txpd);
? ? ? ?/* wait for transfer to succeed */
-
- ? ? ? tmo = get_timer (0) + 5 * CONFIG_SYS_HZ;
+ ? ? ? start = get_timer (0);
? ? ? ?while (curr_des->txdes0 & FTMAC100_TXDES0_TXDMA_OWN) {
- ? ? ? ? ? ? ? if (get_timer (0) >= tmo) {
+ ? ? ? ? ? ? ? if (get_timer (start) >= 5) {

? I'm not sure this is equivalent to the old code...

The original code waits unnecessarily long. This change refers to the way the newer driver does - drivers/net/ftgmac100.c.

Quoted 10 lines
Quoted 3 lines

? ? ? ? ? ? ? ? ? ? ? ?debug ("%s(): timed out\n", __func__); ? ? ? ? ? ? ? ? ? ? ? ?return -1;
? ? ? ? ? ? ? ?}

? checkpatch.pl says:

WARNING: space prohibited between function name and open parenthesis '(' #66: FILE: drivers/net/ftmac100.c:225:
+ ? ? ? start = get_timer (0);

Quoted 6 lines

WARNING: space prohibited between function name and open parenthesis '(' #69: FILE: drivers/net/ftmac100.c:227:
+ ? ? ? ? ? ? ? if (get_timer (start) >= 5) {

? I know you're only modifying the existing code, but it's time to fix the style of it as well...

OK, I'll fix it.

Thanks,
Po-Yu Chuang

#3 lore raw

PATCH v2 1/2 net: ftmac100: remove unncessary volatiles

In reply to Po-Yu Chuang

From: Po-Yu Chuang <[email protected]>

---
v2:
split get_timer() changes to a seperate patch

 drivers/net/ftmac100.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)
drivers/net/ftmac100.c +6 -6
index 2328cb5..27381a3 100644
@@ -30,8 +30,8 @@
 #define ETH_ZLEN	60
 
 struct ftmac100_data {
-	volatile struct ftmac100_txdes txdes[1];
-	volatile struct ftmac100_rxdes rxdes[PKTBUFSRX];
+	struct ftmac100_txdes txdes[1];
+	struct ftmac100_rxdes rxdes[PKTBUFSRX];
 	int rx_index;
 };
 
@@ -88,8 +88,8 @@ static int ftmac100_init (struct eth_device *dev, bd_t *bd)
 {
 	struct ftmac100 *ftmac100 = (struct ftmac100 *)dev->iobase;
 	struct ftmac100_data *priv = dev->priv;
-	volatile struct ftmac100_txdes *txdes = priv->txdes;
-	volatile struct ftmac100_rxdes *rxdes = priv->rxdes;
+	struct ftmac100_txdes *txdes = priv->txdes;
+	struct ftmac100_rxdes *rxdes = priv->rxdes;
 	unsigned int maccr;
 	int i;
 
@@ -153,7 +153,7 @@ static int ftmac100_init (struct eth_device *dev, bd_t *bd)
 static int ftmac100_recv (struct eth_device *dev)
 {
 	struct ftmac100_data *priv = dev->priv;
-	volatile struct ftmac100_rxdes *curr_des;
+	struct ftmac100_rxdes *curr_des;
 	unsigned short rxlen;
 
 	curr_des = &priv->rxdes[priv->rx_index];
@@ -195,8 +195,8 @@ ftmac100_send (struct eth_device *dev, volatile void *packet, int length)
 {
 	struct ftmac100 *ftmac100 = (struct ftmac100 *)dev->iobase;
 	struct ftmac100_data *priv = dev->priv;
-	volatile struct ftmac100_txdes *curr_des = priv->txdes;
 	int tmo;
+	struct ftmac100_txdes *curr_des = priv->txdes;
 
 	if (curr_des->txdes0 & FTMAC100_TXDES0_TXDMA_OWN) {
 		debug ("%s(): no TX descriptor available\n", __func__);
Signature · 1 line
1.6.3.3
#4 lore raw

PATCH v2 1/2 net: ftmac100: remove unncessary volatiles

Dear Po-Yu Chuang,

Quoted 10 lines · In message <[email protected]> you…

From: Po-Yu Chuang <[email protected]>

---
v2:
split get_timer() changes to a seperate patch

 drivers/net/ftmac100.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

Signature · 6 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
If the car industry behaved like the computer industry over the  last
30  years, a Rolls-Royce would cost $5, get 300 miles per gallon, and
blow up once a year killing all passengers inside.
#5 lore raw

PATCH v2 2/2 net: ftmac100: update get_timer() usages

In reply to Po-Yu Chuang

From: Po-Yu Chuang <[email protected]>

Use get_timer() the same way as drivers/net/ftgmac100.c

---
v2:
this patch is splitted from "net: ftmac100: remove unncessary volatiles"

 drivers/net/ftmac100.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
drivers/net/ftmac100.c +3 -3
index 27381a3..94dc6d9 100644
@@ -195,8 +195,8 @@ ftmac100_send (struct eth_device *dev, volatile void *packet, int length)
 {
 	struct ftmac100 *ftmac100 = (struct ftmac100 *)dev->iobase;
 	struct ftmac100_data *priv = dev->priv;
-	int tmo;
 	struct ftmac100_txdes *curr_des = priv->txdes;
+	ulong start;
 
 	if (curr_des->txdes0 & FTMAC100_TXDES0_TXDMA_OWN) {
 		debug ("%s(): no TX descriptor available\n", __func__);
@@ -224,9 +224,9 @@ ftmac100_send (struct eth_device *dev, volatile void *packet, int length)
 
 	/* wait for transfer to succeed */
 
-	tmo = get_timer (0) + 5 * CONFIG_SYS_HZ;
+	start = get_timer(0);
 	while (curr_des->txdes0 & FTMAC100_TXDES0_TXDMA_OWN) {
-		if (get_timer (0) >= tmo) {
+		if (get_timer(start) >= 5) {
 			debug ("%s(): timed out\n", __func__);
 			return -1;
 		}
Signature · 1 line
1.6.3.3
#6 lore raw

PATCH v2 2/2 net: ftmac100: update get_timer() usages

Hi Ben,

2011/1/21 Po-Yu Chuang <[email protected]>:

Quoted 8 lines

From: Po-Yu Chuang <[email protected]>

Use get_timer() the same way as drivers/net/ftgmac100.c

---
v2:
this patch is splitted from "net: ftmac100: remove unncessary volatiles"

Just remind you please remember to review this patch as http://patchwork.ozlabs.org/patch/79802/ in patchwork.

Signature · 2 lines
Best regards,
Macpaul Lin
#7 lore raw

PATCH v2 2/2 net: ftmac100: update get_timer() usages

Hi Ben,

2011/2/25 Macpaul Lin <[email protected]>:

Quoted 12 lines

Hi Ben,

2011/1/21 Po-Yu Chuang <[email protected]>:

Quoted 8 lines

From: Po-Yu Chuang <[email protected]>

Use get_timer() the same way as drivers/net/ftgmac100.c

---
v2:
this patch is splitted from "net: ftmac100: remove unncessary volatiles"

Quoted 6 lines

Just remind you please remember to review this patch as http://patchwork.ozlabs.org/patch/79802/ in patchwork.

Just remind you please "also" remember to review the patch "net: ftmac100: update get_timer() usages"
as http://patchwork.ozlabs.org/patch/79803/ in patchwork.

I've lost the patch "79803" in my mailbox, however I've downloaded it from patchwork.

Signature · 2 lines
Best regards,
Macpaul Lin
#8 lore raw

PATCH v2 2/2 net: ftmac100: update get_timer() usages

In reply to Po-Yu Chuang

Dear Po-Yu Chuang,

Quoted 11 lines · In message <[email protected]> you…

From: Po-Yu Chuang <[email protected]>

Use get_timer() the same way as drivers/net/ftgmac100.c

---
v2:
this patch is splitted from "net: ftmac100: remove unncessary volatiles"

 drivers/net/ftmac100.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

Signature · 6 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
As usual, this being a 1.3.x release, I haven't  even  compiled  this
kernel yet. So if it works, you should be doubly impressed.
      - Linus Torvalds in <[email protected]>