Commit ec090ef8 authored by Suraj Upadhyay's avatar Suraj Upadhyay Committed by Martin K. Petersen

scsi: megaraid: Remove pci-dma-compat wrapper API

The legacy API wrappers in include/linux/pci-dma-compat.h should go away as
they create unnecessary midlayering for include/linux/dma-mapping.h API.
Instead use dma-mapping.h API directly.

The patch has been generated with the coccinelle script below.  And has
been hand modified to replace each GFP_ with a correct flag depending upon
the context.  Compile tested.

@@@@
- PCI_DMA_BIDIRECTIONAL
+ DMA_BIDIRECTIONAL

@@@@
- PCI_DMA_TODEVICE
+ DMA_TO_DEVICE

@@@@
- PCI_DMA_FROMDEVICE
+ DMA_FROM_DEVICE

@@@@
- PCI_DMA_NONE
+ DMA_NONE

@@ expression E1, E2, E3; @@
- pci_alloc_consistent(E1, E2, E3)
+ dma_alloc_coherent(&E1->dev, E2, E3, GFP_)

@@ expression E1, E2, E3; @@
- pci_zalloc_consistent(E1, E2, E3)
+ dma_alloc_coherent(&E1->dev, E2, E3, GFP_)

@@ expression E1, E2, E3, E4; @@
- pci_free_consistent(E1, E2, E3, E4)
+ dma_free_coherent(&E1->dev, E2, E3, E4)

@@ expression E1, E2, E3, E4; @@
- pci_map_single(E1, E2, E3, E4)
+ dma_map_single(&E1->dev, E2, E3, E4)

@@ expression E1, E2, E3, E4; @@
- pci_unmap_single(E1, E2, E3, E4)
+ dma_unmap_single(&E1->dev, E2, E3, E4)

@@ expression E1, E2, E3, E4, E5; @@
- pci_map_page(E1, E2, E3, E4, E5)
+ dma_map_page(&E1->dev, E2, E3, E4, E5)

@@ expression E1, E2, E3, E4; @@
- pci_unmap_page(E1, E2, E3, E4)
+ dma_unmap_page(&E1->dev, E2, E3, E4)

@@ expression E1, E2, E3, E4; @@
- pci_map_sg(E1, E2, E3, E4)
+ dma_map_sg(&E1->dev, E2, E3, E4)

@@ expression E1, E2, E3, E4; @@
- pci_unmap_sg(E1, E2, E3, E4)
+ dma_unmap_sg(&E1->dev, E2, E3, E4)

@@ expression E1, E2, E3, E4; @@
- pci_dma_sync_single_for_cpu(E1, E2, E3, E4)
+ dma_sync_single_for_cpu(&E1->dev, E2, E3, E4)

@@ expression E1, E2, E3, E4; @@
- pci_dma_sync_single_for_device(E1, E2, E3, E4)
+ dma_sync_single_for_device(&E1->dev, E2, E3, E4)

@@ expression E1, E2, E3, E4; @@
- pci_dma_sync_sg_for_cpu(E1, E2, E3, E4)
+ dma_sync_sg_for_cpu(&E1->dev, E2, E3, E4)

@@ expression E1, E2, E3, E4; @@
- pci_dma_sync_sg_for_device(E1, E2, E3, E4)
+ dma_sync_sg_for_device(&E1->dev, E2, E3, E4)

@@ expression E1, E2; @@
- pci_dma_mapping_error(E1, E2)
+ dma_mapping_error(&E1->dev, E2)

@@ expression E1, E2; @@
- pci_set_consistent_dma_mask(E1, E2)
+ dma_set_coherent_mask(&E1->dev, E2)

@@ expression E1, E2; @@
- pci_set_dma_mask(E1, E2)
+ dma_set_mask(&E1->dev, E2)

