diff options
author | Paul Fulghum <paulkf@microgate.com> | 2005-11-13 19:07:19 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-11-13 21:14:15 -0500 |
commit | 0ff1b2c8ceaf92197f756be569afefd593c56f68 (patch) | |
tree | 39b7dbd20533193ae2bd79cc3187fe52d15104a1 /drivers/char | |
parent | ab4eb43ce759559d7b15c5dde4a1562f202539f6 (diff) |
[PATCH] synclink: update to use DMA mapping API
Update synclink to use DMA mapping API. This removes warning about
isa_virt_to_bus() usage on architectures other than i386
Signed-off-by: Paul Fulghum <paulkf@microgate.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/char')
-rw-r--r-- | drivers/char/synclink.c | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/drivers/char/synclink.c b/drivers/char/synclink.c index 82c6abde68df..62aa0e534a6d 100644 --- a/drivers/char/synclink.c +++ b/drivers/char/synclink.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * linux/drivers/char/synclink.c | 2 | * linux/drivers/char/synclink.c |
3 | * | 3 | * |
4 | * $Id: synclink.c,v 4.37 2005/09/07 13:13:19 paulkf Exp $ | 4 | * $Id: synclink.c,v 4.38 2005/11/07 16:30:34 paulkf Exp $ |
5 | * | 5 | * |
6 | * Device driver for Microgate SyncLink ISA and PCI | 6 | * Device driver for Microgate SyncLink ISA and PCI |
7 | * high speed multiprotocol serial adapters. | 7 | * high speed multiprotocol serial adapters. |
@@ -101,6 +101,7 @@ | |||
101 | #include <linux/termios.h> | 101 | #include <linux/termios.h> |
102 | #include <linux/workqueue.h> | 102 | #include <linux/workqueue.h> |
103 | #include <linux/hdlc.h> | 103 | #include <linux/hdlc.h> |
104 | #include <linux/dma-mapping.h> | ||
104 | 105 | ||
105 | #ifdef CONFIG_HDLC_MODULE | 106 | #ifdef CONFIG_HDLC_MODULE |
106 | #define CONFIG_HDLC 1 | 107 | #define CONFIG_HDLC 1 |
@@ -148,6 +149,7 @@ typedef struct _DMABUFFERENTRY | |||
148 | u32 link; /* 32-bit flat link to next buffer entry */ | 149 | u32 link; /* 32-bit flat link to next buffer entry */ |
149 | char *virt_addr; /* virtual address of data buffer */ | 150 | char *virt_addr; /* virtual address of data buffer */ |
150 | u32 phys_entry; /* physical address of this buffer entry */ | 151 | u32 phys_entry; /* physical address of this buffer entry */ |
152 | dma_addr_t dma_addr; | ||
151 | } DMABUFFERENTRY, *DMAPBUFFERENTRY; | 153 | } DMABUFFERENTRY, *DMAPBUFFERENTRY; |
152 | 154 | ||
153 | /* The queue of BH actions to be performed */ | 155 | /* The queue of BH actions to be performed */ |
@@ -233,7 +235,8 @@ struct mgsl_struct { | |||
233 | int ri_chkcount; | 235 | int ri_chkcount; |
234 | 236 | ||
235 | char *buffer_list; /* virtual address of Rx & Tx buffer lists */ | 237 | char *buffer_list; /* virtual address of Rx & Tx buffer lists */ |
236 | unsigned long buffer_list_phys; | 238 | u32 buffer_list_phys; |
239 | dma_addr_t buffer_list_dma_addr; | ||
237 | 240 | ||
238 | unsigned int rx_buffer_count; /* count of total allocated Rx buffers */ | 241 | unsigned int rx_buffer_count; /* count of total allocated Rx buffers */ |
239 | DMABUFFERENTRY *rx_buffer_list; /* list of receive buffer entries */ | 242 | DMABUFFERENTRY *rx_buffer_list; /* list of receive buffer entries */ |
@@ -896,7 +899,7 @@ module_param_array(txdmabufs, int, NULL, 0); | |||
896 | module_param_array(txholdbufs, int, NULL, 0); | 899 | module_param_array(txholdbufs, int, NULL, 0); |
897 | 900 | ||
898 | static char *driver_name = "SyncLink serial driver"; | 901 | static char *driver_name = "SyncLink serial driver"; |
899 | static char *driver_version = "$Revision: 4.37 $"; | 902 | static char *driver_version = "$Revision: 4.38 $"; |
900 | 903 | ||
901 | static int synclink_init_one (struct pci_dev *dev, | 904 | static int synclink_init_one (struct pci_dev *dev, |
902 | const struct pci_device_id *ent); | 905 | const struct pci_device_id *ent); |
@@ -3811,11 +3814,10 @@ static int mgsl_alloc_buffer_list_memory( struct mgsl_struct *info ) | |||
3811 | /* inspect portions of the buffer while other portions are being */ | 3814 | /* inspect portions of the buffer while other portions are being */ |
3812 | /* updated by the adapter using Bus Master DMA. */ | 3815 | /* updated by the adapter using Bus Master DMA. */ |
3813 | 3816 | ||
3814 | info->buffer_list = kmalloc(BUFFERLISTSIZE, GFP_KERNEL | GFP_DMA); | 3817 | info->buffer_list = dma_alloc_coherent(NULL, BUFFERLISTSIZE, &info->buffer_list_dma_addr, GFP_KERNEL); |
3815 | if ( info->buffer_list == NULL ) | 3818 | if (info->buffer_list == NULL) |
3816 | return -ENOMEM; | 3819 | return -ENOMEM; |
3817 | 3820 | info->buffer_list_phys = (u32)(info->buffer_list_dma_addr); | |
3818 | info->buffer_list_phys = isa_virt_to_bus(info->buffer_list); | ||
3819 | } | 3821 | } |
3820 | 3822 | ||
3821 | /* We got the memory for the buffer entry lists. */ | 3823 | /* We got the memory for the buffer entry lists. */ |
@@ -3882,8 +3884,8 @@ static int mgsl_alloc_buffer_list_memory( struct mgsl_struct *info ) | |||
3882 | */ | 3884 | */ |
3883 | static void mgsl_free_buffer_list_memory( struct mgsl_struct *info ) | 3885 | static void mgsl_free_buffer_list_memory( struct mgsl_struct *info ) |
3884 | { | 3886 | { |
3885 | if ( info->buffer_list && info->bus_type != MGSL_BUS_TYPE_PCI ) | 3887 | if (info->buffer_list && info->bus_type != MGSL_BUS_TYPE_PCI) |
3886 | kfree(info->buffer_list); | 3888 | dma_free_coherent(NULL, BUFFERLISTSIZE, info->buffer_list, info->buffer_list_dma_addr); |
3887 | 3889 | ||
3888 | info->buffer_list = NULL; | 3890 | info->buffer_list = NULL; |
3889 | info->rx_buffer_list = NULL; | 3891 | info->rx_buffer_list = NULL; |
@@ -3910,7 +3912,7 @@ static void mgsl_free_buffer_list_memory( struct mgsl_struct *info ) | |||
3910 | static int mgsl_alloc_frame_memory(struct mgsl_struct *info,DMABUFFERENTRY *BufferList,int Buffercount) | 3912 | static int mgsl_alloc_frame_memory(struct mgsl_struct *info,DMABUFFERENTRY *BufferList,int Buffercount) |
3911 | { | 3913 | { |
3912 | int i; | 3914 | int i; |
3913 | unsigned long phys_addr; | 3915 | u32 phys_addr; |
3914 | 3916 | ||
3915 | /* Allocate page sized buffers for the receive buffer list */ | 3917 | /* Allocate page sized buffers for the receive buffer list */ |
3916 | 3918 | ||
@@ -3922,11 +3924,10 @@ static int mgsl_alloc_frame_memory(struct mgsl_struct *info,DMABUFFERENTRY *Buff | |||
3922 | info->last_mem_alloc += DMABUFFERSIZE; | 3924 | info->last_mem_alloc += DMABUFFERSIZE; |
3923 | } else { | 3925 | } else { |
3924 | /* ISA adapter uses system memory. */ | 3926 | /* ISA adapter uses system memory. */ |
3925 | BufferList[i].virt_addr = | 3927 | BufferList[i].virt_addr = dma_alloc_coherent(NULL, DMABUFFERSIZE, &BufferList[i].dma_addr, GFP_KERNEL); |
3926 | kmalloc(DMABUFFERSIZE, GFP_KERNEL | GFP_DMA); | 3928 | if (BufferList[i].virt_addr == NULL) |
3927 | if ( BufferList[i].virt_addr == NULL ) | ||
3928 | return -ENOMEM; | 3929 | return -ENOMEM; |
3929 | phys_addr = isa_virt_to_bus(BufferList[i].virt_addr); | 3930 | phys_addr = (u32)(BufferList[i].dma_addr); |
3930 | } | 3931 | } |
3931 | BufferList[i].phys_addr = phys_addr; | 3932 | BufferList[i].phys_addr = phys_addr; |
3932 | } | 3933 | } |
@@ -3957,7 +3958,7 @@ static void mgsl_free_frame_memory(struct mgsl_struct *info, DMABUFFERENTRY *Buf | |||
3957 | for ( i = 0 ; i < Buffercount ; i++ ) { | 3958 | for ( i = 0 ; i < Buffercount ; i++ ) { |
3958 | if ( BufferList[i].virt_addr ) { | 3959 | if ( BufferList[i].virt_addr ) { |
3959 | if ( info->bus_type != MGSL_BUS_TYPE_PCI ) | 3960 | if ( info->bus_type != MGSL_BUS_TYPE_PCI ) |
3960 | kfree(BufferList[i].virt_addr); | 3961 | dma_free_coherent(NULL, DMABUFFERSIZE, BufferList[i].virt_addr, BufferList[i].dma_addr); |
3961 | BufferList[i].virt_addr = NULL; | 3962 | BufferList[i].virt_addr = NULL; |
3962 | } | 3963 | } |
3963 | } | 3964 | } |