[PATCH 1/2] libata: Remove dependence on host_set->dev for SAS

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

This patch depends on the qc_transport patch:

http://marc.theaimsgroup.com/?l=linux-ide&m=112845939215286&w=2

Signed-off-by: Brian King <brking@xxxxxxxxxx>
---

 linux-2.6-bjking1/drivers/scsi/libata-core.c |   13 +++++++------
 linux-2.6-bjking1/include/linux/libata.h     |    1 +
 2 files changed, 8 insertions(+), 6 deletions(-)

diff -puN include/linux/libata.h~libata_host_set_dev include/linux/libata.h
--- linux-2.6/include/linux/libata.h~libata_host_set_dev	2005-10-24 15:04:22.000000000 -0500
+++ linux-2.6-bjking1/include/linux/libata.h	2005-10-24 15:04:22.000000000 -0500
@@ -315,6 +315,7 @@ struct ata_port {
 
 	struct ata_host_stats	stats;
 	struct ata_host_set	*host_set;
+	struct device 		*dev;
 
 	struct work_struct	packet_task;
 
diff -puN drivers/scsi/libata-core.c~libata_host_set_dev drivers/scsi/libata-core.c
--- linux-2.6/drivers/scsi/libata-core.c~libata_host_set_dev	2005-10-24 15:04:22.000000000 -0500
+++ linux-2.6-bjking1/drivers/scsi/libata-core.c	2005-10-24 15:04:22.000000000 -0500
@@ -2162,9 +2162,9 @@ static void ata_sg_clean(struct ata_queu
 	DPRINTK("unmapping %u sg elements\n", qc->n_elem);
 
 	if (qc->flags & ATA_QCFLAG_SG)
-		dma_unmap_sg(ap->host_set->dev, sg, qc->n_elem, dir);
+		dma_unmap_sg(ap->dev, sg, qc->n_elem, dir);
 	else
-		dma_unmap_single(ap->host_set->dev, sg_dma_address(&sg[0]),
+		dma_unmap_single(ap->dev, sg_dma_address(&sg[0]),
 				 sg_dma_len(&sg[0]), dir);
 
 	qc->flags &= ~ATA_QCFLAG_DMAMAP;
@@ -2335,7 +2335,7 @@ static int ata_sg_setup_one(struct ata_q
 	struct scatterlist *sg = qc->sg;
 	dma_addr_t dma_address;
 
-	dma_address = dma_map_single(ap->host_set->dev, qc->buf_virt,
+	dma_address = dma_map_single(ap->dev, qc->buf_virt,
 				     sg->length, dir);
 	if (dma_mapping_error(dma_address))
 		return -1;
@@ -2373,7 +2373,7 @@ static int ata_sg_setup(struct ata_queue
 	assert(qc->flags & ATA_QCFLAG_SG);
 
 	dir = qc->dma_dir;
-	n_elem = dma_map_sg(ap->host_set->dev, sg, qc->n_elem, dir);
+	n_elem = dma_map_sg(ap->dev, sg, qc->n_elem, dir);
 	if (n_elem < 1)
 		return -1;
 
@@ -3845,7 +3845,7 @@ err_out:
 
 int ata_port_start (struct ata_port *ap)
 {
-	struct device *dev = ap->host_set->dev;
+	struct device *dev = ap->dev;
 
 	ap->prd = dma_alloc_coherent(dev, ATA_PRD_TBL_SZ, &ap->prd_dma, GFP_KERNEL);
 	if (!ap->prd)
@@ -3870,7 +3870,7 @@ int ata_port_start (struct ata_port *ap)
 
 void ata_port_stop (struct ata_port *ap)
 {
-	struct device *dev = ap->host_set->dev;
+	struct device *dev = ap->dev;
 
 	dma_free_coherent(dev, ATA_PRD_TBL_SZ, ap->prd, ap->prd_dma);
 }
@@ -3937,6 +3937,7 @@ static void ata_host_init(struct ata_por
 	ap->host = host;
 	ap->ctl = ATA_DEVCTL_OBS;
 	ap->host_set = host_set;
+	ap->dev = ent->dev;
 	ap->port_no = port_no;
 	ap->hard_port_no =
 		ent->legacy_mode ? ent->hard_port_no : port_no;
_

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux