aboutsummaryrefslogtreecommitdiff
path: root/drivers/scsi/st.c
diff options
context:
space:
mode:
authorJens Axboe <jens.axboe@oracle.com>2007-10-24 11:20:47 +0200
committerJens Axboe <jens.axboe@oracle.com>2007-10-24 11:20:47 +0200
commit642f149031d70415d9318b919d50b71e4724adbd (patch)
treee792ad29dedffc6756d55e9d63e18ada35515b4b /drivers/scsi/st.c
parentbd6dee6f30a0f6943df190b387b5f8fe98a848f3 (diff)
SG: Change sg_set_page() to take length and offset argument
Most drivers need to set length and offset as well, so may as well fold those three lines into one. Add sg_assign_page() for those two locations that only needed to set the page, where the offset/length is set outside of the function context. Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'drivers/scsi/st.c')
-rw-r--r--drivers/scsi/st.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c
index ce69b9efc10..98dfd6ea209 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;
}
}