| .. | .. |
|---|
| 834 | 834 | |
|---|
| 835 | 835 | dprintk(KERN_NOTICE "3w-xxxx: tw_allocate_memory()\n"); |
|---|
| 836 | 836 | |
|---|
| 837 | | - cpu_addr = pci_alloc_consistent(tw_dev->tw_pci_dev, size*TW_Q_LENGTH, &dma_handle); |
|---|
| 837 | + cpu_addr = dma_alloc_coherent(&tw_dev->tw_pci_dev->dev, |
|---|
| 838 | + size * TW_Q_LENGTH, &dma_handle, GFP_KERNEL); |
|---|
| 838 | 839 | if (cpu_addr == NULL) { |
|---|
| 839 | | - printk(KERN_WARNING "3w-xxxx: pci_alloc_consistent() failed.\n"); |
|---|
| 840 | + printk(KERN_WARNING "3w-xxxx: dma_alloc_coherent() failed.\n"); |
|---|
| 840 | 841 | return 1; |
|---|
| 841 | 842 | } |
|---|
| 842 | 843 | |
|---|
| 843 | 844 | if ((unsigned long)cpu_addr % (tw_dev->tw_pci_dev->device == TW_DEVICE_ID ? TW_ALIGNMENT_6000 : TW_ALIGNMENT_7000)) { |
|---|
| 844 | 845 | printk(KERN_WARNING "3w-xxxx: Couldn't allocate correctly aligned memory.\n"); |
|---|
| 845 | | - pci_free_consistent(tw_dev->tw_pci_dev, size*TW_Q_LENGTH, cpu_addr, dma_handle); |
|---|
| 846 | + dma_free_coherent(&tw_dev->tw_pci_dev->dev, size * TW_Q_LENGTH, |
|---|
| 847 | + cpu_addr, dma_handle); |
|---|
| 846 | 848 | return 1; |
|---|
| 847 | 849 | } |
|---|
| 848 | 850 | |
|---|
| .. | .. |
|---|
| 1047 | 1049 | static const struct file_operations tw_fops = { |
|---|
| 1048 | 1050 | .owner = THIS_MODULE, |
|---|
| 1049 | 1051 | .unlocked_ioctl = tw_chrdev_ioctl, |
|---|
| 1050 | | -#ifdef CONFIG_COMPAT |
|---|
| 1051 | | - .compat_ioctl = tw_chrdev_ioctl, |
|---|
| 1052 | | -#endif |
|---|
| 1052 | + .compat_ioctl = compat_ptr_ioctl, |
|---|
| 1053 | 1053 | .open = tw_chrdev_open, |
|---|
| 1054 | 1054 | .release = NULL, |
|---|
| 1055 | 1055 | .llseek = noop_llseek, |
|---|
| .. | .. |
|---|
| 1062 | 1062 | |
|---|
| 1063 | 1063 | /* Free command packet and generic buffer memory */ |
|---|
| 1064 | 1064 | if (tw_dev->command_packet_virtual_address[0]) |
|---|
| 1065 | | - pci_free_consistent(tw_dev->tw_pci_dev, sizeof(TW_Command)*TW_Q_LENGTH, tw_dev->command_packet_virtual_address[0], tw_dev->command_packet_physical_address[0]); |
|---|
| 1065 | + dma_free_coherent(&tw_dev->tw_pci_dev->dev, |
|---|
| 1066 | + sizeof(TW_Command) * TW_Q_LENGTH, |
|---|
| 1067 | + tw_dev->command_packet_virtual_address[0], |
|---|
| 1068 | + tw_dev->command_packet_physical_address[0]); |
|---|
| 1066 | 1069 | |
|---|
| 1067 | 1070 | if (tw_dev->alignment_virtual_address[0]) |
|---|
| 1068 | | - pci_free_consistent(tw_dev->tw_pci_dev, sizeof(TW_Sector)*TW_Q_LENGTH, tw_dev->alignment_virtual_address[0], tw_dev->alignment_physical_address[0]); |
|---|
| 1071 | + dma_free_coherent(&tw_dev->tw_pci_dev->dev, |
|---|
| 1072 | + sizeof(TW_Sector) * TW_Q_LENGTH, |
|---|
| 1073 | + tw_dev->alignment_virtual_address[0], |
|---|
| 1074 | + tw_dev->alignment_physical_address[0]); |
|---|
| 1069 | 1075 | } /* End tw_free_device_extension() */ |
|---|
| 1070 | 1076 | |
|---|
| 1071 | 1077 | /* This function will send an initconnection command to controller */ |
|---|
| .. | .. |
|---|
| 1166 | 1172 | command_que_value = tw_dev->command_packet_physical_address[request_id]; |
|---|
| 1167 | 1173 | if (command_que_value == 0) { |
|---|
| 1168 | 1174 | printk(KERN_WARNING "3w-xxxx: tw_setfeature(): Bad command packet physical address.\n"); |
|---|
| 1169 | | - return 1; |
|---|
| 1175 | + return 1; |
|---|
| 1170 | 1176 | } |
|---|
| 1171 | 1177 | |
|---|
| 1172 | 1178 | /* Send command packet to the board */ |
|---|
| .. | .. |
|---|
| 2239 | 2245 | .sg_tablesize = TW_MAX_SGL_LENGTH, |
|---|
| 2240 | 2246 | .max_sectors = TW_MAX_SECTORS, |
|---|
| 2241 | 2247 | .cmd_per_lun = TW_MAX_CMDS_PER_LUN, |
|---|
| 2242 | | - .use_clustering = ENABLE_CLUSTERING, |
|---|
| 2243 | 2248 | .shost_attrs = tw_host_attrs, |
|---|
| 2244 | 2249 | .emulated = 1, |
|---|
| 2245 | 2250 | .no_write_same = 1, |
|---|
| .. | .. |
|---|
| 2260 | 2265 | |
|---|
| 2261 | 2266 | pci_set_master(pdev); |
|---|
| 2262 | 2267 | |
|---|
| 2263 | | - retval = pci_set_dma_mask(pdev, TW_DMA_MASK); |
|---|
| 2268 | + retval = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)); |
|---|
| 2264 | 2269 | if (retval) { |
|---|
| 2265 | 2270 | printk(KERN_WARNING "3w-xxxx: Failed to set dma mask."); |
|---|
| 2266 | 2271 | goto out_disable_device; |
|---|
| .. | .. |
|---|
| 2303 | 2308 | TW_DISABLE_INTERRUPTS(tw_dev); |
|---|
| 2304 | 2309 | |
|---|
| 2305 | 2310 | /* Initialize the card */ |
|---|
| 2306 | | - if (tw_reset_sequence(tw_dev)) |
|---|
| 2311 | + if (tw_reset_sequence(tw_dev)) { |
|---|
| 2312 | + retval = -EINVAL; |
|---|
| 2307 | 2313 | goto out_release_mem_region; |
|---|
| 2314 | + } |
|---|
| 2308 | 2315 | |
|---|
| 2309 | 2316 | /* Set host specific parameters */ |
|---|
| 2310 | 2317 | host->max_id = TW_MAX_UNITS; |
|---|