[PATCH 3/3] SG: Update ide/ to use sg_table
From: Jens Axboe <[EMAIL PROTECTED]> Signed-off-by: Jens Axboe <[EMAIL PROTECTED]> --- drivers/ide/arm/icside.c |6 +++--- drivers/ide/cris/ide-cris.c |2 +- drivers/ide/ide-dma.c |8 drivers/ide/ide-io.c |2 +- drivers/ide/ide-probe.c |6 +- drivers/ide/ide-taskfile.c|2 +- drivers/ide/ide.c |2 +- drivers/ide/mips/au1xxx-ide.c |8 drivers/ide/pci/sgiioc4.c |4 ++-- drivers/ide/ppc/pmac.c|6 +++--- drivers/scsi/ide-scsi.c |2 +- include/linux/ide.h |2 +- 12 files changed, 23 insertions(+), 27 deletions(-) diff --git a/drivers/ide/arm/icside.c b/drivers/ide/arm/icside.c index 93f71fc..a48a6bd 100644 --- a/drivers/ide/arm/icside.c +++ b/drivers/ide/arm/icside.c @@ -210,7 +210,7 @@ static void icside_build_sglist(ide_drive_t *drive, struct request *rq) { ide_hwif_t *hwif = drive->hwif; struct icside_state *state = hwif->hwif_data; - struct scatterlist *sg = hwif->sg_table; + struct scatterlist *sg = hwif->sg_table.sgl; ide_map_sg(drive, rq); @@ -319,7 +319,7 @@ static int icside_dma_end(ide_drive_t *drive) disable_dma(ECARD_DEV(state->dev)->dma); /* Teardown mappings after DMA has completed. */ - dma_unmap_sg(state->dev, hwif->sg_table, hwif->sg_nents, + dma_unmap_sg(state->dev, hwif->sg_table.sgl, hwif->sg_nents, hwif->sg_dma_direction); return get_dma_residue(ECARD_DEV(state->dev)->dma) != 0; @@ -373,7 +373,7 @@ static int icside_dma_setup(ide_drive_t *drive) * Tell the DMA engine about the SG table and * data direction. */ - set_dma_sg(ECARD_DEV(state->dev)->dma, hwif->sg_table, hwif->sg_nents); + set_dma_sg(ECARD_DEV(state->dev)->dma, hwif->sg_table.sgl, hwif->sg_nents); set_dma_mode(ECARD_DEV(state->dev)->dma, dma_mode); drive->waiting_for_dma = 1; diff --git a/drivers/ide/cris/ide-cris.c b/drivers/ide/cris/ide-cris.c index 476e0d6..3701aca 100644 --- a/drivers/ide/cris/ide-cris.c +++ b/drivers/ide/cris/ide-cris.c @@ -919,7 +919,7 @@ static int cris_ide_build_dmatable (ide_drive_t *drive) unsigned int count = 0; int i = 0; - sg = hwif->sg_table; + sg = hwif->sg_table.sgl; ata_tot_size = 0; diff --git a/drivers/ide/ide-dma.c b/drivers/ide/ide-dma.c index 4703837..33a2f56 100644 --- a/drivers/ide/ide-dma.c +++ b/drivers/ide/ide-dma.c @@ -190,7 +190,7 @@ static int ide_dma_good_drive(ide_drive_t *drive) int ide_build_sglist(ide_drive_t *drive, struct request *rq) { ide_hwif_t *hwif = HWIF(drive); - struct scatterlist *sg = hwif->sg_table; + struct scatterlist *sg = hwif->sg_table.sgl; BUG_ON((rq->cmd_type == REQ_TYPE_ATA_TASKFILE) && rq->nr_sectors > 256); @@ -234,7 +234,7 @@ int ide_build_dmatable (ide_drive_t *drive, struct request *rq) if (!i) return 0; - sg = hwif->sg_table; + sg = hwif->sg_table.sgl; while (i) { u32 cur_addr; u32 cur_len; @@ -293,7 +293,7 @@ int ide_build_dmatable (ide_drive_t *drive, struct request *rq) printk(KERN_ERR "%s: empty DMA table?\n", drive->name); use_pio_instead: pci_unmap_sg(hwif->pci_dev, -hwif->sg_table, +hwif->sg_table.sgl, hwif->sg_nents, hwif->sg_dma_direction); return 0; /* revert to PIO for this request */ @@ -315,7 +315,7 @@ EXPORT_SYMBOL_GPL(ide_build_dmatable); void ide_destroy_dmatable (ide_drive_t *drive) { struct pci_dev *dev = HWIF(drive)->pci_dev; - struct scatterlist *sg = HWIF(drive)->sg_table; + struct scatterlist *sg = HWIF(drive)->sg_table.sgl; int nents = HWIF(drive)->sg_nents; pci_unmap_sg(dev, sg, nents, HWIF(drive)->sg_dma_direction); diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c index bef781f..638e2db 100644 --- a/drivers/ide/ide-io.c +++ b/drivers/ide/ide-io.c @@ -819,7 +819,7 @@ static ide_startstop_t do_special (ide_drive_t *drive) void ide_map_sg(ide_drive_t *drive, struct request *rq) { ide_hwif_t *hwif = drive->hwif; - struct scatterlist *sg = hwif->sg_table; + struct scatterlist *sg = hwif->sg_table.sgl; if (hwif->sg_mapped)/* needed by ide-scsi */ return; diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c index 2994523..770f8cf 100644 --- a/drivers/ide/ide-probe.c +++ b/drivers/ide/ide-probe.c @@ -1312,15 +1312,11 @@ static int hwif_init(ide_hwif_t *hwif) if (!hwif->sg_max_nents) hwif->sg_max_nents = PRD_ENTRIES; - hwif->sg_table = kmalloc(sizeof(struct scatterlist)*hwif->sg_max_nents, -GFP_KERNEL); - if (!hwif->sg_table) { + if (sg_alloc_table(>sg_table, hwif->sg_max_nents, GFP_KERNEL)) {
[PATCH 3/3] SG: Update ide/ to use sg_table
From: Jens Axboe [EMAIL PROTECTED] Signed-off-by: Jens Axboe [EMAIL PROTECTED] --- drivers/ide/arm/icside.c |6 +++--- drivers/ide/cris/ide-cris.c |2 +- drivers/ide/ide-dma.c |8 drivers/ide/ide-io.c |2 +- drivers/ide/ide-probe.c |6 +- drivers/ide/ide-taskfile.c|2 +- drivers/ide/ide.c |2 +- drivers/ide/mips/au1xxx-ide.c |8 drivers/ide/pci/sgiioc4.c |4 ++-- drivers/ide/ppc/pmac.c|6 +++--- drivers/scsi/ide-scsi.c |2 +- include/linux/ide.h |2 +- 12 files changed, 23 insertions(+), 27 deletions(-) diff --git a/drivers/ide/arm/icside.c b/drivers/ide/arm/icside.c index 93f71fc..a48a6bd 100644 --- a/drivers/ide/arm/icside.c +++ b/drivers/ide/arm/icside.c @@ -210,7 +210,7 @@ static void icside_build_sglist(ide_drive_t *drive, struct request *rq) { ide_hwif_t *hwif = drive-hwif; struct icside_state *state = hwif-hwif_data; - struct scatterlist *sg = hwif-sg_table; + struct scatterlist *sg = hwif-sg_table.sgl; ide_map_sg(drive, rq); @@ -319,7 +319,7 @@ static int icside_dma_end(ide_drive_t *drive) disable_dma(ECARD_DEV(state-dev)-dma); /* Teardown mappings after DMA has completed. */ - dma_unmap_sg(state-dev, hwif-sg_table, hwif-sg_nents, + dma_unmap_sg(state-dev, hwif-sg_table.sgl, hwif-sg_nents, hwif-sg_dma_direction); return get_dma_residue(ECARD_DEV(state-dev)-dma) != 0; @@ -373,7 +373,7 @@ static int icside_dma_setup(ide_drive_t *drive) * Tell the DMA engine about the SG table and * data direction. */ - set_dma_sg(ECARD_DEV(state-dev)-dma, hwif-sg_table, hwif-sg_nents); + set_dma_sg(ECARD_DEV(state-dev)-dma, hwif-sg_table.sgl, hwif-sg_nents); set_dma_mode(ECARD_DEV(state-dev)-dma, dma_mode); drive-waiting_for_dma = 1; diff --git a/drivers/ide/cris/ide-cris.c b/drivers/ide/cris/ide-cris.c index 476e0d6..3701aca 100644 --- a/drivers/ide/cris/ide-cris.c +++ b/drivers/ide/cris/ide-cris.c @@ -919,7 +919,7 @@ static int cris_ide_build_dmatable (ide_drive_t *drive) unsigned int count = 0; int i = 0; - sg = hwif-sg_table; + sg = hwif-sg_table.sgl; ata_tot_size = 0; diff --git a/drivers/ide/ide-dma.c b/drivers/ide/ide-dma.c index 4703837..33a2f56 100644 --- a/drivers/ide/ide-dma.c +++ b/drivers/ide/ide-dma.c @@ -190,7 +190,7 @@ static int ide_dma_good_drive(ide_drive_t *drive) int ide_build_sglist(ide_drive_t *drive, struct request *rq) { ide_hwif_t *hwif = HWIF(drive); - struct scatterlist *sg = hwif-sg_table; + struct scatterlist *sg = hwif-sg_table.sgl; BUG_ON((rq-cmd_type == REQ_TYPE_ATA_TASKFILE) rq-nr_sectors 256); @@ -234,7 +234,7 @@ int ide_build_dmatable (ide_drive_t *drive, struct request *rq) if (!i) return 0; - sg = hwif-sg_table; + sg = hwif-sg_table.sgl; while (i) { u32 cur_addr; u32 cur_len; @@ -293,7 +293,7 @@ int ide_build_dmatable (ide_drive_t *drive, struct request *rq) printk(KERN_ERR %s: empty DMA table?\n, drive-name); use_pio_instead: pci_unmap_sg(hwif-pci_dev, -hwif-sg_table, +hwif-sg_table.sgl, hwif-sg_nents, hwif-sg_dma_direction); return 0; /* revert to PIO for this request */ @@ -315,7 +315,7 @@ EXPORT_SYMBOL_GPL(ide_build_dmatable); void ide_destroy_dmatable (ide_drive_t *drive) { struct pci_dev *dev = HWIF(drive)-pci_dev; - struct scatterlist *sg = HWIF(drive)-sg_table; + struct scatterlist *sg = HWIF(drive)-sg_table.sgl; int nents = HWIF(drive)-sg_nents; pci_unmap_sg(dev, sg, nents, HWIF(drive)-sg_dma_direction); diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c index bef781f..638e2db 100644 --- a/drivers/ide/ide-io.c +++ b/drivers/ide/ide-io.c @@ -819,7 +819,7 @@ static ide_startstop_t do_special (ide_drive_t *drive) void ide_map_sg(ide_drive_t *drive, struct request *rq) { ide_hwif_t *hwif = drive-hwif; - struct scatterlist *sg = hwif-sg_table; + struct scatterlist *sg = hwif-sg_table.sgl; if (hwif-sg_mapped)/* needed by ide-scsi */ return; diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c index 2994523..770f8cf 100644 --- a/drivers/ide/ide-probe.c +++ b/drivers/ide/ide-probe.c @@ -1312,15 +1312,11 @@ static int hwif_init(ide_hwif_t *hwif) if (!hwif-sg_max_nents) hwif-sg_max_nents = PRD_ENTRIES; - hwif-sg_table = kmalloc(sizeof(struct scatterlist)*hwif-sg_max_nents, -GFP_KERNEL); - if (!hwif-sg_table) { + if (sg_alloc_table(hwif-sg_table, hwif-sg_max_nents, GFP_KERNEL)) { printk(KERN_ERR %s: unable to allocate SG