Link: https://lore.kernel.org/r/635cfc08b83a041708ee6afbc430087416f2605c.1596045683.git.usuraj35@gmail.comSigned-off-by: default avatarSuraj Upadhyay <usuraj35@gmail.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 8d1f1ffa
...@@ -133,8 +133,10 @@ mega_setup_mailbox(adapter_t *adapter) ...@@ -133,8 +133,10 @@ mega_setup_mailbox(adapter_t *adapter)
{ {
unsigned long align; unsigned long align;
adapter->una_mbox64 = pci_alloc_consistent(adapter->dev, adapter->una_mbox64 = dma_alloc_coherent(&adapter->dev->dev,
sizeof(mbox64_t), &adapter->una_mbox64_dma); sizeof(mbox64_t),
&adapter->una_mbox64_dma,
GFP_KERNEL);
if( !adapter->una_mbox64 ) return -1; if( !adapter->una_mbox64 ) return -1;
...@@ -222,8 +224,9 @@ mega_query_adapter(adapter_t *adapter) ...@@ -222,8 +224,9 @@ mega_query_adapter(adapter_t *adapter)
mraid_inquiry *inq; mraid_inquiry *inq;
dma_addr_t dma_handle; dma_addr_t dma_handle;
ext_inq = pci_alloc_consistent(adapter->dev, ext_inq = dma_alloc_coherent(&adapter->dev->dev,
sizeof(mraid_ext_inquiry), &dma_handle); sizeof(mraid_ext_inquiry),
&dma_handle, GFP_KERNEL);
if( ext_inq == NULL ) return -1; if( ext_inq == NULL ) return -1;
...@@ -243,8 +246,9 @@ mega_query_adapter(adapter_t *adapter) ...@@ -243,8 +246,9 @@ mega_query_adapter(adapter_t *adapter)
mega_8_to_40ld(inq, inquiry3, mega_8_to_40ld(inq, inquiry3,
(mega_product_info *)&adapter->product_info); (mega_product_info *)&adapter->product_info);
pci_free_consistent(adapter->dev, sizeof(mraid_ext_inquiry), dma_free_coherent(&adapter->dev->dev,
ext_inq, dma_handle); sizeof(mraid_ext_inquiry), ext_inq,
dma_handle);
} else { /*adapter supports 40ld */ } else { /*adapter supports 40ld */
adapter->flag |= BOARD_40LD; adapter->flag |= BOARD_40LD;
...@@ -253,9 +257,10 @@ mega_query_adapter(adapter_t *adapter) ...@@ -253,9 +257,10 @@ mega_query_adapter(adapter_t *adapter)
* get product_info, which is static information and will be * get product_info, which is static information and will be
* unchanged * unchanged
*/ */
prod_info_dma_handle = pci_map_single(adapter->dev, (void *) prod_info_dma_handle = dma_map_single(&adapter->dev->dev,
&adapter->product_info, (void *)&adapter->product_info,
sizeof(mega_product_info), PCI_DMA_FROMDEVICE); sizeof(mega_product_info),
DMA_FROM_DEVICE);
mbox->m_out.xferaddr = prod_info_dma_handle; mbox->m_out.xferaddr = prod_info_dma_handle;
...@@ -267,8 +272,8 @@ mega_query_adapter(adapter_t *adapter) ...@@ -267,8 +272,8 @@ mega_query_adapter(adapter_t *adapter)
"Product_info cmd failed with error: %d\n", "Product_info cmd failed with error: %d\n",
retval); retval);
pci_unmap_single(adapter->dev, prod_info_dma_handle, dma_unmap_single(&adapter->dev->dev, prod_info_dma_handle,
sizeof(mega_product_info), PCI_DMA_FROMDEVICE); sizeof(mega_product_info), DMA_FROM_DEVICE);
} }
...@@ -645,7 +650,7 @@ mega_build_cmd(adapter_t *adapter, struct scsi_cmnd *cmd, int *busy) ...@@ -645,7 +650,7 @@ mega_build_cmd(adapter_t *adapter, struct scsi_cmnd *cmd, int *busy)
scb->raw_mbox[2] = MEGA_RESERVATION_STATUS; scb->raw_mbox[2] = MEGA_RESERVATION_STATUS;
scb->raw_mbox[3] = ldrv_num; scb->raw_mbox[3] = ldrv_num;
scb->dma_direction = PCI_DMA_NONE; scb->dma_direction = DMA_NONE;
return scb; return scb;
#else #else
...@@ -709,7 +714,7 @@ mega_build_cmd(adapter_t *adapter, struct scsi_cmnd *cmd, int *busy) ...@@ -709,7 +714,7 @@ mega_build_cmd(adapter_t *adapter, struct scsi_cmnd *cmd, int *busy)
mbox->m_out.cmd = MEGA_MBOXCMD_PASSTHRU; mbox->m_out.cmd = MEGA_MBOXCMD_PASSTHRU;
} }
scb->dma_direction = PCI_DMA_FROMDEVICE; scb->dma_direction = DMA_FROM_DEVICE;
pthru->numsgelements = mega_build_sglist(adapter, scb, pthru->numsgelements = mega_build_sglist(adapter, scb,
&pthru->dataxferaddr, &pthru->dataxferlen); &pthru->dataxferaddr, &pthru->dataxferlen);
...@@ -839,10 +844,10 @@ mega_build_cmd(adapter_t *adapter, struct scsi_cmnd *cmd, int *busy) ...@@ -839,10 +844,10 @@ mega_build_cmd(adapter_t *adapter, struct scsi_cmnd *cmd, int *busy)
* If it is a read command * If it is a read command
*/ */
if( (*cmd->cmnd & 0x0F) == 0x08 ) { if( (*cmd->cmnd & 0x0F) == 0x08 ) {
scb->dma_direction = PCI_DMA_FROMDEVICE; scb->dma_direction = DMA_FROM_DEVICE;
} }
else { else {
scb->dma_direction = PCI_DMA_TODEVICE; scb->dma_direction = DMA_TO_DEVICE;
} }
/* Calculate Scatter-Gather info */ /* Calculate Scatter-Gather info */
...@@ -877,7 +882,7 @@ mega_build_cmd(adapter_t *adapter, struct scsi_cmnd *cmd, int *busy) ...@@ -877,7 +882,7 @@ mega_build_cmd(adapter_t *adapter, struct scsi_cmnd *cmd, int *busy)
scb->raw_mbox[3] = ldrv_num; scb->raw_mbox[3] = ldrv_num;
scb->dma_direction = PCI_DMA_NONE; scb->dma_direction = DMA_NONE;
return scb; return scb;
#endif #endif
...@@ -971,7 +976,7 @@ mega_prepare_passthru(adapter_t *adapter, scb_t *scb, struct scsi_cmnd *cmd, ...@@ -971,7 +976,7 @@ mega_prepare_passthru(adapter_t *adapter, scb_t *scb, struct scsi_cmnd *cmd,
memcpy(pthru->cdb, cmd->cmnd, cmd->cmd_len); memcpy(pthru->cdb, cmd->cmnd, cmd->cmd_len);
/* Not sure about the direction */ /* Not sure about the direction */
scb->dma_direction = PCI_DMA_BIDIRECTIONAL; scb->dma_direction = DMA_BIDIRECTIONAL;
/* Special Code for Handling READ_CAPA/ INQ using bounce buffers */ /* Special Code for Handling READ_CAPA/ INQ using bounce buffers */
switch (cmd->cmnd[0]) { switch (cmd->cmnd[0]) {
...@@ -1035,7 +1040,7 @@ mega_prepare_extpassthru(adapter_t *adapter, scb_t *scb, ...@@ -1035,7 +1040,7 @@ mega_prepare_extpassthru(adapter_t *adapter, scb_t *scb,
memcpy(epthru->cdb, cmd->cmnd, cmd->cmd_len); memcpy(epthru->cdb, cmd->cmnd, cmd->cmd_len);
/* Not sure about the direction */ /* Not sure about the direction */
scb->dma_direction = PCI_DMA_BIDIRECTIONAL; scb->dma_direction = DMA_BIDIRECTIONAL;
switch(cmd->cmnd[0]) { switch(cmd->cmnd[0]) {
case INQUIRY: case INQUIRY:
...@@ -1813,23 +1818,23 @@ mega_free_sgl(adapter_t *adapter) ...@@ -1813,23 +1818,23 @@ mega_free_sgl(adapter_t *adapter)
scb = &adapter->scb_list[i]; scb = &adapter->scb_list[i];
if( scb->sgl64 ) { if( scb->sgl64 ) {
pci_free_consistent(adapter->dev, dma_free_coherent(&adapter->dev->dev,
sizeof(mega_sgl64) * adapter->sglen, sizeof(mega_sgl64) * adapter->sglen,
scb->sgl64, scb->sgl64, scb->sgl_dma_addr);
scb->sgl_dma_addr);
scb->sgl64 = NULL; scb->sgl64 = NULL;
} }
if( scb->pthru ) { if( scb->pthru ) {
pci_free_consistent(adapter->dev, sizeof(mega_passthru), dma_free_coherent(&adapter->dev->dev,
scb->pthru, scb->pthru_dma_addr); sizeof(mega_passthru), scb->pthru,
scb->pthru_dma_addr);
scb->pthru = NULL; scb->pthru = NULL;
} }
if( scb->epthru ) { if( scb->epthru ) {
pci_free_consistent(adapter->dev, dma_free_coherent(&adapter->dev->dev,
sizeof(mega_ext_passthru), sizeof(mega_ext_passthru),
scb->epthru, scb->epthru_dma_addr); scb->epthru, scb->epthru_dma_addr);
...@@ -2004,7 +2009,7 @@ make_local_pdev(adapter_t *adapter, struct pci_dev **pdev) ...@@ -2004,7 +2009,7 @@ make_local_pdev(adapter_t *adapter, struct pci_dev **pdev)
memcpy(*pdev, adapter->dev, sizeof(struct pci_dev)); memcpy(*pdev, adapter->dev, sizeof(struct pci_dev));
if( pci_set_dma_mask(*pdev, DMA_BIT_MASK(32)) != 0 ) { if (dma_set_mask(&(*pdev)->dev, DMA_BIT_MASK(32)) != 0) {
kfree(*pdev); kfree(*pdev);
return -1; return -1;
} }
...@@ -2028,14 +2033,16 @@ free_local_pdev(struct pci_dev *pdev) ...@@ -2028,14 +2033,16 @@ free_local_pdev(struct pci_dev *pdev)
static inline void * static inline void *
mega_allocate_inquiry(dma_addr_t *dma_handle, struct pci_dev *pdev) mega_allocate_inquiry(dma_addr_t *dma_handle, struct pci_dev *pdev)
{ {
return pci_alloc_consistent(pdev, sizeof(mega_inquiry3), dma_handle); return dma_alloc_coherent(&pdev->dev, sizeof(mega_inquiry3),
dma_handle, GFP_KERNEL);
} }
static inline void static inline void
mega_free_inquiry(void *inquiry, dma_addr_t dma_handle, struct pci_dev *pdev) mega_free_inquiry(void *inquiry, dma_addr_t dma_handle, struct pci_dev *pdev)
{ {
pci_free_consistent(pdev, sizeof(mega_inquiry3), inquiry, dma_handle); dma_free_coherent(&pdev->dev, sizeof(mega_inquiry3), inquiry,
dma_handle);
} }
...@@ -2349,7 +2356,8 @@ proc_show_pdrv(struct seq_file *m, adapter_t *adapter, int channel) ...@@ -2349,7 +2356,8 @@ proc_show_pdrv(struct seq_file *m, adapter_t *adapter, int channel)
} }
scsi_inq = pci_alloc_consistent(pdev, 256, &scsi_inq_dma_handle); scsi_inq = dma_alloc_coherent(&pdev->dev, 256, &scsi_inq_dma_handle,
GFP_KERNEL);
if( scsi_inq == NULL ) { if( scsi_inq == NULL ) {
seq_puts(m, "memory not available for scsi inq.\n"); seq_puts(m, "memory not available for scsi inq.\n");
goto free_inquiry; goto free_inquiry;
...@@ -2422,7 +2430,7 @@ proc_show_pdrv(struct seq_file *m, adapter_t *adapter, int channel) ...@@ -2422,7 +2430,7 @@ proc_show_pdrv(struct seq_file *m, adapter_t *adapter, int channel)
} }
free_pci: free_pci:
pci_free_consistent(pdev, 256, scsi_inq, scsi_inq_dma_handle); dma_free_coherent(&pdev->dev, 256, scsi_inq, scsi_inq_dma_handle);
free_inquiry: free_inquiry:
mega_free_inquiry(inquiry, dma_handle, pdev); mega_free_inquiry(inquiry, dma_handle, pdev);
free_pdev: free_pdev:
...@@ -2542,8 +2550,8 @@ proc_show_rdrv(struct seq_file *m, adapter_t *adapter, int start, int end ) ...@@ -2542,8 +2550,8 @@ proc_show_rdrv(struct seq_file *m, adapter_t *adapter, int start, int end )
raid_inq.logdrv_info.num_ldrv; raid_inq.logdrv_info.num_ldrv;
} }
disk_array = pci_alloc_consistent(pdev, array_sz, disk_array = dma_alloc_coherent(&pdev->dev, array_sz,
&disk_array_dma_handle); &disk_array_dma_handle, GFP_KERNEL);
if( disk_array == NULL ) { if( disk_array == NULL ) {
seq_puts(m, "memory not available.\n"); seq_puts(m, "memory not available.\n");
...@@ -2662,7 +2670,7 @@ proc_show_rdrv(struct seq_file *m, adapter_t *adapter, int start, int end ) ...@@ -2662,7 +2670,7 @@ proc_show_rdrv(struct seq_file *m, adapter_t *adapter, int start, int end )
} }
free_pci: free_pci:
pci_free_consistent(pdev, array_sz, disk_array, dma_free_coherent(&pdev->dev, array_sz, disk_array,
disk_array_dma_handle); disk_array_dma_handle);
free_inquiry: free_inquiry:
mega_free_inquiry(inquiry, dma_handle, pdev); mega_free_inquiry(inquiry, dma_handle, pdev);
...@@ -2881,9 +2889,9 @@ mega_init_scb(adapter_t *adapter) ...@@ -2881,9 +2889,9 @@ mega_init_scb(adapter_t *adapter)
scb->idx = i; scb->idx = i;
scb->sgl64 = pci_alloc_consistent(adapter->dev, scb->sgl64 = dma_alloc_coherent(&adapter->dev->dev,
sizeof(mega_sgl64) * adapter->sglen, sizeof(mega_sgl64) * adapter->sglen,
&scb->sgl_dma_addr); &scb->sgl_dma_addr, GFP_KERNEL);
scb->sgl = (mega_sglist *)scb->sgl64; scb->sgl = (mega_sglist *)scb->sgl64;
...@@ -2893,9 +2901,9 @@ mega_init_scb(adapter_t *adapter) ...@@ -2893,9 +2901,9 @@ mega_init_scb(adapter_t *adapter)
return -1; return -1;
} }
scb->pthru = pci_alloc_consistent(adapter->dev, scb->pthru = dma_alloc_coherent(&adapter->dev->dev,
sizeof(mega_passthru), sizeof(mega_passthru),
&scb->pthru_dma_addr); &scb->pthru_dma_addr, GFP_KERNEL);
if( !scb->pthru ) { if( !scb->pthru ) {
dev_warn(&adapter->dev->dev, "RAID: Can't allocate passthru\n"); dev_warn(&adapter->dev->dev, "RAID: Can't allocate passthru\n");
...@@ -2903,9 +2911,9 @@ mega_init_scb(adapter_t *adapter) ...@@ -2903,9 +2911,9 @@ mega_init_scb(adapter_t *adapter)
return -1; return -1;
} }
scb->epthru = pci_alloc_consistent(adapter->dev, scb->epthru = dma_alloc_coherent(&adapter->dev->dev,
sizeof(mega_ext_passthru), sizeof(mega_ext_passthru),
&scb->epthru_dma_addr); &scb->epthru_dma_addr, GFP_KERNEL);
if( !scb->epthru ) { if( !scb->epthru ) {
dev_warn(&adapter->dev->dev, dev_warn(&adapter->dev->dev,
...@@ -3145,9 +3153,9 @@ megadev_ioctl(struct file *filep, unsigned int cmd, unsigned long arg) ...@@ -3145,9 +3153,9 @@ megadev_ioctl(struct file *filep, unsigned int cmd, unsigned long arg)
if( uioc.uioc_rmbox[0] == MEGA_MBOXCMD_PASSTHRU ) { if( uioc.uioc_rmbox[0] == MEGA_MBOXCMD_PASSTHRU ) {
/* Passthru commands */ /* Passthru commands */
pthru = pci_alloc_consistent(pdev, pthru = dma_alloc_coherent(&pdev->dev,
sizeof(mega_passthru), sizeof(mega_passthru),
&pthru_dma_hndl); &pthru_dma_hndl, GFP_KERNEL);
if( pthru == NULL ) { if( pthru == NULL ) {
free_local_pdev(pdev); free_local_pdev(pdev);
...@@ -3165,9 +3173,9 @@ megadev_ioctl(struct file *filep, unsigned int cmd, unsigned long arg) ...@@ -3165,9 +3173,9 @@ megadev_ioctl(struct file *filep, unsigned int cmd, unsigned long arg)
if( copy_from_user(pthru, upthru, if( copy_from_user(pthru, upthru,
sizeof(mega_passthru)) ) { sizeof(mega_passthru)) ) {
pci_free_consistent(pdev, dma_free_coherent(&pdev->dev,
sizeof(mega_passthru), pthru, sizeof(mega_passthru),
pthru_dma_hndl); pthru, pthru_dma_hndl);
free_local_pdev(pdev); free_local_pdev(pdev);
...@@ -3178,12 +3186,13 @@ megadev_ioctl(struct file *filep, unsigned int cmd, unsigned long arg) ...@@ -3178,12 +3186,13 @@ megadev_ioctl(struct file *filep, unsigned int cmd, unsigned long arg)
* Is there a data transfer * Is there a data transfer
*/ */
if( pthru->dataxferlen ) { if( pthru->dataxferlen ) {
data = pci_alloc_consistent(pdev, data = dma_alloc_coherent(&pdev->dev,
pthru->dataxferlen, pthru->dataxferlen,
&data_dma_hndl); &data_dma_hndl,
GFP_KERNEL);
if( data == NULL ) { if( data == NULL ) {
pci_free_consistent(pdev, dma_free_coherent(&pdev->dev,
sizeof(mega_passthru), sizeof(mega_passthru),
pthru, pthru,
pthru_dma_hndl); pthru_dma_hndl);
...@@ -3251,12 +3260,12 @@ megadev_ioctl(struct file *filep, unsigned int cmd, unsigned long arg) ...@@ -3251,12 +3260,12 @@ megadev_ioctl(struct file *filep, unsigned int cmd, unsigned long arg)
freemem_and_return: freemem_and_return:
if( pthru->dataxferlen ) { if( pthru->dataxferlen ) {
pci_free_consistent(pdev, dma_free_coherent(&pdev->dev,
pthru->dataxferlen, data, pthru->dataxferlen, data,
data_dma_hndl); data_dma_hndl);
} }
pci_free_consistent(pdev, sizeof(mega_passthru), dma_free_coherent(&pdev->dev, sizeof(mega_passthru),
pthru, pthru_dma_hndl); pthru, pthru_dma_hndl);
free_local_pdev(pdev); free_local_pdev(pdev);
...@@ -3270,8 +3279,10 @@ megadev_ioctl(struct file *filep, unsigned int cmd, unsigned long arg) ...@@ -3270,8 +3279,10 @@ megadev_ioctl(struct file *filep, unsigned int cmd, unsigned long arg)
* Is there a data transfer * Is there a data transfer
*/ */
if( uioc.xferlen ) { if( uioc.xferlen ) {
data = pci_alloc_consistent(pdev, data = dma_alloc_coherent(&pdev->dev,
uioc.xferlen, &data_dma_hndl); uioc.xferlen,
&data_dma_hndl,
GFP_KERNEL);
if( data == NULL ) { if( data == NULL ) {
free_local_pdev(pdev); free_local_pdev(pdev);
...@@ -3291,9 +3302,9 @@ megadev_ioctl(struct file *filep, unsigned int cmd, unsigned long arg) ...@@ -3291,9 +3302,9 @@ megadev_ioctl(struct file *filep, unsigned int cmd, unsigned long arg)
if( copy_from_user(data, (char __user *)(unsigned long) uxferaddr, if( copy_from_user(data, (char __user *)(unsigned long) uxferaddr,
uioc.xferlen) ) { uioc.xferlen) ) {
pci_free_consistent(pdev, dma_free_coherent(&pdev->dev,
uioc.xferlen, uioc.xferlen, data,
data, data_dma_hndl); data_dma_hndl);
free_local_pdev(pdev); free_local_pdev(pdev);
...@@ -3314,7 +3325,7 @@ megadev_ioctl(struct file *filep, unsigned int cmd, unsigned long arg) ...@@ -3314,7 +3325,7 @@ megadev_ioctl(struct file *filep, unsigned int cmd, unsigned long arg)
if( rval ) { if( rval ) {
if( uioc.xferlen ) { if( uioc.xferlen ) {
pci_free_consistent(pdev, dma_free_coherent(&pdev->dev,
uioc.xferlen, data, uioc.xferlen, data,
data_dma_hndl); data_dma_hndl);
} }
...@@ -3336,9 +3347,8 @@ megadev_ioctl(struct file *filep, unsigned int cmd, unsigned long arg) ...@@ -3336,9 +3347,8 @@ megadev_ioctl(struct file *filep, unsigned int cmd, unsigned long arg)
} }
if( uioc.xferlen ) { if( uioc.xferlen ) {
pci_free_consistent(pdev, dma_free_coherent(&pdev->dev, uioc.xferlen,
uioc.xferlen, data, data, data_dma_hndl);
data_dma_hndl);
} }
free_local_pdev(pdev); free_local_pdev(pdev);
...@@ -4004,8 +4014,8 @@ mega_internal_dev_inquiry(adapter_t *adapter, u8 ch, u8 tgt, ...@@ -4004,8 +4014,8 @@ mega_internal_dev_inquiry(adapter_t *adapter, u8 ch, u8 tgt,
*/ */
if( make_local_pdev(adapter, &pdev) != 0 ) return -1; if( make_local_pdev(adapter, &pdev) != 0 ) return -1;
pthru = pci_alloc_consistent(pdev, sizeof(mega_passthru), pthru = dma_alloc_coherent(&pdev->dev, sizeof(mega_passthru),
&pthru_dma_handle); &pthru_dma_handle, GFP_KERNEL);
if( pthru == NULL ) { if( pthru == NULL ) {
free_local_pdev(pdev); free_local_pdev(pdev);
...@@ -4041,7 +4051,7 @@ mega_internal_dev_inquiry(adapter_t *adapter, u8 ch, u8 tgt, ...@@ -4041,7 +4051,7 @@ mega_internal_dev_inquiry(adapter_t *adapter, u8 ch, u8 tgt,
rval = mega_internal_command(adapter, &mc, pthru); rval = mega_internal_command(adapter, &mc, pthru);
pci_free_consistent(pdev, sizeof(mega_passthru), pthru, dma_free_coherent(&pdev->dev, sizeof(mega_passthru), pthru,
pthru_dma_handle); pthru_dma_handle);
free_local_pdev(pdev); free_local_pdev(pdev);
...@@ -4267,8 +4277,10 @@ megaraid_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) ...@@ -4267,8 +4277,10 @@ megaraid_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
/* /*
* Allocate buffer to issue internal commands. * Allocate buffer to issue internal commands.
*/ */
adapter->mega_buffer = pci_alloc_consistent(adapter->dev, adapter->mega_buffer = dma_alloc_coherent(&adapter->dev->dev,
MEGA_BUFFER_SIZE, &adapter->buf_dma_handle); MEGA_BUFFER_SIZE,
&adapter->buf_dma_handle,
GFP_KERNEL);
if (!adapter->mega_buffer) { if (!adapter->mega_buffer) {
dev_warn(&pdev->dev, "out of RAM\n"); dev_warn(&pdev->dev, "out of RAM\n");
goto out_host_put; goto out_host_put;
...@@ -4427,10 +4439,10 @@ megaraid_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) ...@@ -4427,10 +4439,10 @@ megaraid_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
/* Set the Mode of addressing to 64 bit if we can */ /* Set the Mode of addressing to 64 bit if we can */
if ((adapter->flag & BOARD_64BIT) && (sizeof(dma_addr_t) == 8)) { if ((adapter->flag & BOARD_64BIT) && (sizeof(dma_addr_t) == 8)) {
pci_set_dma_mask(pdev, DMA_BIT_MASK(64)); dma_set_mask(&pdev->dev, DMA_BIT_MASK(64));
adapter->has_64bit_addr = 1; adapter->has_64bit_addr = 1;
} else { } else {
pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); dma_set_mask(&pdev->dev, DMA_BIT_MASK(32));
adapter->has_64bit_addr = 0; adapter->has_64bit_addr = 0;
} }
...@@ -4469,14 +4481,14 @@ megaraid_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) ...@@ -4469,14 +4481,14 @@ megaraid_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
return 0; return 0;
out_free_mbox: out_free_mbox:
pci_free_consistent(adapter->dev, sizeof(mbox64_t), dma_free_coherent(&adapter->dev->dev, sizeof(mbox64_t),
adapter->una_mbox64, adapter->una_mbox64_dma); adapter->una_mbox64, adapter->una_mbox64_dma);
out_free_irq: out_free_irq:
free_irq(adapter->host->irq, adapter); free_irq(adapter->host->irq, adapter);
out_free_scb_list: out_free_scb_list:
kfree(adapter->scb_list); kfree(adapter->scb_list);
out_free_cmd_buffer: out_free_cmd_buffer:
pci_free_consistent(adapter->dev, MEGA_BUFFER_SIZE, dma_free_coherent(&adapter->dev->dev, MEGA_BUFFER_SIZE,
adapter->mega_buffer, adapter->buf_dma_handle); adapter->mega_buffer, adapter->buf_dma_handle);
out_host_put: out_host_put:
scsi_host_put(host); scsi_host_put(host);
...@@ -4551,10 +4563,10 @@ megaraid_remove_one(struct pci_dev *pdev) ...@@ -4551,10 +4563,10 @@ megaraid_remove_one(struct pci_dev *pdev)
sprintf(buf, "hba%d", adapter->host->host_no); sprintf(buf, "hba%d", adapter->host->host_no);
remove_proc_subtree(buf, mega_proc_dir_entry); remove_proc_subtree(buf, mega_proc_dir_entry);
pci_free_consistent(adapter->dev, MEGA_BUFFER_SIZE, dma_free_coherent(&adapter->dev->dev, MEGA_BUFFER_SIZE,
adapter->mega_buffer, adapter->buf_dma_handle); adapter->mega_buffer, adapter->buf_dma_handle);
kfree(adapter->scb_list); kfree(adapter->scb_list);
pci_free_consistent(adapter->dev, sizeof(mbox64_t), dma_free_coherent(&adapter->dev->dev, sizeof(mbox64_t),
adapter->una_mbox64, adapter->una_mbox64_dma); adapter->una_mbox64, adapter->una_mbox64_dma);
scsi_host_put(host); scsi_host_put(host);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment