diff options
author | Brian King <brking@us.ibm.com> | 2006-03-23 18:30:15 -0500 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2006-03-24 10:18:43 -0500 |
commit | 2f1f610b62bce36d6d50857859091b8989c70267 (patch) | |
tree | cc79a77d3bee9aa00976d25ae69fb1c5e80ba452 | |
parent | 2af10a818de1658f818601c7098056d65a772bc5 (diff) |
[PATCH] libata: Remove dependence on host_set->dev for SAS
Remove some of the dependence on the host_set struct
in preparation for supporting SAS HBAs. Adds a struct device
pointer to the ata_port struct.
Signed-off-by: Brian King <brking@us.ibm.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
-rw-r--r-- | drivers/scsi/libata-core.c | 13 | ||||
-rw-r--r-- | include/linux/libata.h | 1 |
2 files changed, 8 insertions, 6 deletions
diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c index 94ad4acf8a59..d279666dcb38 100644 --- a/drivers/scsi/libata-core.c +++ b/drivers/scsi/libata-core.c | |||
@@ -2856,7 +2856,7 @@ static void ata_sg_clean(struct ata_queued_cmd *qc) | |||
2856 | 2856 | ||
2857 | if (qc->flags & ATA_QCFLAG_SG) { | 2857 | if (qc->flags & ATA_QCFLAG_SG) { |
2858 | if (qc->n_elem) | 2858 | if (qc->n_elem) |
2859 | dma_unmap_sg(ap->host_set->dev, sg, qc->n_elem, dir); | 2859 | dma_unmap_sg(ap->dev, sg, qc->n_elem, dir); |
2860 | /* restore last sg */ | 2860 | /* restore last sg */ |
2861 | sg[qc->orig_n_elem - 1].length += qc->pad_len; | 2861 | sg[qc->orig_n_elem - 1].length += qc->pad_len; |
2862 | if (pad_buf) { | 2862 | if (pad_buf) { |
@@ -2867,7 +2867,7 @@ static void ata_sg_clean(struct ata_queued_cmd *qc) | |||
2867 | } | 2867 | } |
2868 | } else { | 2868 | } else { |
2869 | if (qc->n_elem) | 2869 | if (qc->n_elem) |
2870 | dma_unmap_single(ap->host_set->dev, | 2870 | dma_unmap_single(ap->dev, |
2871 | sg_dma_address(&sg[0]), sg_dma_len(&sg[0]), | 2871 | sg_dma_address(&sg[0]), sg_dma_len(&sg[0]), |
2872 | dir); | 2872 | dir); |
2873 | /* restore sg */ | 2873 | /* restore sg */ |
@@ -3078,7 +3078,7 @@ static int ata_sg_setup_one(struct ata_queued_cmd *qc) | |||
3078 | goto skip_map; | 3078 | goto skip_map; |
3079 | } | 3079 | } |
3080 | 3080 | ||
3081 | dma_address = dma_map_single(ap->host_set->dev, qc->buf_virt, | 3081 | dma_address = dma_map_single(ap->dev, qc->buf_virt, |
3082 | sg->length, dir); | 3082 | sg->length, dir); |
3083 | if (dma_mapping_error(dma_address)) { | 3083 | if (dma_mapping_error(dma_address)) { |
3084 | /* restore sg */ | 3084 | /* restore sg */ |
@@ -3166,7 +3166,7 @@ static int ata_sg_setup(struct ata_queued_cmd *qc) | |||
3166 | } | 3166 | } |
3167 | 3167 | ||
3168 | dir = qc->dma_dir; | 3168 | dir = qc->dma_dir; |
3169 | n_elem = dma_map_sg(ap->host_set->dev, sg, pre_n_elem, dir); | 3169 | n_elem = dma_map_sg(ap->dev, sg, pre_n_elem, dir); |
3170 | if (n_elem < 1) { | 3170 | if (n_elem < 1) { |
3171 | /* restore last sg */ | 3171 | /* restore last sg */ |
3172 | lsg->length += qc->pad_len; | 3172 | lsg->length += qc->pad_len; |
@@ -4381,7 +4381,7 @@ int ata_device_suspend(struct ata_port *ap, struct ata_device *dev, pm_message_t | |||
4381 | 4381 | ||
4382 | int ata_port_start (struct ata_port *ap) | 4382 | int ata_port_start (struct ata_port *ap) |
4383 | { | 4383 | { |
4384 | struct device *dev = ap->host_set->dev; | 4384 | struct device *dev = ap->dev; |
4385 | int rc; | 4385 | int rc; |
4386 | 4386 | ||
4387 | ap->prd = dma_alloc_coherent(dev, ATA_PRD_TBL_SZ, &ap->prd_dma, GFP_KERNEL); | 4387 | ap->prd = dma_alloc_coherent(dev, ATA_PRD_TBL_SZ, &ap->prd_dma, GFP_KERNEL); |
@@ -4414,7 +4414,7 @@ int ata_port_start (struct ata_port *ap) | |||
4414 | 4414 | ||
4415 | void ata_port_stop (struct ata_port *ap) | 4415 | void ata_port_stop (struct ata_port *ap) |
4416 | { | 4416 | { |
4417 | struct device *dev = ap->host_set->dev; | 4417 | struct device *dev = ap->dev; |
4418 | 4418 | ||
4419 | dma_free_coherent(dev, ATA_PRD_TBL_SZ, ap->prd, ap->prd_dma); | 4419 | dma_free_coherent(dev, ATA_PRD_TBL_SZ, ap->prd, ap->prd_dma); |
4420 | ata_pad_free(ap, dev); | 4420 | ata_pad_free(ap, dev); |
@@ -4480,6 +4480,7 @@ static void ata_host_init(struct ata_port *ap, struct Scsi_Host *host, | |||
4480 | ap->host = host; | 4480 | ap->host = host; |
4481 | ap->ctl = ATA_DEVCTL_OBS; | 4481 | ap->ctl = ATA_DEVCTL_OBS; |
4482 | ap->host_set = host_set; | 4482 | ap->host_set = host_set; |
4483 | ap->dev = ent->dev; | ||
4483 | ap->port_no = port_no; | 4484 | ap->port_no = port_no; |
4484 | ap->hard_port_no = | 4485 | ap->hard_port_no = |
4485 | ent->legacy_mode ? ent->hard_port_no : port_no; | 4486 | ent->legacy_mode ? ent->hard_port_no : port_no; |
diff --git a/include/linux/libata.h b/include/linux/libata.h index 80c2339da67d..047192253c3a 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h | |||
@@ -400,6 +400,7 @@ struct ata_port { | |||
400 | 400 | ||
401 | struct ata_host_stats stats; | 401 | struct ata_host_stats stats; |
402 | struct ata_host_set *host_set; | 402 | struct ata_host_set *host_set; |
403 | struct device *dev; | ||
403 | 404 | ||
404 | struct work_struct port_task; | 405 | struct work_struct port_task; |
405 | 406 | ||