netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fix compiler warnings in mv64340_eth
@ 2004-07-06 10:52 Christoph Hellwig
  2004-07-07  5:08 ` Jeff Garzik
  0 siblings, 1 reply; 4+ messages in thread
From: Christoph Hellwig @ 2004-07-06 10:52 UTC (permalink / raw)
  To: jgarzik; +Cc: netdev

The driver was trying to do pointer arithmetic on integers but forgot
half of the casts..

Let's just do normal integer arithmetics instead.


--- drivers/net/mv64340_eth.c~	2004-07-06 14:26:47.163242160 +0200
+++ drivers/net/mv64340_eth.c	2004-07-06 14:48:31.053020784 +0200
@@ -752,9 +752,8 @@
 		p_rx_desc[i].byte_cnt = 0x0000;
 		p_rx_desc[i].cmd_sts =
 			ETH_BUFFER_OWNED_BY_DMA | ETH_RX_ENABLE_INTERRUPT;
-		p_rx_desc[i].next_desc_ptr =
-			(struct eth_rx_desc *) mp->rx_desc_dma +
-				(i + 1) % rx_desc_num;
+		p_rx_desc[i].next_desc_ptr = mp->rx_desc_dma +
+			((i + 1) % rx_desc_num) * sizeof(struct eth_rx_desc);
 		p_rx_desc[i].buf_ptr = buffer_addr;
 
 		mp->rx_skb[i] = NULL;
@@ -818,9 +817,8 @@
 		p_tx_desc[i].byte_cnt	= 0x0000;
 		p_tx_desc[i].l4i_chk	= 0x0000;
 		p_tx_desc[i].cmd_sts	= 0x00000000;
-		p_tx_desc[i].next_desc_ptr =
-			(struct eth_tx_desc *) mp->tx_desc_dma +
-			(i + 1) % tx_desc_num;
+		p_tx_desc[i].next_desc_ptr = mp->tx_desc_dma +
+			((i + 1) % tx_desc_num) * sizeof(struct eth_tx_desc);
 		p_tx_desc[i].buf_ptr	= 0x00000000;
 		mp->tx_skb[i]		= NULL;
 	}
@@ -2329,8 +2349,8 @@
                 first_descriptor->cmd_sts = command_status;
                 first_descriptor->byte_cnt = p_pkt_info->byte_cnt;
                 first_descriptor->buf_ptr = p_pkt_info->buf_ptr;
-                first_descriptor->next_desc_ptr =
-			(struct eth_tx_desc *) mp->tx_desc_dma + tx_next_desc;
+                first_descriptor->next_desc_ptr = mp->tx_desc_dma +
+			tx_next_desc * sizeof(struct eth_tx_desc);
 		wmb();
         } else {
                 tx_first_desc = mp->tx_first_desc_q;
@@ -2343,8 +2363,8 @@
                         current_descriptor->next_desc_ptr = 0x00000000;
                 else {
                         command_status |= ETH_BUFFER_OWNED_BY_DMA;
-                        current_descriptor->next_desc_ptr =
-			  (struct eth_tx_desc *) mp->tx_desc_dma + tx_next_desc;
+                        current_descriptor->next_desc_ptr = mp->tx_desc_dma +
+				tx_next_desc * sizeof(struct eth_tx_desc);
                 }
         }
 

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

* Re: [PATCH] fix compiler warnings in mv64340_eth
  2004-07-06 10:52 [PATCH] fix compiler warnings in mv64340_eth Christoph Hellwig
@ 2004-07-07  5:08 ` Jeff Garzik
  2004-07-07 15:16   ` Christoph Hellwig
  0 siblings, 1 reply; 4+ messages in thread
From: Jeff Garzik @ 2004-07-07  5:08 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: netdev

patch OK, but patch(1) rejected

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

* Re: [PATCH] fix compiler warnings in mv64340_eth
  2004-07-07  5:08 ` Jeff Garzik
