Commit 1d1bbee6 authored by Jeff Garzik's avatar Jeff Garzik Committed by James Bottomley

[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: default avatarJeff Garzik <jeff@garzik.org>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@SteelEye.com>
parent fd3adb2a
...@@ -586,7 +586,7 @@ static int __devinit asd_pci_probe(struct pci_dev *dev, ...@@ -586,7 +586,7 @@ static int __devinit asd_pci_probe(struct pci_dev *dev,
goto Err; goto Err;
} }
asd_ha->pcidev = dev; asd_ha->pcidev = dev;
asd_ha->sas_ha.pcidev = asd_ha->pcidev; asd_ha->sas_ha.dev = &asd_ha->pcidev->dev;
asd_ha->sas_ha.lldd_ha = asd_ha; asd_ha->sas_ha.lldd_ha = asd_ha;
asd_ha->name = asd_dev->name; asd_ha->name = asd_dev->name;
...@@ -605,8 +605,6 @@ static int __devinit asd_pci_probe(struct pci_dev *dev, ...@@ -605,8 +605,6 @@ static int __devinit asd_pci_probe(struct pci_dev *dev,
goto Err_free; goto Err_free;
} }
err = asd_dev->setup(asd_ha); err = asd_dev->setup(asd_ha);
if (err) if (err)
goto Err_free; goto Err_free;
......
...@@ -382,7 +382,7 @@ int sas_ata_init_host_and_port(struct domain_device *found_dev, ...@@ -382,7 +382,7 @@ int sas_ata_init_host_and_port(struct domain_device *found_dev,
struct ata_port *ap; struct ata_port *ap;
ata_host_init(&found_dev->sata_dev.ata_host, ata_host_init(&found_dev->sata_dev.ata_host,
&ha->pcidev->dev, ha->dev,
sata_port_info.flags, sata_port_info.flags,
&sas_sata_ops); &sas_sata_ops);
ap = ata_sas_port_alloc(&found_dev->sata_dev.ata_host, 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,10 +448,10 @@ static void sas_disc_task_done(struct sas_task *task)
* @task: the task to be executed * @task: the task to be executed
* @buffer: pointer to buffer to do I/O * @buffer: pointer to buffer to do I/O
* @size: size of @buffer * @size: size of @buffer
* @pci_dma_dir: PCI_DMA_... * @dma_dir: DMA direction. DMA_xxx
*/ */
static int sas_execute_task(struct sas_task *task, void *buffer, int size, static int sas_execute_task(struct sas_task *task, void *buffer, int size,
int pci_dma_dir) enum dma_data_direction dma_dir)
{ {
int res = 0; int res = 0;
struct scatterlist *scatter = NULL; struct scatterlist *scatter = NULL;
...@@ -461,7 +461,7 @@ static int sas_execute_task(struct sas_task *task, void *buffer, int size, ...@@ -461,7 +461,7 @@ static int sas_execute_task(struct sas_task *task, void *buffer, int size,
struct sas_internal *i = struct sas_internal *i =
to_sas_internal(task->dev->port->ha->core.shost->transportt); to_sas_internal(task->dev->port->ha->core.shost->transportt);
if (pci_dma_dir != PCI_DMA_NONE) { if (dma_dir != DMA_NONE) {
scatter = kzalloc(sizeof(*scatter), GFP_KERNEL); scatter = kzalloc(sizeof(*scatter), GFP_KERNEL);
if (!scatter) if (!scatter)
goto out; goto out;
...@@ -474,11 +474,11 @@ static int sas_execute_task(struct sas_task *task, void *buffer, int size, ...@@ -474,11 +474,11 @@ static int sas_execute_task(struct sas_task *task, void *buffer, int size,
task->scatter = scatter; task->scatter = scatter;
task->num_scatter = num_scatter; task->num_scatter = num_scatter;
task->total_xfer_len = size; task->total_xfer_len = size;
task->data_dir = pci_dma_dir; task->data_dir = dma_dir;
task->task_done = sas_disc_task_done; task->task_done = sas_disc_task_done;
if (pci_dma_dir != PCI_DMA_NONE && if (dma_dir != DMA_NONE &&
sas_protocol_ata(task->task_proto)) { sas_protocol_ata(task->task_proto)) {
task->num_scatter = pci_map_sg(task->dev->port->ha->pcidev, task->num_scatter = dma_map_sg(task->dev->port->ha->dev,
task->scatter, task->scatter,
task->num_scatter, task->num_scatter,
task->data_dir); task->data_dir);
...@@ -565,9 +565,9 @@ static int sas_execute_task(struct sas_task *task, void *buffer, int size, ...@@ -565,9 +565,9 @@ static int sas_execute_task(struct sas_task *task, void *buffer, int size,
} }
} }
ex_err: ex_err:
if (pci_dma_dir != PCI_DMA_NONE) { if (dma_dir != DMA_NONE) {
if (sas_protocol_ata(task->task_proto)) if (sas_protocol_ata(task->task_proto))
pci_unmap_sg(task->dev->port->ha->pcidev, dma_unmap_sg(task->dev->port->ha->dev,
task->scatter, task->num_scatter, task->scatter, task->num_scatter,
task->data_dir); task->data_dir);
kfree(scatter); kfree(scatter);
...@@ -628,11 +628,11 @@ static void sas_get_ata_command_set(struct domain_device *dev) ...@@ -628,11 +628,11 @@ static void sas_get_ata_command_set(struct domain_device *dev)
* @features: the features register * @features: the features register
* @buffer: pointer to buffer to do I/O * @buffer: pointer to buffer to do I/O
* @size: size of @buffer * @size: size of @buffer
* @pci_dma_dir: PCI_DMA_... * @dma_dir: DMA direction. DMA_xxx
*/ */
static int sas_issue_ata_cmd(struct domain_device *dev, u8 command, static int sas_issue_ata_cmd(struct domain_device *dev, u8 command,
u8 features, void *buffer, int size, u8 features, void *buffer, int size,
int pci_dma_dir) enum dma_data_direction dma_dir)
{ {
int res = 0; int res = 0;
struct sas_task *task; struct sas_task *task;
...@@ -652,7 +652,7 @@ static int sas_issue_ata_cmd(struct domain_device *dev, u8 command, ...@@ -652,7 +652,7 @@ static int sas_issue_ata_cmd(struct domain_device *dev, u8 command,
task->ata_task.fis.device = d2h_fis->device; task->ata_task.fis.device = d2h_fis->device;
task->ata_task.retry_count = 1; task->ata_task.retry_count = 1;
res = sas_execute_task(task, buffer, size, pci_dma_dir); res = sas_execute_task(task, buffer, size, dma_dir);
sas_free_task(task); sas_free_task(task);
out: out:
...@@ -707,7 +707,7 @@ static int sas_discover_sata_dev(struct domain_device *dev) ...@@ -707,7 +707,7 @@ static int sas_discover_sata_dev(struct domain_device *dev)
} }
res = sas_issue_ata_cmd(dev, command, 0, identify_x, 512, res = sas_issue_ata_cmd(dev, command, 0, identify_x, 512,
PCI_DMA_FROMDEVICE); DMA_FROM_DEVICE);
if (res) if (res)
goto out_err; goto out_err;
...@@ -720,13 +720,13 @@ static int sas_discover_sata_dev(struct domain_device *dev) ...@@ -720,13 +720,13 @@ static int sas_discover_sata_dev(struct domain_device *dev)
goto cont1; goto cont1;
res = sas_issue_ata_cmd(dev, ATA_SET_FEATURES, res = sas_issue_ata_cmd(dev, ATA_SET_FEATURES,
ATA_FEATURE_PUP_STBY_SPIN_UP, ATA_FEATURE_PUP_STBY_SPIN_UP,
NULL, 0, PCI_DMA_NONE); NULL, 0, DMA_NONE);
if (res) if (res)
goto cont1; goto cont1;
schedule_timeout_interruptible(5*HZ); /* More time? */ schedule_timeout_interruptible(5*HZ); /* More time? */
res = sas_issue_ata_cmd(dev, command, 0, identify_x, 512, res = sas_issue_ata_cmd(dev, command, 0, identify_x, 512,
PCI_DMA_FROMDEVICE); DMA_FROM_DEVICE);
if (res) if (res)
goto out_err; goto out_err;
} }
......
...@@ -22,7 +22,6 @@ ...@@ -22,7 +22,6 @@
* *
*/ */
#include <linux/pci.h>
#include <linux/scatterlist.h> #include <linux/scatterlist.h>
#include <scsi/scsi_host.h> #include <scsi/scsi_host.h>
#include <scsi/scsi_eh.h> #include <scsi/scsi_eh.h>
...@@ -170,7 +169,7 @@ int sas_notify_lldd_dev_found(struct domain_device *dev) ...@@ -170,7 +169,7 @@ int sas_notify_lldd_dev_found(struct domain_device *dev)
if (res) { if (res) {
printk("sas: driver on pcidev %s cannot handle " printk("sas: driver on pcidev %s cannot handle "
"device %llx, error:%d\n", "device %llx, error:%d\n",
pci_name(sas_ha->pcidev), sas_ha->dev->bus_id,
SAS_ADDR(dev->sas_addr), res); SAS_ADDR(dev->sas_addr), res);
} }
} }
......
...@@ -56,7 +56,7 @@ void sas_dprint_phye(int phyid, enum phy_event pe) ...@@ -56,7 +56,7 @@ void sas_dprint_phye(int phyid, enum phy_event pe)
void sas_dprint_hae(struct sas_ha_struct *sas_ha, enum ha_event he) void sas_dprint_hae(struct sas_ha_struct *sas_ha, enum ha_event he)
{ {
SAS_DPRINTK("ha %s: %s event\n", pci_name(sas_ha->pcidev), SAS_DPRINTK("ha %s: %s event\n", sas_ha->dev->bus_id,
sas_hae_str[he]); sas_hae_str[he]);
} }
......
...@@ -348,7 +348,7 @@ struct sas_ha_struct { ...@@ -348,7 +348,7 @@ struct sas_ha_struct {
/* public: */ /* public: */
char *sas_ha_name; char *sas_ha_name;
struct pci_dev *pcidev; /* should be set */ struct device *dev; /* should be set */
struct module *lldd_module; /* should be set */ struct module *lldd_module; /* should be set */
u8 *sas_addr; /* must be set */ u8 *sas_addr; /* must be set */
......
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