* [PATCH -mm] updated dl2k gcc 4.1 warning fix
@ 2006-05-10 18:12 Daniel Walker
2006-05-10 18:57 ` [PATCH] dl2k: use explicit DMA_48BIT_MASK Francois Romieu
0 siblings, 1 reply; 5+ messages in thread
From: Daniel Walker @ 2006-05-10 18:12 UTC (permalink / raw)
To: akpm; +Cc: edward_peng, netdev, linux-kernel
Fixes the following warning,
drivers/net/dl2k.c: In function 'rio_free_tx':
drivers/net/dl2k.c:768: warning: integer constant is too large for 'long' type
drivers/net/dl2k.c: In function 'receive_packet':
drivers/net/dl2k.c:896: warning: integer constant is too large for 'long' type
drivers/net/dl2k.c:904: warning: integer constant is too large for 'long' type
drivers/net/dl2k.c:916: warning: integer constant is too large for 'long' type
drivers/net/dl2k.c: In function 'rio_close':
drivers/net/dl2k.c:1803: warning: integer constant is too large for 'long' type
drivers/net/dl2k.c:1813: warning: integer constant is too large for 'long' type
Signed-Off-By: Daniel Walker <dwalker@mvista.com>
Index: linux-2.6.16/drivers/net/dl2k.c
===================================================================
--- linux-2.6.16.orig/drivers/net/dl2k.c
+++ linux-2.6.16/drivers/net/dl2k.c
@@ -765,7 +765,8 @@ rio_free_tx (struct net_device *dev, int
break;
skb = np->tx_skbuff[entry];
pci_unmap_single (np->pdev,
- np->tx_ring[entry].fraginfo & 0xffffffffffff,
+ np->tx_ring[entry].fraginfo &
+ 0xffffffffffffULL,
skb->len, PCI_DMA_TODEVICE);
if (irq)
dev_kfree_skb_irq (skb);
@@ -893,7 +894,8 @@ receive_packet (struct net_device *dev)
/* Small skbuffs for short packets */
if (pkt_len > copy_thresh) {
pci_unmap_single (np->pdev,
- desc->fraginfo & 0xffffffffffff,
+ desc->fraginfo &
+ 0xffffffffffffULL,
np->rx_buf_sz,
PCI_DMA_FROMDEVICE);
skb_put (skb = np->rx_skbuff[entry], pkt_len);
@@ -901,7 +903,7 @@ receive_packet (struct net_device *dev)
} else if ((skb = dev_alloc_skb (pkt_len + 2)) != NULL) {
pci_dma_sync_single_for_cpu(np->pdev,
desc->fraginfo &
- 0xffffffffffff,
+ 0xffffffffffffULL,
np->rx_buf_sz,
PCI_DMA_FROMDEVICE);
skb->dev = dev;
@@ -912,8 +914,8 @@ receive_packet (struct net_device *dev)
pkt_len, 0);
skb_put (skb, pkt_len);
pci_dma_sync_single_for_device(np->pdev,
- desc->fraginfo &
- 0xffffffffffff,
+ desc->fraginfo &
+ 0xffffffffffffULL,
np->rx_buf_sz,
PCI_DMA_FROMDEVICE);
}
@@ -1800,7 +1802,8 @@ rio_close (struct net_device *dev)
skb = np->rx_skbuff[i];
if (skb) {
pci_unmap_single(np->pdev,
- np->rx_ring[i].fraginfo & 0xffffffffffff,
+ np->rx_ring[i].fraginfo &
+ 0xffffffffffffULL,
skb->len, PCI_DMA_FROMDEVICE);
dev_kfree_skb (skb);
np->rx_skbuff[i] = NULL;
@@ -1810,7 +1813,8 @@ rio_close (struct net_device *dev)
skb = np->tx_skbuff[i];
if (skb) {
pci_unmap_single(np->pdev,
- np->tx_ring[i].fraginfo & 0xffffffffffff,
+ np->tx_ring[i].fraginfo &
+ 0xffffffffffffULL,
skb->len, PCI_DMA_TODEVICE);
dev_kfree_skb (skb);
np->tx_skbuff[i] = NULL;
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH] dl2k: use explicit DMA_48BIT_MASK
2006-05-10 18:12 [PATCH -mm] updated dl2k gcc 4.1 warning fix Daniel Walker
@ 2006-05-10 18:57 ` Francois Romieu
2006-05-10 23:52 ` Jon Mason
0 siblings, 1 reply; 5+ messages in thread
From: Francois Romieu @ 2006-05-10 18:57 UTC (permalink / raw)
To: Daniel Walker; +Cc: akpm, edward_peng, netdev, linux-kernel
Typo will be harder with this one.
Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>
---
drivers/net/dl2k.c | 13 ++++++-------
include/linux/dma-mapping.h | 1 +
2 files changed, 7 insertions(+), 7 deletions(-)
5019a27a2a4e259f29a7bd03e905764eedfa034c
diff --git a/drivers/net/dl2k.c b/drivers/net/dl2k.c
index ca73f07..18d67cf 100644
--- a/drivers/net/dl2k.c
+++ b/drivers/net/dl2k.c
@@ -765,8 +765,7 @@ rio_free_tx (struct net_device *dev, int
break;
skb = np->tx_skbuff[entry];
pci_unmap_single (np->pdev,
- np->tx_ring[entry].fraginfo &
- 0xffffffffffffULL,
+ np->tx_ring[entry].fraginfo & DMA_48BIT_MASK,
skb->len, PCI_DMA_TODEVICE);
if (irq)
dev_kfree_skb_irq (skb);
@@ -895,7 +894,7 @@ receive_packet (struct net_device *dev)
if (pkt_len > copy_thresh) {
pci_unmap_single (np->pdev,
desc->fraginfo &
- 0xffffffffffffULL,
+ DMA_48BIT_MASK,
np->rx_buf_sz,
PCI_DMA_FROMDEVICE);
skb_put (skb = np->rx_skbuff[entry], pkt_len);
@@ -903,7 +902,7 @@ receive_packet (struct net_device *dev)
} else if ((skb = dev_alloc_skb (pkt_len + 2)) != NULL) {
pci_dma_sync_single_for_cpu(np->pdev,
desc->fraginfo &
- 0xffffffffffffULL,
+ DMA_48BIT_MASK,
np->rx_buf_sz,
PCI_DMA_FROMDEVICE);
skb->dev = dev;
@@ -915,7 +914,7 @@ receive_packet (struct net_device *dev)
skb_put (skb, pkt_len);
pci_dma_sync_single_for_device(np->pdev,
desc->fraginfo &
- 0xffffffffffffULL,
+ DMA_48BIT_MASK,
np->rx_buf_sz,
PCI_DMA_FROMDEVICE);
}
@@ -1803,7 +1802,7 @@ rio_close (struct net_device *dev)
if (skb) {
pci_unmap_single(np->pdev,
np->rx_ring[i].fraginfo &
- 0xffffffffffffULL,
+ DMA_48BIT_MASK,
skb->len, PCI_DMA_FROMDEVICE);
dev_kfree_skb (skb);
np->rx_skbuff[i] = NULL;
@@ -1814,7 +1813,7 @@ rio_close (struct net_device *dev)
if (skb) {
pci_unmap_single(np->pdev,
np->tx_ring[i].fraginfo &
- 0xffffffffffffULL,
+ DMA_48BIT_MASK,
skb->len, PCI_DMA_TODEVICE);
dev_kfree_skb (skb);
np->tx_skbuff[i] = NULL;
diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h
index ff61817..635690c 100644
--- a/include/linux/dma-mapping.h
+++ b/include/linux/dma-mapping.h
@@ -14,6 +14,7 @@ enum dma_data_direction {
};
#define DMA_64BIT_MASK 0xffffffffffffffffULL
+#define DMA_48BIT_MASK 0x0000ffffffffffffULL
#define DMA_40BIT_MASK 0x000000ffffffffffULL
#define DMA_39BIT_MASK 0x0000007fffffffffULL
#define DMA_32BIT_MASK 0x00000000ffffffffULL
--
1.3.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] dl2k: use explicit DMA_48BIT_MASK
2006-05-10 18:57 ` [PATCH] dl2k: use explicit DMA_48BIT_MASK Francois Romieu
@ 2006-05-10 23:52 ` Jon Mason
2006-05-11 19:23 ` Francois Romieu
2006-05-11 19:45 ` Francois Romieu
0 siblings, 2 replies; 5+ messages in thread
From: Jon Mason @ 2006-05-10 23:52 UTC (permalink / raw)
To: Francois Romieu; +Cc: Daniel Walker, akpm, edward_peng, netdev, linux-kernel
On Wed, May 10, 2006 at 08:57:18PM +0200, Francois Romieu wrote:
> Typo will be harder with this one.
While I agree that a #define is much better than the magic number, I
think this is bastardizing the intended use of DMA_*BIT_MASK.
DMA_*BIT_MASK is intended to be used in the DMA_API's checking of
DMA controller's addressable memory, where as this is masking off the
lower 48bits of a descriptor for its DMA address.
I think a better solution (which I should've done when I pushed the
original patch) would be a driver specific #define.
Thanks,
Jon
>
> Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>
>
> ---
>
> drivers/net/dl2k.c | 13 ++++++-------
> include/linux/dma-mapping.h | 1 +
> 2 files changed, 7 insertions(+), 7 deletions(-)
>
> 5019a27a2a4e259f29a7bd03e905764eedfa034c
> diff --git a/drivers/net/dl2k.c b/drivers/net/dl2k.c
> index ca73f07..18d67cf 100644
> --- a/drivers/net/dl2k.c
> +++ b/drivers/net/dl2k.c
> @@ -765,8 +765,7 @@ rio_free_tx (struct net_device *dev, int
> break;
> skb = np->tx_skbuff[entry];
> pci_unmap_single (np->pdev,
> - np->tx_ring[entry].fraginfo &
> - 0xffffffffffffULL,
> + np->tx_ring[entry].fraginfo & DMA_48BIT_MASK,
> skb->len, PCI_DMA_TODEVICE);
> if (irq)
> dev_kfree_skb_irq (skb);
> @@ -895,7 +894,7 @@ receive_packet (struct net_device *dev)
> if (pkt_len > copy_thresh) {
> pci_unmap_single (np->pdev,
> desc->fraginfo &
> - 0xffffffffffffULL,
> + DMA_48BIT_MASK,
> np->rx_buf_sz,
> PCI_DMA_FROMDEVICE);
> skb_put (skb = np->rx_skbuff[entry], pkt_len);
> @@ -903,7 +902,7 @@ receive_packet (struct net_device *dev)
> } else if ((skb = dev_alloc_skb (pkt_len + 2)) != NULL) {
> pci_dma_sync_single_for_cpu(np->pdev,
> desc->fraginfo &
> - 0xffffffffffffULL,
> + DMA_48BIT_MASK,
> np->rx_buf_sz,
> PCI_DMA_FROMDEVICE);
> skb->dev = dev;
> @@ -915,7 +914,7 @@ receive_packet (struct net_device *dev)
> skb_put (skb, pkt_len);
> pci_dma_sync_single_for_device(np->pdev,
> desc->fraginfo &
> - 0xffffffffffffULL,
> + DMA_48BIT_MASK,
> np->rx_buf_sz,
> PCI_DMA_FROMDEVICE);
> }
> @@ -1803,7 +1802,7 @@ rio_close (struct net_device *dev)
> if (skb) {
> pci_unmap_single(np->pdev,
> np->rx_ring[i].fraginfo &
> - 0xffffffffffffULL,
> + DMA_48BIT_MASK,
> skb->len, PCI_DMA_FROMDEVICE);
> dev_kfree_skb (skb);
> np->rx_skbuff[i] = NULL;
> @@ -1814,7 +1813,7 @@ rio_close (struct net_device *dev)
> if (skb) {
> pci_unmap_single(np->pdev,
> np->tx_ring[i].fraginfo &
> - 0xffffffffffffULL,
> + DMA_48BIT_MASK,
> skb->len, PCI_DMA_TODEVICE);
> dev_kfree_skb (skb);
> np->tx_skbuff[i] = NULL;
> diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h
> index ff61817..635690c 100644
> --- a/include/linux/dma-mapping.h
> +++ b/include/linux/dma-mapping.h
> @@ -14,6 +14,7 @@ enum dma_data_direction {
> };
>
> #define DMA_64BIT_MASK 0xffffffffffffffffULL
> +#define DMA_48BIT_MASK 0x0000ffffffffffffULL
> #define DMA_40BIT_MASK 0x000000ffffffffffULL
> #define DMA_39BIT_MASK 0x0000007fffffffffULL
> #define DMA_32BIT_MASK 0x00000000ffffffffULL
> --
> 1.3.1
>
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] dl2k: use explicit DMA_48BIT_MASK
2006-05-10 23:52 ` Jon Mason
@ 2006-05-11 19:23 ` Francois Romieu
2006-05-11 19:45 ` Francois Romieu
1 sibling, 0 replies; 5+ messages in thread
From: Francois Romieu @ 2006-05-11 19:23 UTC (permalink / raw)
Cc: Daniel Walker, akpm, edward_peng, netdev, linux-kernel
Jon Mason <jdmason@us.ibm.com> :
[...]
> DMA_*BIT_MASK is intended to be used in the DMA_API's checking of
> DMA controller's addressable memory, where as this is masking off the
> lower 48bits of a descriptor for its DMA address.
Imho it's the specific reason why the DMA_*BIT_MASK applies here: the
code is already in dma-"tainted" land.
> I think a better solution (which I should've done when I pushed the
> original patch) would be a driver specific #define.
$ find drivers -type f | xargs grep -i [^f]ffffffffffff[^f] | wc -l
12
No disagreement: it does not have a huge potential for code duplication.
--
Ueimor
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] dl2k: use explicit DMA_48BIT_MASK
2006-05-10 23:52 ` Jon Mason
2006-05-11 19:23 ` Francois Romieu
@ 2006-05-11 19:45 ` Francois Romieu
1 sibling, 0 replies; 5+ messages in thread
From: Francois Romieu @ 2006-05-11 19:45 UTC (permalink / raw)
To: unlisted-recipients
Cc: Daniel Walker, akpm, edward_peng, netdev, linux-kernel
Jon Mason <jdmason@us.ibm.com> :
[...]
> DMA_*BIT_MASK is intended to be used in the DMA_API's checking of
> DMA controller's addressable memory, where as this is masking off the
> lower 48bits of a descriptor for its DMA address.
Imho it's the specific reason why the DMA_*BIT_MASK applies here: the
code is already in dma-"tainted" land.
> I think a better solution (which I should've done when I pushed the
> original patch) would be a driver specific #define.
$ find drivers -type f | xargs grep -i [^f]ffffffffffff[^f] | wc -l
12
No disagreement: it does not have a huge potential for code duplication.
--
Ueimor
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2006-05-11 19:45 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-05-10 18:12 [PATCH -mm] updated dl2k gcc 4.1 warning fix Daniel Walker
2006-05-10 18:57 ` [PATCH] dl2k: use explicit DMA_48BIT_MASK Francois Romieu
2006-05-10 23:52 ` Jon Mason
2006-05-11 19:23 ` Francois Romieu
2006-05-11 19:45 ` Francois Romieu
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).