diff options
Diffstat (limited to 'drivers/mmc/card/queue.c')
-rw-r--r-- | drivers/mmc/card/queue.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/drivers/mmc/card/queue.c b/drivers/mmc/card/queue.c index a5d0354bbbda..9203a0b221b3 100644 --- a/drivers/mmc/card/queue.c +++ b/drivers/mmc/card/queue.c | |||
@@ -13,6 +13,7 @@ | |||
13 | #include <linux/blkdev.h> | 13 | #include <linux/blkdev.h> |
14 | #include <linux/freezer.h> | 14 | #include <linux/freezer.h> |
15 | #include <linux/kthread.h> | 15 | #include <linux/kthread.h> |
16 | #include <linux/scatterlist.h> | ||
16 | 17 | ||
17 | #include <linux/mmc/card.h> | 18 | #include <linux/mmc/card.h> |
18 | #include <linux/mmc/host.h> | 19 | #include <linux/mmc/host.h> |
@@ -153,19 +154,21 @@ int mmc_init_queue(struct mmc_queue *mq, struct mmc_card *card, spinlock_t *lock | |||
153 | blk_queue_max_hw_segments(mq->queue, bouncesz / 512); | 154 | blk_queue_max_hw_segments(mq->queue, bouncesz / 512); |
154 | blk_queue_max_segment_size(mq->queue, bouncesz); | 155 | blk_queue_max_segment_size(mq->queue, bouncesz); |
155 | 156 | ||
156 | mq->sg = kzalloc(sizeof(struct scatterlist), | 157 | mq->sg = kmalloc(sizeof(struct scatterlist), |
157 | GFP_KERNEL); | 158 | GFP_KERNEL); |
158 | if (!mq->sg) { | 159 | if (!mq->sg) { |
159 | ret = -ENOMEM; | 160 | ret = -ENOMEM; |
160 | goto cleanup_queue; | 161 | goto cleanup_queue; |
161 | } | 162 | } |
163 | sg_init_table(mq->sg, 1); | ||
162 | 164 | ||
163 | mq->bounce_sg = kzalloc(sizeof(struct scatterlist) * | 165 | mq->bounce_sg = kmalloc(sizeof(struct scatterlist) * |
164 | bouncesz / 512, GFP_KERNEL); | 166 | bouncesz / 512, GFP_KERNEL); |
165 | if (!mq->bounce_sg) { | 167 | if (!mq->bounce_sg) { |
166 | ret = -ENOMEM; | 168 | ret = -ENOMEM; |
167 | goto cleanup_queue; | 169 | goto cleanup_queue; |
168 | } | 170 | } |
171 | sg_init_table(mq->bounce_sg, bouncesz / 512); | ||
169 | } | 172 | } |
170 | } | 173 | } |
171 | #endif | 174 | #endif |
@@ -302,12 +305,12 @@ static void copy_sg(struct scatterlist *dst, unsigned int dst_len, | |||
302 | BUG_ON(dst_len == 0); | 305 | BUG_ON(dst_len == 0); |
303 | 306 | ||
304 | if (dst_size == 0) { | 307 | if (dst_size == 0) { |
305 | dst_buf = page_address(dst->page) + dst->offset; | 308 | dst_buf = sg_virt(dst); |
306 | dst_size = dst->length; | 309 | dst_size = dst->length; |
307 | } | 310 | } |
308 | 311 | ||
309 | if (src_size == 0) { | 312 | if (src_size == 0) { |
310 | src_buf = page_address(src->page) + src->offset; | 313 | src_buf = sg_virt(dst); |
311 | src_size = src->length; | 314 | src_size = src->length; |
312 | } | 315 | } |
313 | 316 | ||
@@ -353,9 +356,7 @@ unsigned int mmc_queue_map_sg(struct mmc_queue *mq) | |||
353 | return 1; | 356 | return 1; |
354 | } | 357 | } |
355 | 358 | ||
356 | mq->sg[0].page = virt_to_page(mq->bounce_buf); | 359 | sg_init_one(mq->sg, mq->bounce_buf, 0); |
357 | mq->sg[0].offset = offset_in_page(mq->bounce_buf); | ||
358 | mq->sg[0].length = 0; | ||
359 | 360 | ||
360 | while (sg_len) { | 361 | while (sg_len) { |
361 | mq->sg[0].length += mq->bounce_sg[sg_len - 1].length; | 362 | mq->sg[0].length += mq->bounce_sg[sg_len - 1].length; |