summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-25 15:44:54 -0700
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-25 15:44:54 -0700
commit7f1495745347bc2cb9cc4f50d0a889caeb71f1f1 (patch)
tree2402b7e52fec57cdbf16d52e5fb467044589ec31 /drivers
parent2c7505570353af02e48c58ab4d109edd9bbbdd81 (diff)
parent85cdffcde0b6b831a06422413300d0f5c0e608c3 (diff)
Merge branch 'sg' of git://git.kernel.dk/linux-2.6-block
* 'sg' of git://git.kernel.dk/linux-2.6-block: fix sg_phys to use dma_addr_t ub: add sg_init_table for sense and read capacity commands x86: pci-gart fix blackfin: fix sg fallout xtensa: dma-mapping.h is using linux/scatterlist.h functions, so include it SG: audit of drivers that use blk_rq_map_sg() arch/um/drivers/ubd_kern.c: fix a building error SG: Change sg_set_page() to take length and offset argument AVR32: Fix sg_page breakage mmc: sg fallout m68k: sg fallout More SG build fixes sg: add missing sg_init_table calls to zfcp SG build fix
Diffstat (limited to 'drivers')
-rw-r--r--drivers/ata/libata-core.c4
-rw-r--r--drivers/block/cryptoloop.c9
-rw-r--r--drivers/block/sunvdc.c1
-rw-r--r--drivers/block/ub.c11
-rw-r--r--drivers/block/virtio_blk.c10
-rw-r--r--drivers/cdrom/viocd.c3
-rw-r--r--drivers/ieee1394/dma.c4
-rw-r--r--drivers/infiniband/core/umem.c4
-rw-r--r--drivers/infiniband/hw/mthca/mthca_memfree.c9
-rw-r--r--drivers/md/dm-crypt.c8
-rw-r--r--drivers/media/common/saa7146_core.c3
-rw-r--r--drivers/media/video/ivtv/ivtv-udma.c6
-rw-r--r--drivers/media/video/videobuf-dma-sg.c10
-rw-r--r--drivers/message/i2o/i2o_block.c1
-rw-r--r--drivers/mmc/host/au1xmmc.c2
-rw-r--r--drivers/mmc/host/mmci.c6
-rw-r--r--drivers/mmc/host/pxamci.c1
-rw-r--r--drivers/mmc/host/sdhci.c2
-rw-r--r--drivers/mmc/host/wbsd.c2
-rw-r--r--drivers/net/mlx4/icm.c4
-rw-r--r--drivers/s390/scsi/zfcp_aux.c12
-rw-r--r--drivers/s390/scsi/zfcp_def.h3
-rw-r--r--drivers/s390/scsi/zfcp_erp.c7
-rw-r--r--drivers/scsi/atari_NCR5380.c5
-rw-r--r--drivers/scsi/ipr.c2
-rw-r--r--drivers/scsi/iscsi_tcp.c4
-rw-r--r--drivers/scsi/osst.c6
-rw-r--r--drivers/scsi/sg.c13
-rw-r--r--drivers/scsi/st.c14
-rw-r--r--drivers/scsi/sun3x_esp.c4
30 files changed, 64 insertions, 106 deletions
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 9d10e2feb8b1..081e3dfb64d4 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -4689,8 +4689,8 @@ static int ata_sg_setup(struct ata_queued_cmd *qc)
* data in this function or read data in ata_sg_clean.
*/
offset = lsg->offset + lsg->length - qc->pad_len;
- sg_set_page(psg, nth_page(sg_page(lsg), offset >> PAGE_SHIFT));
- psg->offset = offset_in_page(offset);
+ sg_set_page(psg, nth_page(sg_page(lsg), offset >> PAGE_SHIFT),
+ qc->pad_len, offset_in_page(offset));
if (qc->tf.flags & ATA_TFLAG_WRITE) {
void *addr = kmap_atomic(sg_page(psg), KM_IRQ0);
diff --git a/drivers/block/cryptoloop.c b/drivers/block/cryptoloop.c
index 1b58b010797f..241167878edf 100644
--- a/drivers/block/cryptoloop.c
+++ b/drivers/block/cryptoloop.c
@@ -150,13 +150,8 @@ cryptoloop_transfer(struct loop_device *lo, int cmd,
u32 iv[4] = { 0, };
iv[0] = cpu_to_le32(IV & 0xffffffff);
- sg_set_page(&sg_in, in_page);
- sg_in.offset = in_offs;
- sg_in.length = sz;
-
- sg_set_page(&sg_out, out_page);
- sg_out.offset = out_offs;
- sg_out.length = sz;
+ sg_set_page(&sg_in, in_page, sz, in_offs);
+ sg_set_page(&sg_out, out_page, sz, out_offs);
desc.info = iv;
err = encdecfunc(&desc, &sg_out, &sg_in, sz);
diff --git a/drivers/block/sunvdc.c b/drivers/block/sunvdc.c
index 7276f7d207c2..fac4c6cd04f7 100644
--- a/drivers/block/sunvdc.c
+++ b/drivers/block/sunvdc.c
@@ -15,6 +15,7 @@
#include <linux/delay.h>
#include <linux/init.h>
#include <linux/list.h>
+#include <linux/scatterlist.h>
#include <asm/vio.h>
#include <asm/ldc.h>
diff --git a/drivers/block/ub.c b/drivers/block/ub.c
index 14143f2c484d..08e909dc7944 100644
--- a/drivers/block/ub.c
+++ b/drivers/block/ub.c
@@ -1428,9 +1428,9 @@ static void ub_state_sense(struct ub_dev *sc, struct ub_scsi_cmd *cmd)
scmd->state = UB_CMDST_INIT;
scmd->nsg = 1;
sg = &scmd->sgv[0];
- sg_set_page(sg, virt_to_page(sc->top_sense));
- sg->offset = (unsigned long)sc->top_sense & (PAGE_SIZE-1);
- sg->length = UB_SENSE_SIZE;
+ sg_init_table(sg, UB_MAX_REQ_SG);
+ sg_set_page(sg, virt_to_page(sc->top_sense), UB_SENSE_SIZE,
+ (unsigned long)sc->top_sense & (PAGE_SIZE-1));
scmd->len = UB_SENSE_SIZE;
scmd->lun = cmd->lun;
scmd->done = ub_top_sense_done;
@@ -1864,9 +1864,8 @@ static int ub_sync_read_cap(struct ub_dev *sc, struct ub_lun *lun,
cmd->state = UB_CMDST_INIT;
cmd->nsg = 1;
sg = &cmd->sgv[0];
- sg_set_page(sg, virt_to_page(p));
- sg->offset = (unsigned long)p & (PAGE_SIZE-1);
- sg->length = 8;
+ sg_init_table(sg, UB_MAX_REQ_SG);
+ sg_set_page(sg, virt_to_page(p), 8, (unsigned long)p & (PAGE_SIZE-1));
cmd->len = 8;
cmd->lun = lun;
cmd->done = ub_probe_done;
diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c
index a901eee64ba5..3cf7129d83e6 100644
--- a/drivers/block/virtio_blk.c
+++ b/drivers/block/virtio_blk.c
@@ -4,7 +4,9 @@
#include <linux/hdreg.h>
#include <linux/virtio.h>
#include <linux/virtio_blk.h>
-#include <linux/virtio_blk.h>
+#include <linux/scatterlist.h>
+
+#define VIRTIO_MAX_SG (3+MAX_PHYS_SEGMENTS)
static unsigned char virtblk_index = 'a';
struct virtio_blk
@@ -23,7 +25,7 @@ struct virtio_blk
mempool_t *pool;
/* Scatterlist: can be too big for stack. */
- struct scatterlist sg[3+MAX_PHYS_SEGMENTS];
+ struct scatterlist sg[VIRTIO_MAX_SG];
};
struct virtblk_req
@@ -94,8 +96,8 @@ static bool do_req(struct request_queue *q, struct virtio_blk *vblk,
if (blk_barrier_rq(vbr->req))
vbr->out_hdr.type |= VIRTIO_BLK_T_BARRIER;
- /* We have to zero this, otherwise blk_rq_map_sg gets upset. */
- memset(vblk->sg, 0, sizeof(vblk->sg));
+ /* This init could be done at vblk creation time */
+ sg_init_table(vblk->sg, VIRTIO_MAX_SG);
sg_set_buf(&vblk->sg[0], &vbr->out_hdr, sizeof(vbr->out_hdr));
num = blk_rq_map_sg(q, vbr->req, vblk->sg+1);
sg_set_buf(&vblk->sg[num+1], &vbr->in_hdr, sizeof(vbr->in_hdr));
diff --git a/drivers/cdrom/viocd.c b/drivers/cdrom/viocd.c
index 880b5dce3a62..d8bb44b98a6a 100644
--- a/drivers/cdrom/viocd.c
+++ b/drivers/cdrom/viocd.c
@@ -41,9 +41,9 @@
#include <linux/completion.h>
#include <linux/proc_fs.h>
#include <linux/seq_file.h>
+#include <linux/scatterlist.h>
#include <asm/vio.h>
-#include <asm/scatterlist.h>
#include <asm/iseries/hv_types.h>
#include <asm/iseries/hv_lp_event.h>
#include <asm/iseries/vio.h>
@@ -258,6 +258,7 @@ static int send_request(struct request *req)
cmd = viomajorsubtype_cdio | viocdwrite;
}
+ sg_init_table(&sg, 1);
if (blk_rq_map_sg(req->q, req, &sg) == 0) {
printk(VIOCD_KERN_WARNING
"error setting up scatter/gather list\n");
diff --git a/drivers/ieee1394/dma.c b/drivers/ieee1394/dma.c
index 3051e312fdc8..f5f4983dfbf3 100644
--- a/drivers/ieee1394/dma.c
+++ b/drivers/ieee1394/dma.c
@@ -111,8 +111,8 @@ int dma_region_alloc(struct dma_region *dma, unsigned long n_bytes,
unsigned long va =
(unsigned long)dma->kvirt + (i << PAGE_SHIFT);
- sg_set_page(&dma->sglist[i], vmalloc_to_page((void *)va));
- dma->sglist[i].length = PAGE_SIZE;
+ sg_set_page(&dma->sglist[i], vmalloc_to_page((void *)va),
+ PAGE_SIZE, 0);
}
/* map sglist to the IOMMU */
diff --git a/drivers/infiniband/core/umem.c b/drivers/infiniband/core/umem.c
index 14159ff29408..4e3128ff73c1 100644
--- a/drivers/infiniband/core/umem.c
+++ b/drivers/infiniband/core/umem.c
@@ -171,9 +171,7 @@ struct ib_umem *ib_umem_get(struct ib_ucontext *context, unsigned long addr,
if (vma_list &&
!is_vm_hugetlb_page(vma_list[i + off]))
umem->hugetlb = 0;
- sg_set_page(&chunk->page_list[i], page_list[i + off]);
- chunk->page_list[i].offset = 0;
- chunk->page_list[i].length = PAGE_SIZE;
+ sg_set_page(&chunk->page_list[i], page_list[i + off], PAGE_SIZE, 0);
}
chunk->nmap = ib_dma_map_sg(context->device,
diff --git a/drivers/infiniband/hw/mthca/mthca_memfree.c b/drivers/infiniband/hw/mthca/mthca_memfree.c
index 007b38157fc4..1f4d27d7c16d 100644
--- a/drivers/infiniband/hw/mthca/mthca_memfree.c
+++ b/drivers/infiniband/hw/mthca/mthca_memfree.c
@@ -113,9 +113,7 @@ static int mthca_alloc_icm_pages(struct scatterlist *mem, int order, gfp_t gfp_m
if (!page)
return -ENOMEM;
- sg_set_page(mem, page);
- mem->length = PAGE_SIZE << order;
- mem->offset = 0;
+ sg_set_page(mem, page, PAGE_SIZE << order, 0);
return 0;
}
@@ -481,9 +479,8 @@ int mthca_map_user_db(struct mthca_dev *dev, struct mthca_uar *uar,
if (ret < 0)
goto out;
- sg_set_page(&db_tab->page[i].mem, pages[0]);
- db_tab->page[i].mem.length = MTHCA_ICM_PAGE_SIZE;
- db_tab->page[i].mem.offset = uaddr & ~PAGE_MASK;
+ sg_set_page(&db_tab->page[i].mem, pages[0], MTHCA_ICM_PAGE_SIZE,
+ uaddr & ~PAGE_MASK);
ret = pci_map_sg(dev->pdev, &db_tab->page[i].mem, 1, PCI_DMA_TODEVICE);
if (ret < 0) {
diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c
index ac54f697c508..1c159ac68c98 100644
--- a/drivers/md/dm-crypt.c
+++ b/drivers/md/dm-crypt.c
@@ -351,14 +351,10 @@ static int crypt_convert(struct crypt_config *cc,
struct scatterlist sg_in, sg_out;
sg_init_table(&sg_in, 1);
- sg_set_page(&sg_in, bv_in->bv_page);
- sg_in.offset = bv_in->bv_offset + ctx->offset_in;
- sg_in.length = 1 << SECTOR_SHIFT;
+ sg_set_page(&sg_in, bv_in->bv_page, 1 << SECTOR_SHIFT, bv_in->bv_offset + ctx->offset_in);
sg_init_table(&sg_out, 1);
- sg_set_page(&sg_out, bv_out->bv_page);
- sg_out.offset = bv_out->bv_offset + ctx->offset_out;
- sg_out.length = 1 << SECTOR_SHIFT;
+ sg_set_page(&sg_out, bv_out->bv_page, 1 << SECTOR_SHIFT, bv_out->bv_offset + ctx->offset_out);
ctx->offset_in += sg_in.length;
if (ctx->offset_in >= bv_in->bv_len) {
diff --git a/drivers/media/common/saa7146_core.c b/drivers/media/common/saa7146_core.c
index 2b1f8b4be00a..cb034ead95ab 100644
--- a/drivers/media/common/saa7146_core.c
+++ b/drivers/media/common/saa7146_core.c
@@ -118,8 +118,7 @@ static struct scatterlist* vmalloc_to_sg(unsigned char *virt, int nr_pages)
if (NULL == pg)
goto err;
BUG_ON(PageHighMem(pg));
- sg_set_page(&sglist[i], pg);
- sglist[i].length = PAGE_SIZE;
+ sg_set_page(&sglist[i], pg, PAGE_SIZE, 0);
}
return sglist;
diff --git a/drivers/media/video/ivtv/ivtv-udma.c b/drivers/media/video/ivtv/ivtv-udma.c
index 912b424e5204..460db03b0ba0 100644
--- a/drivers/media/video/ivtv/ivtv-udma.c
+++ b/drivers/media/video/ivtv/ivtv-udma.c
@@ -49,8 +49,6 @@ int ivtv_udma_fill_sg_list (struct ivtv_user_dma *dma, struct ivtv_dma_page_info
unsigned int len = (i == dma_page->page_count - 1) ?
dma_page->tail : PAGE_SIZE - offset;
- dma->SGlist[map_offset].length = len;
- dma->SGlist[map_offset].offset = offset;
if (PageHighMem(dma->map[map_offset])) {
void *src;
@@ -63,10 +61,10 @@ int ivtv_udma_fill_sg_list (struct ivtv_user_dma *dma, struct ivtv_dma_page_info
memcpy(page_address(dma->bouncemap[map_offset]) + offset, src, len);
kunmap_atomic(src, KM_BOUNCE_READ);
local_irq_restore(flags);
- sg_set_page(&dma->SGlist[map_offset], dma->bouncemap[map_offset]);
+ sg_set_page(&dma->SGlist[map_offset], dma->bouncemap[map_offset], len, offset);
}
else {
- sg_set_page(&dma->SGlist[map_offset], dma->map[map_offset]);
+ sg_set_page(&dma->SGlist[map_offset], dma->map[map_offset], len, offset);
}
offset = 0;
map_offset++;
diff --git a/drivers/media/video/videobuf-dma-sg.c b/drivers/media/video/videobuf-dma-sg.c
index 9ab94a749d81..44ee408e145f 100644
--- a/drivers/media/video/videobuf-dma-sg.c
+++ b/drivers/media/video/videobuf-dma-sg.c
@@ -67,8 +67,7 @@ videobuf_vmalloc_to_sg(unsigned char *virt, int nr_pages)
if (NULL == pg)
goto err;
BUG_ON(PageHighMem(pg));
- sg_set_page(&sglist[i], pg);
- sglist[i].length = PAGE_SIZE;
+ sg_set_page(&sglist[i], pg, PAGE_SIZE, 0);
}
return sglist;
@@ -95,16 +94,13 @@ videobuf_pages_to_sg(struct page **pages, int nr_pages, int offset)
if (PageHighMem(pages[0]))
/* DMA to highmem pages might not work */
goto highmem;
- sg_set_page(&sglist[0], pages[0]);
- sglist[0].offset = offset;
- sglist[0].length = PAGE_SIZE - offset;
+ sg_set_page(&sglist[0], pages[0], PAGE_SIZE - offset, offset);
for (i = 1; i < nr_pages; i++) {
if (NULL == pages[i])
goto nopage;
if (PageHighMem(pages[i]))
goto highmem;
- sg_set_page(&sglist[i], pages[i]);
- sglist[i].length = PAGE_SIZE;
+ sg_set_page(&sglist[i], pages[i], PAGE_SIZE, 0);
}
return sglist;
diff --git a/drivers/message/i2o/i2o_block.c b/drivers/message/i2o/i2o_block.c
index d602ba6d5417..682406168de9 100644
--- a/drivers/message/i2o/i2o_block.c
+++ b/drivers/message/i2o/i2o_block.c
@@ -284,6 +284,7 @@ static inline struct i2o_block_request *i2o_block_request_alloc(void)
return ERR_PTR(-ENOMEM);
INIT_LIST_HEAD(&ireq->queue);
+ sg_init_table(ireq->sg_table, I2O_MAX_PHYS_SEGMENTS);
return ireq;
};
diff --git a/drivers/mmc/host/au1xmmc.c b/drivers/mmc/host/au1xmmc.c
index bcbb6d247bf7..c77fadc0dfa3 100644
--- a/drivers/mmc/host/au1xmmc.c
+++ b/drivers/mmc/host/au1xmmc.c
@@ -40,13 +40,13 @@
#include <linux/mm.h>
#include <linux/interrupt.h>
#include <linux/dma-mapping.h>
+#include <scatterlist/scatterlist.h>
#include <linux/mmc/host.h>
#include <asm/io.h>
#include <asm/mach-au1x00/au1000.h>
#include <asm/mach-au1x00/au1xxx_dbdma.h>
#include <asm/mach-au1x00/au1100_mmc.h>
-#include <asm/scatterlist.h>
#include <au1xxx.h>
#include "au1xmmc.h"
diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c
index d0eb0a2abf4d..95244a7e7353 100644
--- a/drivers/mmc/host/mmci.c
+++ b/drivers/mmc/host/mmci.c
@@ -20,11 +20,11 @@
#include <linux/mmc/host.h>
#include <linux/amba/bus.h>
#include <linux/clk.h>
+#include <linux/scatterlist.h>
#include <asm/cacheflush.h>
#include <asm/div64.h>
#include <asm/io.h>
-#include <asm/scatterlist.h>
#include <asm/sizes.h>
#include <asm/mach/mmc.h>
@@ -167,7 +167,7 @@ mmci_data_irq(struct mmci_host *host, struct mmc_data *data,
* partially written to a page is properly coherent.
*/
if (host->sg_len && data->flags & MMC_DATA_READ)
- flush_dcache_page(host->sg_ptr->page);
+ flush_dcache_page(sg_page(host->sg_ptr));
}
if (status & MCI_DATAEND) {
mmci_stop_data(host);
@@ -319,7 +319,7 @@ static irqreturn_t mmci_pio_irq(int irq, void *dev_id)
* page, ensure that the data cache is coherent.
*/
if (status & MCI_RXACTIVE)
- flush_dcache_page(host->sg_ptr->page);
+ flush_dcache_page(sg_page(host->sg_ptr));
if (!mmci_next_sg(host))
break;
diff --git a/drivers/mmc/host/pxamci.c b/drivers/mmc/host/pxamci.c
index 0601e01aa2c2..a25ee71998a9 100644
--- a/drivers/mmc/host/pxamci.c
+++ b/drivers/mmc/host/pxamci.c
@@ -29,7 +29,6 @@
#include <asm/dma.h>
#include <asm/io.h>
-#include <asm/scatterlist.h>
#include <asm/sizes.h>
#include <asm/arch/pxa-regs.h>
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index d7c5b94d8c58..6b80bf77a4ef 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -17,8 +17,6 @@
#include <linux/mmc/host.h>
-#include <asm/scatterlist.h>
-
#include "sdhci.h"
#define DRIVER_NAME "sdhci"
diff --git a/drivers/mmc/host/wbsd.c b/drivers/mmc/host/wbsd.c
index fa4c8c53cc7a..4d5f37421874 100644
--- a/drivers/mmc/host/wbsd.c
+++ b/drivers/mmc/host/wbsd.c
@@ -33,10 +33,10 @@
#include <linux/pnp.h>
#include <linux/highmem.h>
#include <linux/mmc/host.h>
+#include <linux/scatterlist.h>
#include <asm/io.h>
#include <asm/dma.h>
-#include <asm/scatterlist.h>
#include "wbsd.h"
diff --git a/drivers/net/mlx4/icm.c b/drivers/net/mlx4/icm.c
index 887633b207d9..2a5bef6388fe 100644
--- a/drivers/net/mlx4/icm.c
+++ b/drivers/net/mlx4/icm.c
@@ -101,9 +101,7 @@ static int mlx4_alloc_icm_pages(struct scatterlist *mem, int order, gfp_t gfp_ma
if (!page)
return -ENOMEM;
- sg_set_page(mem, page);
- mem->length = PAGE_SIZE << order;
- mem->offset = 0;
+ sg_set_page(mem, page, PAGE_SIZE << order, 0);
return 0;
}
diff --git a/drivers/s390/scsi/zfcp_aux.c b/drivers/s390/scsi/zfcp_aux.c
index fd5d0c1570df..00118499018b 100644
--- a/drivers/s390/scsi/zfcp_aux.c
+++ b/drivers/s390/scsi/zfcp_aux.c
@@ -562,8 +562,6 @@ zfcp_sg_list_alloc(struct zfcp_sg_list *sg_list, size_t size)
sg_init_table(sg_list->sg, sg_list->count);
for (i = 0, sg = sg_list->sg; i < sg_list->count; i++, sg++) {
- sg->length = min(size, PAGE_SIZE);
- sg->offset = 0;
address = (void *) get_zeroed_page(GFP_KERNEL);
if (address == NULL) {
sg_list->count = i;
@@ -571,7 +569,7 @@ zfcp_sg_list_alloc(struct zfcp_sg_list *sg_list, size_t size)
retval = -ENOMEM;
goto out;
}
- zfcp_address_to_sg(address, sg);
+ zfcp_address_to_sg(address, sg, min(size, PAGE_SIZE));
size -= sg->length;
}
@@ -1518,13 +1516,13 @@ zfcp_gid_pn_buffers_alloc(struct zfcp_gid_pn_data **gid_pn, mempool_t *pool)
return -ENOMEM;
memset(data, 0, sizeof(*data));
+ sg_init_table(&data->req , 1);
+ sg_init_table(&data->resp , 1);
data->ct.req = &data->req;
data->ct.resp = &data->resp;
data->ct.req_count = data->ct.resp_count = 1;
- zfcp_address_to_sg(&data->ct_iu_req, &data->req);
- zfcp_address_to_sg(&data->ct_iu_resp, &data->resp);
- data->req.length = sizeof(struct ct_iu_gid_pn_req);
- data->resp.length = sizeof(struct ct_iu_gid_pn_resp);
+ zfcp_address_to_sg(&data->ct_iu_req, &data->req, sizeof(struct ct_iu_gid_pn_req));
+ zfcp_address_to_sg(&data->ct_iu_resp, &data->resp, sizeof(struct ct_iu_gid_pn_resp));
*gid_pn = data;
return 0;
diff --git a/drivers/s390/scsi/zfcp_def.h b/drivers/s390/scsi/zfcp_def.h
index 326e7ee232cb..0754542978b6 100644
--- a/drivers/s390/scsi/zfcp_def.h
+++ b/drivers/s390/scsi/zfcp_def.h
@@ -74,8 +74,7 @@ zfcp_sg_to_address(struct scatterlist *list)
static inline void
zfcp_address_to_sg(void *address, struct scatterlist *list)
{
- sg_set_page(list, virt_to_page(address));
- list->offset = ((unsigned long) address) & (PAGE_SIZE - 1);
+ sg_set_buf(list, address, 0);
}
#define REQUEST_LIST_SIZE 128
diff --git a/drivers/s390/scsi/zfcp_erp.c b/drivers/s390/scsi/zfcp_erp.c
index 9438d0b28799..5552b755c08a 100644
--- a/drivers/s390/scsi/zfcp_erp.c
+++ b/drivers/s390/scsi/zfcp_erp.c
@@ -322,9 +322,9 @@ zfcp_erp_adisc(struct zfcp_port *port)
if (address == NULL)
goto nomem;
- zfcp_address_to_sg(address, send_els->req);
+ zfcp_address_to_sg(address, send_els->req, sizeof(struct zfcp_ls_adisc));
address += PAGE_SIZE >> 1;
- zfcp_address_to_sg(address, send_els->resp);
+ zfcp_address_to_sg(address, send_els->resp, sizeof(struct zfcp_ls_adisc_acc));
send_els->req_count = send_els->resp_count = 1;
send_els->adapter = adapter;
@@ -336,9 +336,6 @@ zfcp_erp_adisc(struct zfcp_port *port)
adisc = zfcp_sg_to_address(send_els->req);
send_els->ls_code = adisc->code = ZFCP_LS_ADISC;
- send_els->req->length = sizeof(struct zfcp_ls_adisc);
- send_els->resp->length = sizeof(struct zfcp_ls_adisc_acc);
-
/* acc. to FC-FS, hard_nport_id in ADISC should not be set for ports
without FC-AL-2 capability, so we don't set it */
adisc->wwpn = fc_host_port_name(adapter->scsi_host);
diff --git a/drivers/scsi/atari_NCR5380.c b/drivers/scsi/atari_NCR5380.c
index d1780980fb20..a9680b5e8ac6 100644
--- a/drivers/scsi/atari_NCR5380.c
+++ b/drivers/scsi/atari_NCR5380.c
@@ -477,10 +477,9 @@ static void merge_contiguous_buffers(Scsi_Cmnd *cmd)
for (endaddr = virt_to_phys(cmd->SCp.ptr + cmd->SCp.this_residual - 1) + 1;
cmd->SCp.buffers_residual &&
- virt_to_phys(page_address(cmd->SCp.buffer[1].page) +
- cmd->SCp.buffer[1].offset) == endaddr;) {
+ virt_to_phys(sg_virt(&cmd->SCp.buffer[1])) == endaddr;) {
MER_PRINTK("VTOP(%p) == %08lx -> merging\n",
- page_address(cmd->SCp.buffer[1].page), endaddr);
+ page_address(sg_page(&cmd->SCp.buffer[1])), endaddr);
#if (NDEBUG & NDEBUG_MERGING)
++cnt;
#endif
diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c
index 439b97a6a269..0841df01bc19 100644
--- a/drivers/scsi/ipr.c
+++ b/drivers/scsi/ipr.c
@@ -2890,7 +2890,7 @@ static struct ipr_sglist *ipr_alloc_ucode_buffer(int buf_len)
return NULL;
}
- sg_set_page(&scatterlist[i], page);
+ sg_set_page(&scatterlist[i], page, 0, 0);
}
return sglist;
diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c
index 6ce4109efdf3..097a136398cb 100644
--- a/drivers/scsi/iscsi_tcp.c
+++ b/drivers/scsi/iscsi_tcp.c
@@ -79,9 +79,7 @@ static inline void
iscsi_buf_init_sg(struct iscsi_buf *ibuf, struct scatterlist *sg)
{
sg_init_table(&ibuf->sg, 1);
- sg_set_page(&ibuf->sg, sg_page(sg));
- ibuf->sg.offset = sg->offset;
- ibuf->sg.length = sg->length;
+ sg_set_page(&ibuf->sg, sg_page(sg), sg->length, sg->offset);
/*
* Fastpath: sg element fits into single page
*/
diff --git a/drivers/scsi/osst.c b/drivers/scsi/osst.c
index 1c5c4b68f20f..4652ad22516b 100644
--- a/drivers/scsi/osst.c
+++ b/drivers/scsi/osst.c
@@ -5256,8 +5256,7 @@ static int enlarge_buffer(struct osst_buffer *STbuffer, int need_dma)
STbuffer->sg[0].offset = 0;
if (page != NULL) {
- sg_set_page(&STbuffer->sg[0], page);
- STbuffer->sg[0].length = b_size;
+ sg_set_page(&STbuffer->sg[0], page, b_size, 0);
STbuffer->b_data = page_address(page);
break;
}
@@ -5285,8 +5284,7 @@ static int enlarge_buffer(struct osst_buffer *STbuffer, int need_dma)
normalize_buffer(STbuffer);
return 0;
}
- sg_set_page(&STbuffer->sg[segs], page);
- STbuffer->sg[segs].length = (OS_FRAME_SIZE - got <= PAGE_SIZE / 2) ? (OS_FRAME_SIZE - got) : b_size;
+ sg_set_page(&STbuffer->sg[segs], page, (OS_FRAME_SIZE - got <= PAGE_SIZE / 2) ? (OS_FRAME_SIZE - got) : b_size, 0);
got += STbuffer->sg[segs].length;
STbuffer->buffer_size = got;
STbuffer->sg_segs = ++segs;
diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c
index cc1971002846..b5fa4f091387 100644
--- a/drivers/scsi/sg.c
+++ b/drivers/scsi/sg.c
@@ -1717,16 +1717,12 @@ st_map_user_pages(struct scatterlist *sgl, const unsigned int max_pages,
goto out_unlock; */
}
- sg_set_page(sgl, pages[0]);
- sgl[0].offset = uaddr & ~PAGE_MASK;
+ sg_set_page(sgl, pages[0], 0, uaddr & ~PAGE_MASK);
if (nr_pages > 1) {
sgl[0].length = PAGE_SIZE - sgl[0].offset;
count -= sgl[0].length;
- for (i=1; i < nr_pages ; i++) {
- sg_set_page(&sgl[i], pages[i]);
- sgl[i].length = count < PAGE_SIZE ? count : PAGE_SIZE;
- count -= PAGE_SIZE;
- }
+ for (i=1; i < nr_pages ; i++)
+ sg_set_page(&sgl[i], pages[i], count < PAGE_SIZE ? count : PAGE_SIZE, 0);
}
else {
sgl[0].length = count;
@@ -1854,8 +1850,7 @@ sg_build_indirect(Sg_scatter_hold * schp, Sg_fd * sfp, int buff_size)
scatter_elem_sz_prev = ret_sz;
}
}
- sg_set_page(sg, p);
- sg->length = (ret_sz > num) ? num : ret_sz;
+ sg_set_page(sg, p, (ret_sz > num) ? num : ret_sz, 0);
SCSI_LOG_TIMEOUT(5, printk("sg_build_indirect: k=%d, num=%d, "
"ret_sz=%d\n", k, num, ret_sz));
diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c
index ce69b9efc102..98dfd6ea209c 100644
--- a/drivers/scsi/st.c
+++ b/drivers/scsi/st.c
@@ -3797,13 +3797,11 @@ static void buf_to_sg(struct st_buffer *STbp, unsigned int length)
sg = &(STbp->sg[0]);
frp = STbp->frp;
for (i=count=0; count < length; i++) {
- sg_set_page(&sg[i], frp[i].page);
if (length - count > frp[i].length)
- sg[i].length = frp[i].length;
+ sg_set_page(&sg[i], frp[i].page, frp[i].length, 0);
else
- sg[i].length = length - count;
+ sg_set_page(&sg[i], frp[i].page, length - count, 0);
count += sg[i].length;
- sg[i].offset = 0;
}
STbp->sg_segs = i;
STbp->frp_sg_current = length;
@@ -4446,15 +4444,13 @@ static int sgl_map_user_pages(struct scatterlist *sgl, const unsigned int max_pa
}
/* Populate the scatter/gather list */
- sg_set_page(&sgl[0], pages[0]);
- sgl[0].offset = uaddr & ~PAGE_MASK;
+ sg_set_page(&sgl[0], pages[0], 0, uaddr & ~PAGE_MASK);
if (nr_pages > 1) {
sgl[0].length = PAGE_SIZE - sgl[0].offset;
count -= sgl[0].length;
for (i=1; i < nr_pages ; i++) {
- sg_set_page(&sgl[i], pages[i]);;
- sgl[i].offset = 0;
- sgl[i].length = count < PAGE_SIZE ? count : PAGE_SIZE;
+ sg_set_page(&sgl[i], pages[i],
+ count < PAGE_SIZE ? count : PAGE_SIZE, 0);;
count -= PAGE_SIZE;
}
}
diff --git a/drivers/scsi/sun3x_esp.c b/drivers/scsi/sun3x_esp.c
index 80fb3f88af2e..1bc41907a038 100644
--- a/drivers/scsi/sun3x_esp.c
+++ b/drivers/scsi/sun3x_esp.c
@@ -332,8 +332,8 @@ static void dma_mmu_get_scsi_sgl (struct NCR_ESP *esp, Scsi_Cmnd *sp)
struct scatterlist *sg = sp->SCp.buffer;
while (sz >= 0) {
- sg[sz].dma_address = dvma_map((unsigned long)page_address(sg[sz].page) +
- sg[sz].offset, sg[sz].length);
+ sg[sz].dma_address = dvma_map((unsigned long)sg_virt(&sg[sz]),
+ sg[sz].length);
sz--;
}
sp->SCp.ptr=(char *)((unsigned long)sp->SCp.buffer->dma_address);