Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

farsync: Fix confusion about DMA address and buffer offset types

Use dma_addr_t for DMA address parameters and u32 for shared memory
offset parameters.

Do not assume that dma_addr_t is the same as unsigned long; it will
not be in PAE configurations. Truncate DMA addresses to 32 bits when
printing them. This is OK because the DMA mask for this device is
32-bit (per default).

Also rename the DMA address parameters from 'skb' to 'dma'.

Compile-tested only.

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Ben Hutchings and committed by
David S. Miller
581d9baa 7e1a61b6

+8 -13
+8 -13
drivers/net/wan/farsync.c
··· 882 882 * Receive a frame through the DMA 883 883 */ 884 884 static inline void 885 - fst_rx_dma(struct fst_card_info *card, dma_addr_t skb, 886 - dma_addr_t mem, int len) 885 + fst_rx_dma(struct fst_card_info *card, dma_addr_t dma, u32 mem, int len) 887 886 { 888 887 /* 889 888 * This routine will setup the DMA and start it 890 889 */ 891 890 892 - dbg(DBG_RX, "In fst_rx_dma %lx %lx %d\n", 893 - (unsigned long) skb, (unsigned long) mem, len); 891 + dbg(DBG_RX, "In fst_rx_dma %x %x %d\n", (u32)dma, mem, len); 894 892 if (card->dmarx_in_progress) { 895 893 dbg(DBG_ASS, "In fst_rx_dma while dma in progress\n"); 896 894 } 897 895 898 - outl(skb, card->pci_conf + DMAPADR0); /* Copy to here */ 896 + outl(dma, card->pci_conf + DMAPADR0); /* Copy to here */ 899 897 outl(mem, card->pci_conf + DMALADR0); /* from here */ 900 898 outl(len, card->pci_conf + DMASIZ0); /* for this length */ 901 899 outl(0x00000000c, card->pci_conf + DMADPR0); /* In this direction */ ··· 909 911 * Send a frame through the DMA 910 912 */ 911 913 static inline void 912 - fst_tx_dma(struct fst_card_info *card, unsigned char *skb, 913 - unsigned char *mem, int len) 914 + fst_tx_dma(struct fst_card_info *card, dma_addr_t dma, u32 mem, int len) 914 915 { 915 916 /* 916 917 * This routine will setup the DMA and start it. 917 918 */ 918 919 919 - dbg(DBG_TX, "In fst_tx_dma %p %p %d\n", skb, mem, len); 920 + dbg(DBG_TX, "In fst_tx_dma %x %x %d\n", (u32)dma, mem, len); 920 921 if (card->dmatx_in_progress) { 921 922 dbg(DBG_ASS, "In fst_tx_dma while dma in progress\n"); 922 923 } 923 924 924 - outl((unsigned long) skb, card->pci_conf + DMAPADR1); /* Copy from here */ 925 - outl((unsigned long) mem, card->pci_conf + DMALADR1); /* to here */ 925 + outl(dma, card->pci_conf + DMAPADR1); /* Copy from here */ 926 + outl(mem, card->pci_conf + DMALADR1); /* to here */ 926 927 outl(len, card->pci_conf + DMASIZ1); /* for this length */ 927 928 outl(0x000000004, card->pci_conf + DMADPR1); /* In this direction */ 928 929 ··· 1398 1401 card->dma_len_tx = skb->len; 1399 1402 card->dma_txpos = port->txpos; 1400 1403 fst_tx_dma(card, 1401 - (char *) card-> 1402 - tx_dma_handle_card, 1403 - (char *) 1404 + card->tx_dma_handle_card, 1404 1405 BUF_OFFSET(txBuffer[pi] 1405 1406 [port->txpos][0]), 1406 1407 skb->len);