aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc/card/block.c
diff options
context:
space:
mode:
authorPierre Ossman <drzeus@drzeus.cx>2008-08-16 15:34:02 -0400
committerPierre Ossman <drzeus@drzeus.cx>2008-10-12 05:04:30 -0400
commitf3eb0aaa0211fd804057070bee1fd067cd65cb13 (patch)
treebf97d54c14f3b63c2785cb19affc2ee1731159ee /drivers/mmc/card/block.c
parent6501ff604a5ae18697c9b4cd40a7738d3a68e7fe (diff)
mmc_block: inform block layer about sector count restriction
Make sure we consider the maximum block count when we tell the block layer about the maximum sector count. That way we don't have to chop up the request ourselves. Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
Diffstat (limited to 'drivers/mmc/card/block.c')
-rw-r--r--drivers/mmc/card/block.c23
1 files changed, 1 insertions, 22 deletions
diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
index ebc8b9d77613..d73cac84d9f2 100644
--- a/drivers/mmc/card/block.c
+++ b/drivers/mmc/card/block.c
@@ -215,8 +215,7 @@ static int mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req)
215 struct mmc_blk_data *md = mq->data; 215 struct mmc_blk_data *md = mq->data;
216 struct mmc_card *card = md->queue.card; 216 struct mmc_card *card = md->queue.card;
217 struct mmc_blk_request brq; 217 struct mmc_blk_request brq;
218 int ret = 1, data_size, i; 218 int ret = 1;
219 struct scatterlist *sg;
220 219
221 mmc_claim_host(card->host); 220 mmc_claim_host(card->host);
222 221
@@ -237,8 +236,6 @@ static int mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req)
237 brq.stop.arg = 0; 236 brq.stop.arg = 0;
238 brq.stop.flags = MMC_RSP_SPI_R1B | MMC_RSP_R1B | MMC_CMD_AC; 237 brq.stop.flags = MMC_RSP_SPI_R1B | MMC_RSP_R1B | MMC_CMD_AC;
239 brq.data.blocks = req->nr_sectors >> (md->block_bits - 9); 238 brq.data.blocks = req->nr_sectors >> (md->block_bits - 9);
240 if (brq.data.blocks > card->host->max_blk_count)
241 brq.data.blocks = card->host->max_blk_count;
242 239
243 if (brq.data.blocks > 1) { 240 if (brq.data.blocks > 1) {
244 /* SPI multiblock writes terminate using a special 241 /* SPI multiblock writes terminate using a special
@@ -270,24 +267,6 @@ static int mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req)
270 267
271 mmc_queue_bounce_pre(mq); 268 mmc_queue_bounce_pre(mq);
272 269
273 /*
274 * Adjust the sg list so it is the same size as the
275 * request.
276 */
277 if (brq.data.blocks !=
278 (req->nr_sectors >> (md->block_bits - 9))) {
279 data_size = brq.data.blocks * brq.data.blksz;
280 for_each_sg(brq.data.sg, sg, brq.data.sg_len, i) {
281 data_size -= sg->length;
282 if (data_size <= 0) {
283 sg->length += data_size;
284 i++;
285 break;
286 }
287 }
288 brq.data.sg_len = i;
289 }
290
291 mmc_wait_for_req(card->host, &brq.mrq); 270 mmc_wait_for_req(card->host, &brq.mrq);
292 271
293 mmc_queue_bounce_post(mq); 272 mmc_queue_bounce_post(mq);