@ 2004-07-07 15:16   ` Christoph Hellwig
  2004-07-09 19:19     ` Jeff Garzik
  0 siblings, 1 reply; 4+ messages in thread
From: Christoph Hellwig @ 2004-07-07 15:16 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: netdev

On Wed, Jul 07, 2004 at 01:08:14AM -0400, Jeff Garzik wrote:
> patch OK, but patch(1) rejected

hmm, looks like it was for patch -p0


--- a/drivers/net/mv64340_eth.c~	2004-07-06 14:26:47.163242160 +0200
+++ b/drivers/net/mv64340_eth.c	2004-07-06 14:48:31.053020784 +0200
@@ -752,9 +752,8 @@
 		p_rx_desc[i].byte_cnt = 0x0000;
 		p_rx_desc[i].cmd_sts =
 			ETH_BUFFER_OWNED_BY_DMA | ETH_RX_ENABLE_INTERRUPT;
-		p_rx_desc[i].next_desc_ptr =
-			(struct eth_rx_desc *) mp->rx_desc_dma +
-				(i + 1) % rx_desc_num;
+		p_rx_desc[i].next_desc_ptr = mp->rx_desc_dma +
+			((i + 1) % rx_desc_num) * sizeof(struct eth_rx_desc);
 		p_rx_desc[i].buf_ptr = buffer_addr;
 
 		mp->rx_skb[i] = NULL;
@@ -818,9 +817,8 @@
 		p_tx_desc[i].byte_cnt	= 0x0000;
 		p_tx_desc[i].l4i_chk	= 0x0000;
 		p_tx_desc[i].cmd_sts	= 0x00000000;
-		p_tx_desc[i].next_desc_ptr =
-			(struct eth_tx_desc *) mp->tx_desc_dma +
-			(i + 1) % tx_desc_num;
+		p_tx_desc[i].next_desc_ptr = mp->tx_desc_dma +
+			((i + 1) % tx_desc_num) * sizeof(struct eth_tx_desc);
 		p_tx_desc[i].buf_ptr	= 0x00000000;
 		mp->tx_skb[i]		= NULL;
 	}
@@ -2329,8 +2349,8 @@
                 first_descriptor->cmd_sts = command_status;
                 first_descriptor->byte_cnt = p_pkt_info->byte_cnt;
                 first_descriptor->buf_ptr = p_pkt_info->buf_ptr;
-                first_descriptor->next_desc_ptr =
-			(struct eth_tx_desc *) mp->tx_desc_dma + tx_next_desc;
+                first_descriptor->next_desc_ptr = mp->tx_desc_dma +
+			tx_next_desc * sizeof(struct eth_tx_desc);
 		wmb();
         } else {
                 tx_first_desc = mp->tx_first_desc_q;
@@ -2343,8 +2363,8 @@
                         current_descriptor->next_desc_ptr = 0x00000000;
                 else {
                         command_status |= ETH_BUFFER_OWNED_BY_DMA;
-                        current_descriptor->next_desc_ptr =
-			  (struct eth_tx_desc *) mp->tx_desc_dma + tx_next_desc;
+                        current_descriptor->next_desc_ptr = mp->tx_desc_dma +
+				tx_next_desc * sizeof(struct eth_tx_desc);
                 }
         }
 

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

* Re: [PATCH] fix compiler warnings in mv64340_eth
  2004-07-07 15:16   ` Christoph Hellwig
@ 2004-07-09 19:19     ` Jeff Garzik
  0 siblings, 0 replies; 4+ messages in thread
From: Jeff Garzik @ 2004-07-09 19:19 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: netdev

applied

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

end of thread, other threads:[~2004-07-09 19:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-07-06 10:52 [PATCH] fix compiler warnings in mv64340_eth Christoph Hellwig
2004-07-07  5:08 ` Jeff Garzik
2004-07-07 15:16   ` Christoph Hellwig
2004-07-09 19:19     ` Jeff Garzik

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