Commit 17a361b2 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Martin K. Petersen

scsi: BusLogic: switch to generic DMA API

Switch from the legacy PCI DMA API to the generic DMA API.
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarJohannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent b1fa1229
...@@ -201,8 +201,8 @@ static bool __init blogic_create_initccbs(struct blogic_adapter *adapter) ...@@ -201,8 +201,8 @@ static bool __init blogic_create_initccbs(struct blogic_adapter *adapter)
dma_addr_t blkp; dma_addr_t blkp;
while (adapter->alloc_ccbs < adapter->initccbs) { while (adapter->alloc_ccbs < adapter->initccbs) {
blk_pointer = pci_alloc_consistent(adapter->pci_device, blk_pointer = dma_alloc_coherent(&adapter->pci_device->dev,
blk_size, &blkp); blk_size, &blkp, GFP_KERNEL);
if (blk_pointer == NULL) { if (blk_pointer == NULL) {
blogic_err("UNABLE TO ALLOCATE CCB GROUP - DETACHING\n", blogic_err("UNABLE TO ALLOCATE CCB GROUP - DETACHING\n",
adapter); adapter);
...@@ -227,15 +227,16 @@ static void blogic_destroy_ccbs(struct blogic_adapter *adapter) ...@@ -227,15 +227,16 @@ static void blogic_destroy_ccbs(struct blogic_adapter *adapter)
next_ccb = ccb->next_all; next_ccb = ccb->next_all;
if (ccb->allocgrp_head) { if (ccb->allocgrp_head) {
if (lastccb) if (lastccb)
pci_free_consistent(adapter->pci_device, dma_free_coherent(&adapter->pci_device->dev,
lastccb->allocgrp_size, lastccb, lastccb->allocgrp_size, lastccb,
lastccb->allocgrp_head); lastccb->allocgrp_head);
lastccb = ccb; lastccb = ccb;
} }
} }
if (lastccb) if (lastccb)
pci_free_consistent(adapter->pci_device, lastccb->allocgrp_size, dma_free_coherent(&adapter->pci_device->dev,
lastccb, lastccb->allocgrp_head); lastccb->allocgrp_size, lastccb,
lastccb->allocgrp_head);
} }
...@@ -256,8 +257,8 @@ static void blogic_create_addlccbs(struct blogic_adapter *adapter, ...@@ -256,8 +257,8 @@ static void blogic_create_addlccbs(struct blogic_adapter *adapter,
if (addl_ccbs <= 0) if (addl_ccbs <= 0)
return; return;
while (adapter->alloc_ccbs - prev_alloc < addl_ccbs) { while (adapter->alloc_ccbs - prev_alloc < addl_ccbs) {
blk_pointer = pci_alloc_consistent(adapter->pci_device, blk_pointer = dma_alloc_coherent(&adapter->pci_device->dev,
blk_size, &blkp); blk_size, &blkp, GFP_KERNEL);
if (blk_pointer == NULL) if (blk_pointer == NULL)
break; break;
blogic_init_ccbs(adapter, blk_pointer, blk_size, blkp); blogic_init_ccbs(adapter, blk_pointer, blk_size, blkp);
...@@ -318,8 +319,8 @@ static void blogic_dealloc_ccb(struct blogic_ccb *ccb, int dma_unmap) ...@@ -318,8 +319,8 @@ static void blogic_dealloc_ccb(struct blogic_ccb *ccb, int dma_unmap)
if (ccb->command != NULL) if (ccb->command != NULL)
scsi_dma_unmap(ccb->command); scsi_dma_unmap(ccb->command);
if (dma_unmap) if (dma_unmap)
pci_unmap_single(adapter->pci_device, ccb->sensedata, dma_unmap_single(&adapter->pci_device->dev, ccb->sensedata,
ccb->sense_datalen, PCI_DMA_FROMDEVICE); ccb->sense_datalen, DMA_FROM_DEVICE);
ccb->command = NULL; ccb->command = NULL;
ccb->status = BLOGIC_CCB_FREE; ccb->status = BLOGIC_CCB_FREE;
...@@ -712,7 +713,7 @@ static int __init blogic_init_mm_probeinfo(struct blogic_adapter *adapter) ...@@ -712,7 +713,7 @@ static int __init blogic_init_mm_probeinfo(struct blogic_adapter *adapter)
if (pci_enable_device(pci_device)) if (pci_enable_device(pci_device))
continue; continue;
if (pci_set_dma_mask(pci_device, DMA_BIT_MASK(32))) if (dma_set_mask(&pci_device->dev, DMA_BIT_MASK(32)))
continue; continue;
bus = pci_device->bus->number; bus = pci_device->bus->number;
...@@ -895,7 +896,7 @@ static int __init blogic_init_mm_probeinfo(struct blogic_adapter *adapter) ...@@ -895,7 +896,7 @@ static int __init blogic_init_mm_probeinfo(struct blogic_adapter *adapter)
if (pci_enable_device(pci_device)) if (pci_enable_device(pci_device))
continue; continue;
if (pci_set_dma_mask(pci_device, DMA_BIT_MASK(32))) if (dma_set_mask(&pci_device->dev, DMA_BIT_MASK(32)))
continue; continue;
bus = pci_device->bus->number; bus = pci_device->bus->number;
...@@ -952,7 +953,7 @@ static int __init blogic_init_fp_probeinfo(struct blogic_adapter *adapter) ...@@ -952,7 +953,7 @@ static int __init blogic_init_fp_probeinfo(struct blogic_adapter *adapter)
if (pci_enable_device(pci_device)) if (pci_enable_device(pci_device))
continue; continue;
if (pci_set_dma_mask(pci_device, DMA_BIT_MASK(32))) if (dma_set_mask(&pci_device->dev, DMA_BIT_MASK(32)))
continue; continue;
bus = pci_device->bus->number; bus = pci_device->bus->number;
...@@ -2040,7 +2041,7 @@ static void blogic_relres(struct blogic_adapter *adapter) ...@@ -2040,7 +2041,7 @@ static void blogic_relres(struct blogic_adapter *adapter)
Release any allocated memory structs not released elsewhere Release any allocated memory structs not released elsewhere
*/ */
if (adapter->mbox_space) if (adapter->mbox_space)
pci_free_consistent(adapter->pci_device, adapter->mbox_sz, dma_free_coherent(&adapter->pci_device->dev, adapter->mbox_sz,
adapter->mbox_space, adapter->mbox_space_handle); adapter->mbox_space, adapter->mbox_space_handle);
pci_dev_put(adapter->pci_device); pci_dev_put(adapter->pci_device);
adapter->mbox_space = NULL; adapter->mbox_space = NULL;
...@@ -2092,8 +2093,9 @@ static bool blogic_initadapter(struct blogic_adapter *adapter) ...@@ -2092,8 +2093,9 @@ static bool blogic_initadapter(struct blogic_adapter *adapter)
Initialize the Outgoing and Incoming Mailbox pointers. Initialize the Outgoing and Incoming Mailbox pointers.
*/ */
adapter->mbox_sz = adapter->mbox_count * (sizeof(struct blogic_outbox) + sizeof(struct blogic_inbox)); adapter->mbox_sz = adapter->mbox_count * (sizeof(struct blogic_outbox) + sizeof(struct blogic_inbox));
adapter->mbox_space = pci_alloc_consistent(adapter->pci_device, adapter->mbox_space = dma_alloc_coherent(&adapter->pci_device->dev,
adapter->mbox_sz, &adapter->mbox_space_handle); adapter->mbox_sz, &adapter->mbox_space_handle,
GFP_KERNEL);
if (adapter->mbox_space == NULL) if (adapter->mbox_space == NULL)
return blogic_failure(adapter, "MAILBOX ALLOCATION"); return blogic_failure(adapter, "MAILBOX ALLOCATION");
adapter->first_outbox = (struct blogic_outbox *) adapter->mbox_space; adapter->first_outbox = (struct blogic_outbox *) adapter->mbox_space;
...@@ -3183,9 +3185,9 @@ static int blogic_qcmd_lck(struct scsi_cmnd *command, ...@@ -3183,9 +3185,9 @@ static int blogic_qcmd_lck(struct scsi_cmnd *command,
memcpy(ccb->cdb, cdb, cdblen); memcpy(ccb->cdb, cdb, cdblen);
ccb->sense_datalen = SCSI_SENSE_BUFFERSIZE; ccb->sense_datalen = SCSI_SENSE_BUFFERSIZE;
ccb->command = command; ccb->command = command;
sense_buf = pci_map_single(adapter->pci_device, sense_buf = dma_map_single(&adapter->pci_device->dev,
command->sense_buffer, ccb->sense_datalen, command->sense_buffer, ccb->sense_datalen,
PCI_DMA_FROMDEVICE); DMA_FROM_DEVICE);
if (dma_mapping_error(&adapter->pci_device->dev, sense_buf)) { if (dma_mapping_error(&adapter->pci_device->dev, sense_buf)) {
blogic_err("DMA mapping for sense data buffer failed\n", blogic_err("DMA mapping for sense data buffer failed\n",
adapter); adapter);
......
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