netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Avoid switch on long long in s2io driver
@ 2007-05-26  8:58 Andreas Schwab
  2007-05-26 17:04 ` Michael Buesch
  0 siblings, 1 reply; 3+ messages in thread
From: Andreas Schwab @ 2007-05-26  8:58 UTC (permalink / raw)
  To: netdev

A switch on long long causes gcc to generate a reference to __ucmpdi2 on
ppc32.  Avoid that by casting to int, since the value is only a small
integer anyway.

Signed-off-by: Andreas Schwab <schwab@suse.de>

---
 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
+++ linux-2.6.22-rc1/drivers/net/s2io.c	2007-05-13 12:52:49.000000000 +0200
@@ -2898,7 +2898,7 @@ static void tx_intr_handler(struct fifo_
 
 			/* update t_code statistics */
 			err >>= 48;
-			switch(err) {
+			switch((int)err) {
 				case 2:
 					nic->mac_control.stats_info->sw_stat.
 							tx_buf_abort_cnt++;
@@ -6825,7 +6825,7 @@ static int rx_osm_handler(struct ring_in
 			sp->mac_control.stats_info->sw_stat.parity_err_cnt++;
 		}
 		err >>= 48;
-		switch(err) {
+		switch((int)err) {
 			case 1:
 				sp->mac_control.stats_info->sw_stat.
 				rx_parity_err_cnt++;

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Avoid switch on long long in s2io driver
  2007-05-26  8:58 [PATCH] Avoid switch on long long in s2io driver Andreas Schwab
@ 2007-05-26 17:04 ` Michael Buesch
  2007-05-30 19:37   ` Ramkrishna Vepa
  0 siblings, 1 reply; 3+ messages in thread
From: Michael Buesch @ 2007-05-26 17:04 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: netdev

On Saturday 26 May 2007 10:58:15 Andreas Schwab wrote:
> A switch on long long causes gcc to generate a reference to __ucmpdi2 on
> ppc32.  Avoid that by casting to int, since the value is only a small
> integer anyway.
> 
> Signed-off-by: Andreas Schwab <schwab@suse.de>
> 
> ---
>  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
> +++ linux-2.6.22-rc1/drivers/net/s2io.c	2007-05-13 12:52:49.000000000 +0200
> @@ -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.

>  				case 2:
>  					nic->mac_control.stats_info->sw_stat.
>  							tx_buf_abort_cnt++;
> @@ -6825,7 +6825,7 @@ static int rx_osm_handler(struct ring_in
>  			sp->mac_control.stats_info->sw_stat.parity_err_cnt++;
>  		}
>  		err >>= 48;
> -		switch(err) {
> +		switch((int)err) {
>  			case 1:
>  				sp->mac_control.stats_info->sw_stat.
>  				rx_parity_err_cnt++;
> 
> Andreas.
> 



-- 
Greetings Michael.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: [PATCH] Avoid switch on long long in s2io driver
  2007-05-26 17:04 ` Michael Buesch
@ 2007-05-30 19:37   ` Ramkrishna Vepa
  0 siblings, 0 replies; 3+ messages in thread
From: Ramkrishna Vepa @ 2007-05-30 19:37 UTC (permalink / raw)
  To: Michael Buesch, Andreas Schwab; +Cc: netdev

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:
> > A switch on long long causes gcc to generate a reference to
__ucmpdi2 on
> > ppc32.  Avoid that by casting to int, since the value is only a
small
> > integer anyway.
> >
> > Signed-off-by: Andreas Schwab <schwab@suse.de>
> >
> > ---
> >  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
> > +++ linux-2.6.22-rc1/drivers/net/s2io.c	2007-05-13
12:52:49.000000000
> +0200
> > @@ -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.
> 
> >  				case 2:
> >
nic->mac_control.stats_info->sw_stat.
> >
tx_buf_abort_cnt++;
> > @@ -6825,7 +6825,7 @@ static int rx_osm_handler(struct ring_in
> >
sp->mac_control.stats_info->sw_stat.parity_err_cnt++;
> >  		}
> >  		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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-05-30 19:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-05-26  8:58 [PATCH] Avoid switch on long long in s2io driver Andreas Schwab
2007-05-26 17:04 ` Michael Buesch
2007-05-30 19:37   ` Ramkrishna Vepa

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).