aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff Garzik <jeff@garzik.org>2007-07-26 09:28:37 -0400
committerJames Bottomley <jejb@mulgrave.localdomain>2007-07-26 09:42:43 -0400
commit1d1bbee61e4ecdaad450e9bf4d9983876ed53a43 (patch)
treefd371a0e515fbadb3d0d01ca409718aa6fca15a9
parentfd3adb2ae8e16a02dfd5ed68f50fcf76fcdaff0b (diff)
[SCSI] libsas: Remove PCI dependencies
Eliminate unnecessary PCI dependencies in libsas. It should use generic DMA and struct device like other subsystems. Signed-off-by: Jeff Garzik <jeff@garzik.org> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
-rw-r--r--drivers/scsi/aic94xx/aic94xx_init.c4
-rw-r--r--drivers/scsi/libsas/sas_ata.c30
-rw-r--r--drivers/scsi/libsas/sas_discover.c3
-rw-r--r--drivers/scsi/libsas/sas_dump.c2
-rw-r--r--include/scsi/libsas.h2
5 files changed, 19 insertions, 22 deletions
diff --git a/drivers/scsi/aic94xx/aic94xx_init.c b/drivers/scsi/aic94xx/aic94xx_init.c
index ab00aecc5466..63bcde246447 100644
--- a/drivers/scsi/aic94xx/aic94xx_init.c
+++ b/drivers/scsi/aic94xx/aic94xx_init.c
@@ -586,7 +586,7 @@ static int __devinit asd_pci_probe(struct pci_dev *dev,
586 goto Err; 586 goto Err;
587 } 587 }
588 asd_ha->pcidev = dev; 588 asd_ha->pcidev = dev;
589 asd_ha->sas_ha.pcidev = asd_ha->pcidev; 589 asd_ha->sas_ha.dev = &asd_ha->pcidev->dev;
590 asd_ha->sas_ha.lldd_ha = asd_ha; 590 asd_ha->sas_ha.lldd_ha = asd_ha;
591 591
592 asd_ha->name = asd_dev->name; 592 asd_ha->name = asd_dev->name;
@@ -605,8 +605,6 @@ static int __devinit asd_pci_probe(struct pci_dev *dev,
605 goto Err_free; 605 goto Err_free;
606 } 606 }
607 607
608
609
610 err = asd_dev->setup(asd_ha); 608 err = asd_dev->setup(asd_ha);
611 if (err) 609 if (err)
612 goto Err_free; 610 goto Err_free;
diff --git a/drivers/scsi/libsas/sas_ata.c b/drivers/scsi/libsas/sas_ata.c
index ced2de32c511..5e573efcf0a7 100644
--- a/drivers/scsi/libsas/sas_ata.c
+++ b/drivers/scsi/libsas/sas_ata.c
@@ -382,7 +382,7 @@ int sas_ata_init_host_and_port(struct domain_device *found_dev,
382 struct ata_port *ap; 382 struct ata_port *ap;
383 383
384 ata_host_init(&found_dev->sata_dev.ata_host, 384 ata_host_init(&found_dev->sata_dev.ata_host,
385 &ha->pcidev->dev, 385 ha->dev,
386 sata_port_info.flags, 386 sata_port_info.flags,
387 &sas_sata_ops); 387 &sas_sata_ops);
388 ap = ata_sas_port_alloc(&found_dev->sata_dev.ata_host, 388 ap = ata_sas_port_alloc(&found_dev->sata_dev.ata_host,
@@ -448,10 +448,10 @@ static void sas_disc_task_done(struct sas_task *task)
448 * @task: the task to be executed 448 * @task: the task to be executed
449 * @buffer: pointer to buffer to do I/O 449 * @buffer: pointer to buffer to do I/O
450 * @size: size of @buffer 450 * @size: size of @buffer
451 * @pci_dma_dir: PCI_DMA_... 451 * @dma_dir: DMA direction. DMA_xxx
452 */ 452 */
453static int sas_execute_task(struct sas_task *task, void *buffer, int size, 453static int sas_execute_task(struct sas_task *task, void *buffer, int size,
454 int pci_dma_dir) 454 enum dma_data_direction dma_dir)
455{ 455{
456 int res = 0; 456 int res = 0;
457 struct scatterlist *scatter = NULL; 457 struct scatterlist *scatter = NULL;
@@ -461,7 +461,7 @@ static int sas_execute_task(struct sas_task *task, void *buffer, int size,
461 struct sas_internal *i = 461 struct sas_internal *i =
462 to_sas_internal(task->dev->port->ha->core.shost->transportt); 462 to_sas_internal(task->dev->port->ha->core.shost->transportt);
463 463
464 if (pci_dma_dir != PCI_DMA_NONE) { 464 if (dma_dir != DMA_NONE) {
465 scatter = kzalloc(sizeof(*scatter), GFP_KERNEL); 465 scatter = kzalloc(sizeof(*scatter), GFP_KERNEL);
466 if (!scatter) 466 if (!scatter)
467 goto out; 467 goto out;
@@ -474,11 +474,11 @@ static int sas_execute_task(struct sas_task *task, void *buffer, int size,
474 task->scatter = scatter; 474 task->scatter = scatter;
475 task->num_scatter = num_scatter; 475 task->num_scatter = num_scatter;
476 task->total_xfer_len = size; 476 task->total_xfer_len = size;
477 task->data_dir = pci_dma_dir; 477 task->data_dir = dma_dir;
478 task->task_done = sas_disc_task_done; 478 task->task_done = sas_disc_task_done;
479 if (pci_dma_dir != PCI_DMA_NONE && 479 if (dma_dir != DMA_NONE &&
480 sas_protocol_ata(task->task_proto)) { 480 sas_protocol_ata(task->task_proto)) {
481 task->num_scatter = pci_map_sg(task->dev->port->ha->pcidev, 481 task->num_scatter = dma_map_sg(task->dev->port->ha->dev,
482 task->scatter, 482 task->scatter,
483 task->num_scatter, 483 task->num_scatter,
484 task->data_dir); 484 task->data_dir);
@@ -565,9 +565,9 @@ static int sas_execute_task(struct sas_task *task, void *buffer, int size,
565 } 565 }
566 } 566 }
567ex_err: 567ex_err:
568 if (pci_dma_dir != PCI_DMA_NONE) { 568 if (dma_dir != DMA_NONE) {
569 if (sas_protocol_ata(task->task_proto)) 569 if (sas_protocol_ata(task->task_proto))
570 pci_unmap_sg(task->dev->port->ha->pcidev, 570 dma_unmap_sg(task->dev->port->ha->dev,
571 task->scatter, task->num_scatter, 571 task->scatter, task->num_scatter,
572 task->data_dir); 572 task->data_dir);
573 kfree(scatter); 573 kfree(scatter);
@@ -628,11 +628,11 @@ static void sas_get_ata_command_set(struct domain_device *dev)
628 * @features: the features register 628 * @features: the features register
629 * @buffer: pointer to buffer to do I/O 629 * @buffer: pointer to buffer to do I/O
630 * @size: size of @buffer 630 * @size: size of @buffer
631 * @pci_dma_dir: PCI_DMA_... 631 * @dma_dir: DMA direction. DMA_xxx
632 */ 632 */
633static int sas_issue_ata_cmd(struct domain_device *dev, u8 command, 633static int sas_issue_ata_cmd(struct domain_device *dev, u8 command,
634 u8 features, void *buffer, int size, 634 u8 features, void *buffer, int size,
635 int pci_dma_dir) 635 enum dma_data_direction dma_dir)
636{ 636{
637 int res = 0; 637 int res = 0;
638 struct sas_task *task; 638 struct sas_task *task;
@@ -652,7 +652,7 @@ static int sas_issue_ata_cmd(struct domain_device *dev, u8 command,
652 task->ata_task.fis.device = d2h_fis->device; 652 task->ata_task.fis.device = d2h_fis->device;
653 task->ata_task.retry_count = 1; 653 task->ata_task.retry_count = 1;
654 654
655 res = sas_execute_task(task, buffer, size, pci_dma_dir); 655 res = sas_execute_task(task, buffer, size, dma_dir);
656 656
657 sas_free_task(task); 657 sas_free_task(task);
658out: 658out:
@@ -707,7 +707,7 @@ static int sas_discover_sata_dev(struct domain_device *dev)
707 } 707 }
708 708
709 res = sas_issue_ata_cmd(dev, command, 0, identify_x, 512, 709 res = sas_issue_ata_cmd(dev, command, 0, identify_x, 512,
710 PCI_DMA_FROMDEVICE); 710 DMA_FROM_DEVICE);
711 if (res) 711 if (res)
712 goto out_err; 712 goto out_err;
713 713
@@ -720,13 +720,13 @@ static int sas_discover_sata_dev(struct domain_device *dev)
720 goto cont1; 720 goto cont1;
721 res = sas_issue_ata_cmd(dev, ATA_SET_FEATURES, 721 res = sas_issue_ata_cmd(dev, ATA_SET_FEATURES,
722 ATA_FEATURE_PUP_STBY_SPIN_UP, 722 ATA_FEATURE_PUP_STBY_SPIN_UP,
723 NULL, 0, PCI_DMA_NONE); 723 NULL, 0, DMA_NONE);
724 if (res) 724 if (res)
725 goto cont1; 725 goto cont1;
726 726
727 schedule_timeout_interruptible(5*HZ); /* More time? */ 727 schedule_timeout_interruptible(5*HZ); /* More time? */
728 res = sas_issue_ata_cmd(dev, command, 0, identify_x, 512, 728 res = sas_issue_ata_cmd(dev, command, 0, identify_x, 512,
729 PCI_DMA_FROMDEVICE); 729 DMA_FROM_DEVICE);
730 if (res) 730 if (res)
731 goto out_err; 731 goto out_err;
732 } 732 }
diff --git a/drivers/scsi/libsas/sas_discover.c b/drivers/scsi/libsas/sas_discover.c
index 6ac9f61d006a..7ef0afc3cd68 100644
--- a/drivers/scsi/libsas/sas_discover.c
+++ b/drivers/scsi/libsas/sas_discover.c
@@ -22,7 +22,6 @@
22 * 22 *
23 */ 23 */
24 24
25#include <linux/pci.h>
26#include <linux/scatterlist.h> 25#include <linux/scatterlist.h>
27#include <scsi/scsi_host.h> 26#include <scsi/scsi_host.h>
28#include <scsi/scsi_eh.h> 27#include <scsi/scsi_eh.h>
@@ -170,7 +169,7 @@ int sas_notify_lldd_dev_found(struct domain_device *dev)
170 if (res) { 169 if (res) {
171 printk("sas: driver on pcidev %s cannot handle " 170 printk("sas: driver on pcidev %s cannot handle "
172 "device %llx, error:%d\n", 171 "device %llx, error:%d\n",
173 pci_name(sas_ha->pcidev), 172 sas_ha->dev->bus_id,
174 SAS_ADDR(dev->sas_addr), res); 173 SAS_ADDR(dev->sas_addr), res);
175 } 174 }
176 } 175 }
diff --git a/drivers/scsi/libsas/sas_dump.c b/drivers/scsi/libsas/sas_dump.c
index f1246d2c9bef..bf34a236f946 100644
--- a/drivers/scsi/libsas/sas_dump.c
+++ b/drivers/scsi/libsas/sas_dump.c
@@ -56,7 +56,7 @@ void sas_dprint_phye(int phyid, enum phy_event pe)
56 56
57void sas_dprint_hae(struct sas_ha_struct *sas_ha, enum ha_event he) 57void sas_dprint_hae(struct sas_ha_struct *sas_ha, enum ha_event he)
58{ 58{
59 SAS_DPRINTK("ha %s: %s event\n", pci_name(sas_ha->pcidev), 59 SAS_DPRINTK("ha %s: %s event\n", sas_ha->dev->bus_id,
60 sas_hae_str[he]); 60 sas_hae_str[he]);
61} 61}
62 62
diff --git a/include/scsi/libsas.h b/include/scsi/libsas.h
index df36461fe881..8dda2d66b5b9 100644
--- a/include/scsi/libsas.h
+++ b/include/scsi/libsas.h
@@ -348,7 +348,7 @@ struct sas_ha_struct {
348 348
349/* public: */ 349/* public: */
350 char *sas_ha_name; 350 char *sas_ha_name;
351 struct pci_dev *pcidev; /* should be set */ 351 struct device *dev; /* should be set */
352 struct module *lldd_module; /* should be set */ 352 struct module *lldd_module; /* should be set */
353 353
354 u8 *sas_addr; /* must be set */ 354 u8 *sas_addr; /* must be set */