diff options
author | David S. Miller <davem@davemloft.net> | 2008-08-27 21:37:58 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-08-29 05:13:12 -0400 |
commit | 7a715f46012f3552294154978aed59cba9804928 (patch) | |
tree | 9e7079ae4ad370b63ac6c8a4face573d6cf60533 /drivers/scsi | |
parent | 5778002874de0fb7e3d8c4a0a4afb6b1a6297069 (diff) |
sparc: Make SBUS DMA interfaces take struct device.
This is the first step in converting all the SBUS drivers
over to generic dma_*().
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/scsi')
-rw-r--r-- | drivers/scsi/qlogicpti.c | 21 | ||||
-rw-r--r-- | drivers/scsi/sun_esp.c | 23 |
2 files changed, 27 insertions, 17 deletions
diff --git a/drivers/scsi/qlogicpti.c b/drivers/scsi/qlogicpti.c index 4a1cf6377f6c..f010506af884 100644 --- a/drivers/scsi/qlogicpti.c +++ b/drivers/scsi/qlogicpti.c | |||
@@ -788,7 +788,7 @@ static int __devinit qpti_map_queues(struct qlogicpti *qpti) | |||
788 | struct sbus_dev *sdev = qpti->sdev; | 788 | struct sbus_dev *sdev = qpti->sdev; |
789 | 789 | ||
790 | #define QSIZE(entries) (((entries) + 1) * QUEUE_ENTRY_LEN) | 790 | #define QSIZE(entries) (((entries) + 1) * QUEUE_ENTRY_LEN) |
791 | qpti->res_cpu = sbus_alloc_consistent(sdev, | 791 | qpti->res_cpu = sbus_alloc_consistent(&sdev->ofdev.dev, |
792 | QSIZE(RES_QUEUE_LEN), | 792 | QSIZE(RES_QUEUE_LEN), |
793 | &qpti->res_dvma); | 793 | &qpti->res_dvma); |
794 | if (qpti->res_cpu == NULL || | 794 | if (qpti->res_cpu == NULL || |
@@ -797,12 +797,12 @@ static int __devinit qpti_map_queues(struct qlogicpti *qpti) | |||
797 | return -1; | 797 | return -1; |
798 | } | 798 | } |
799 | 799 | ||
800 | qpti->req_cpu = sbus_alloc_consistent(sdev, | 800 | qpti->req_cpu = sbus_alloc_consistent(&sdev->ofdev.dev, |
801 | QSIZE(QLOGICPTI_REQ_QUEUE_LEN), | 801 | QSIZE(QLOGICPTI_REQ_QUEUE_LEN), |
802 | &qpti->req_dvma); | 802 | &qpti->req_dvma); |
803 | if (qpti->req_cpu == NULL || | 803 | if (qpti->req_cpu == NULL || |
804 | qpti->req_dvma == 0) { | 804 | qpti->req_dvma == 0) { |
805 | sbus_free_consistent(sdev, QSIZE(RES_QUEUE_LEN), | 805 | sbus_free_consistent(&sdev->ofdev.dev, QSIZE(RES_QUEUE_LEN), |
806 | qpti->res_cpu, qpti->res_dvma); | 806 | qpti->res_cpu, qpti->res_dvma); |
807 | printk("QPTI: Cannot map request queue.\n"); | 807 | printk("QPTI: Cannot map request queue.\n"); |
808 | return -1; | 808 | return -1; |
@@ -875,8 +875,9 @@ static inline int load_cmd(struct scsi_cmnd *Cmnd, struct Command_Entry *cmd, | |||
875 | int sg_count; | 875 | int sg_count; |
876 | 876 | ||
877 | sg = scsi_sglist(Cmnd); | 877 | sg = scsi_sglist(Cmnd); |
878 | sg_count = sbus_map_sg(qpti->sdev, sg, scsi_sg_count(Cmnd), | 878 | sg_count = sbus_map_sg(&qpti->sdev->ofdev.dev, sg, |
879 | Cmnd->sc_data_direction); | 879 | scsi_sg_count(Cmnd), |
880 | Cmnd->sc_data_direction); | ||
880 | 881 | ||
881 | ds = cmd->dataseg; | 882 | ds = cmd->dataseg; |
882 | cmd->segment_cnt = sg_count; | 883 | cmd->segment_cnt = sg_count; |
@@ -1151,7 +1152,7 @@ static struct scsi_cmnd *qlogicpti_intr_handler(struct qlogicpti *qpti) | |||
1151 | Cmnd->result = DID_ERROR << 16; | 1152 | Cmnd->result = DID_ERROR << 16; |
1152 | 1153 | ||
1153 | if (scsi_bufflen(Cmnd)) | 1154 | if (scsi_bufflen(Cmnd)) |
1154 | sbus_unmap_sg(qpti->sdev, | 1155 | sbus_unmap_sg(&qpti->sdev->ofdev.dev, |
1155 | scsi_sglist(Cmnd), scsi_sg_count(Cmnd), | 1156 | scsi_sglist(Cmnd), scsi_sg_count(Cmnd), |
1156 | Cmnd->sc_data_direction); | 1157 | Cmnd->sc_data_direction); |
1157 | 1158 | ||
@@ -1356,10 +1357,10 @@ static int __devinit qpti_sbus_probe(struct of_device *dev, const struct of_devi | |||
1356 | 1357 | ||
1357 | fail_unmap_queues: | 1358 | fail_unmap_queues: |
1358 | #define QSIZE(entries) (((entries) + 1) * QUEUE_ENTRY_LEN) | 1359 | #define QSIZE(entries) (((entries) + 1) * QUEUE_ENTRY_LEN) |
1359 | sbus_free_consistent(qpti->sdev, | 1360 | sbus_free_consistent(&qpti->sdev->ofdev.dev, |
1360 | QSIZE(RES_QUEUE_LEN), | 1361 | QSIZE(RES_QUEUE_LEN), |
1361 | qpti->res_cpu, qpti->res_dvma); | 1362 | qpti->res_cpu, qpti->res_dvma); |
1362 | sbus_free_consistent(qpti->sdev, | 1363 | sbus_free_consistent(&qpti->sdev->ofdev.dev, |
1363 | QSIZE(QLOGICPTI_REQ_QUEUE_LEN), | 1364 | QSIZE(QLOGICPTI_REQ_QUEUE_LEN), |
1364 | qpti->req_cpu, qpti->req_dvma); | 1365 | qpti->req_cpu, qpti->req_dvma); |
1365 | #undef QSIZE | 1366 | #undef QSIZE |
@@ -1394,10 +1395,10 @@ static int __devexit qpti_sbus_remove(struct of_device *dev) | |||
1394 | free_irq(qpti->irq, qpti); | 1395 | free_irq(qpti->irq, qpti); |
1395 | 1396 | ||
1396 | #define QSIZE(entries) (((entries) + 1) * QUEUE_ENTRY_LEN) | 1397 | #define QSIZE(entries) (((entries) + 1) * QUEUE_ENTRY_LEN) |
1397 | sbus_free_consistent(qpti->sdev, | 1398 | sbus_free_consistent(&qpti->sdev->ofdev.dev, |
1398 | QSIZE(RES_QUEUE_LEN), | 1399 | QSIZE(RES_QUEUE_LEN), |
1399 | qpti->res_cpu, qpti->res_dvma); | 1400 | qpti->res_cpu, qpti->res_dvma); |
1400 | sbus_free_consistent(qpti->sdev, | 1401 | sbus_free_consistent(&qpti->sdev->ofdev.dev, |
1401 | QSIZE(QLOGICPTI_REQ_QUEUE_LEN), | 1402 | QSIZE(QLOGICPTI_REQ_QUEUE_LEN), |
1402 | qpti->req_cpu, qpti->req_dvma); | 1403 | qpti->req_cpu, qpti->req_dvma); |
1403 | #undef QSIZE | 1404 | #undef QSIZE |
diff --git a/drivers/scsi/sun_esp.c b/drivers/scsi/sun_esp.c index d110b94f111e..35b6e2ccc394 100644 --- a/drivers/scsi/sun_esp.c +++ b/drivers/scsi/sun_esp.c | |||
@@ -101,7 +101,7 @@ static int __devinit esp_sbus_map_command_block(struct esp *esp) | |||
101 | { | 101 | { |
102 | struct sbus_dev *sdev = esp->dev; | 102 | struct sbus_dev *sdev = esp->dev; |
103 | 103 | ||
104 | esp->command_block = sbus_alloc_consistent(sdev, 16, | 104 | esp->command_block = sbus_alloc_consistent(&sdev->ofdev.dev, 16, |
105 | &esp->command_block_dma); | 105 | &esp->command_block_dma); |
106 | if (!esp->command_block) | 106 | if (!esp->command_block) |
107 | return -ENOMEM; | 107 | return -ENOMEM; |
@@ -223,25 +223,33 @@ static u8 sbus_esp_read8(struct esp *esp, unsigned long reg) | |||
223 | static dma_addr_t sbus_esp_map_single(struct esp *esp, void *buf, | 223 | static dma_addr_t sbus_esp_map_single(struct esp *esp, void *buf, |
224 | size_t sz, int dir) | 224 | size_t sz, int dir) |
225 | { | 225 | { |
226 | return sbus_map_single(esp->dev, buf, sz, dir); | 226 | struct sbus_dev *sdev = esp->dev; |
227 | |||
228 | return sbus_map_single(&sdev->ofdev.dev, buf, sz, dir); | ||
227 | } | 229 | } |
228 | 230 | ||
229 | static int sbus_esp_map_sg(struct esp *esp, struct scatterlist *sg, | 231 | static int sbus_esp_map_sg(struct esp *esp, struct scatterlist *sg, |
230 | int num_sg, int dir) | 232 | int num_sg, int dir) |
231 | { | 233 | { |
232 | return sbus_map_sg(esp->dev, sg, num_sg, dir); | 234 | struct sbus_dev *sdev = esp->dev; |
235 | |||
236 | return sbus_map_sg(&sdev->ofdev.dev, sg, num_sg, dir); | ||
233 | } | 237 | } |
234 | 238 | ||
235 | static void sbus_esp_unmap_single(struct esp *esp, dma_addr_t addr, | 239 | static void sbus_esp_unmap_single(struct esp *esp, dma_addr_t addr, |
236 | size_t sz, int dir) | 240 | size_t sz, int dir) |
237 | { | 241 | { |
238 | sbus_unmap_single(esp->dev, addr, sz, dir); | 242 | struct sbus_dev *sdev = esp->dev; |
243 | |||
244 | sbus_unmap_single(&sdev->ofdev.dev, addr, sz, dir); | ||
239 | } | 245 | } |
240 | 246 | ||
241 | static void sbus_esp_unmap_sg(struct esp *esp, struct scatterlist *sg, | 247 | static void sbus_esp_unmap_sg(struct esp *esp, struct scatterlist *sg, |
242 | int num_sg, int dir) | 248 | int num_sg, int dir) |
243 | { | 249 | { |
244 | sbus_unmap_sg(esp->dev, sg, num_sg, dir); | 250 | struct sbus_dev *sdev = esp->dev; |
251 | |||
252 | sbus_unmap_sg(&sdev->ofdev.dev, sg, num_sg, dir); | ||
245 | } | 253 | } |
246 | 254 | ||
247 | static int sbus_esp_irq_pending(struct esp *esp) | 255 | static int sbus_esp_irq_pending(struct esp *esp) |
@@ -550,7 +558,7 @@ static int __devinit esp_sbus_probe_one(struct device *dev, | |||
550 | fail_free_irq: | 558 | fail_free_irq: |
551 | free_irq(host->irq, esp); | 559 | free_irq(host->irq, esp); |
552 | fail_unmap_command_block: | 560 | fail_unmap_command_block: |
553 | sbus_free_consistent(esp->dev, 16, | 561 | sbus_free_consistent(&esp_dev->ofdev.dev, 16, |
554 | esp->command_block, | 562 | esp->command_block, |
555 | esp->command_block_dma); | 563 | esp->command_block_dma); |
556 | fail_unmap_regs: | 564 | fail_unmap_regs: |
@@ -589,6 +597,7 @@ static int __devinit esp_sbus_probe(struct of_device *dev, const struct of_devic | |||
589 | static int __devexit esp_sbus_remove(struct of_device *dev) | 597 | static int __devexit esp_sbus_remove(struct of_device *dev) |
590 | { | 598 | { |
591 | struct esp *esp = dev_get_drvdata(&dev->dev); | 599 | struct esp *esp = dev_get_drvdata(&dev->dev); |
600 | struct sbus_dev *sdev = esp->dev; | ||
592 | struct of_device *dma_of = esp->dma; | 601 | struct of_device *dma_of = esp->dma; |
593 | unsigned int irq = esp->host->irq; | 602 | unsigned int irq = esp->host->irq; |
594 | u32 val; | 603 | u32 val; |
@@ -600,7 +609,7 @@ static int __devexit esp_sbus_remove(struct of_device *dev) | |||
600 | dma_write32(val & ~DMA_INT_ENAB, DMA_CSR); | 609 | dma_write32(val & ~DMA_INT_ENAB, DMA_CSR); |
601 | 610 | ||
602 | free_irq(irq, esp); | 611 | free_irq(irq, esp); |
603 | sbus_free_consistent(esp->dev, 16, | 612 | sbus_free_consistent(&sdev->ofdev.dev, 16, |
604 | esp->command_block, | 613 | esp->command_block, |
605 | esp->command_block_dma); | 614 | esp->command_block_dma); |
606 | sbus_iounmap(esp->regs, SBUS_ESP_REG_SIZE); | 615 | sbus_iounmap(esp->regs, SBUS_ESP_REG_SIZE); |