diff options
Diffstat (limited to 'drivers/mmc/card/block.c')
-rw-r--r-- | drivers/mmc/card/block.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c index 66e5a5487c20..86dbb366415a 100644 --- a/drivers/mmc/card/block.c +++ b/drivers/mmc/card/block.c | |||
@@ -213,7 +213,8 @@ static int mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req) | |||
213 | struct mmc_blk_data *md = mq->data; | 213 | struct mmc_blk_data *md = mq->data; |
214 | struct mmc_card *card = md->queue.card; | 214 | struct mmc_card *card = md->queue.card; |
215 | struct mmc_blk_request brq; | 215 | struct mmc_blk_request brq; |
216 | int ret = 1, sg_pos, data_size; | 216 | int ret = 1, data_size, i; |
217 | struct scatterlist *sg; | ||
217 | 218 | ||
218 | mmc_claim_host(card->host); | 219 | mmc_claim_host(card->host); |
219 | 220 | ||
@@ -267,18 +268,22 @@ static int mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req) | |||
267 | 268 | ||
268 | mmc_queue_bounce_pre(mq); | 269 | mmc_queue_bounce_pre(mq); |
269 | 270 | ||
271 | /* | ||
272 | * Adjust the sg list so it is the same size as the | ||
273 | * request. | ||
274 | */ | ||
270 | if (brq.data.blocks != | 275 | if (brq.data.blocks != |
271 | (req->nr_sectors >> (md->block_bits - 9))) { | 276 | (req->nr_sectors >> (md->block_bits - 9))) { |
272 | data_size = brq.data.blocks * brq.data.blksz; | 277 | data_size = brq.data.blocks * brq.data.blksz; |
273 | for (sg_pos = 0; sg_pos < brq.data.sg_len; sg_pos++) { | 278 | for_each_sg(brq.data.sg, sg, brq.data.sg_len, i) { |
274 | data_size -= mq->sg[sg_pos].length; | 279 | data_size -= sg->length; |
275 | if (data_size <= 0) { | 280 | if (data_size <= 0) { |
276 | mq->sg[sg_pos].length += data_size; | 281 | sg->length += data_size; |
277 | sg_pos++; | 282 | i++; |
278 | break; | 283 | break; |
279 | } | 284 | } |
280 | } | 285 | } |
281 | brq.data.sg_len = sg_pos; | 286 | brq.data.sg_len = i; |
282 | } | 287 | } |
283 | 288 | ||
284 | mmc_wait_for_req(card->host, &brq.mrq); | 289 | mmc_wait_for_req(card->host, &brq.mrq); |