Thread (3 messages) 3 messages, 3 authors, 2007-05-30

RE: [PATCH] Avoid switch on long long in s2io driver

From: Ramkrishna Vepa <hidden>
Date: 2007-05-30 19:53:24

Patch looks good. Yes, please add a comment as to reason for cast.

Ram
-----Original Message-----
From: netdev-owner@vger.kernel.org
[mailto:netdev-owner@vger.kernel.org]
On Behalf Of Michael Buesch
Sent: Saturday, May 26, 2007 10:04 AM
To: Andreas Schwab
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH] Avoid switch on long long in s2io driver

On Saturday 26 May 2007 10:58:15 Andreas Schwab wrote:
quoted
A switch on long long causes gcc to generate a reference to
__ucmpdi2 on
quoted
ppc32.  Avoid that by casting to int, since the value is only a
small
quoted
integer anyway.

Signed-off-by: Andreas Schwab <redacted>

---
 drivers/net/s2io.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Index: linux-2.6.22-rc1/drivers/net/s2io.c
===================================================================
--- linux-2.6.22-rc1.orig/drivers/net/s2io.c	2007-05-13
11:03:28.000000000 +0200
quoted
+++ linux-2.6.22-rc1/drivers/net/s2io.c	2007-05-13
12:52:49.000000000
+0200
quoted
@@ -2898,7 +2898,7 @@ static void tx_intr_handler(struct fifo_

 			/* update t_code statistics */
 			err >>= 48;
-			switch(err) {
+			switch((int)err) {
Hm, maybe add a comment, too?
This cast looks redundant at the first look and someone
who doesn't understand it might submit a patch to remove it again.
quoted
 				case 2:
nic->mac_control.stats_info->sw_stat.
quoted
tx_buf_abort_cnt++;
quoted
@@ -6825,7 +6825,7 @@ static int rx_osm_handler(struct ring_in
sp->mac_control.stats_info->sw_stat.parity_err_cnt++;
quoted
 		}
 		err >>= 48;
-		switch(err) {
+		switch((int)err) {
 			case 1:
 				sp->mac_control.stats_info->sw_stat.
 				rx_parity_err_cnt++;

Andreas.


--
Greetings Michael.
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help