diff options
author | Adrian Hunter <adrian.hunter@intel.com> | 2016-11-29 05:09:13 -0500 |
---|---|---|
committer | Ulf Hansson <ulf.hansson@linaro.org> | 2016-12-05 04:31:05 -0500 |
commit | 64e29e42a61b8b531eb77f363ddb8e507dfd35ed (patch) | |
tree | 657a6047a0f75e911a2eeb4f5dd1e96898fdd6ca | |
parent | f2b8b522cf643baa367b6834a49ff3e12cfa9136 (diff) |
mmc: queue: Factor out mmc_queue_alloc_sgs()
In preparation for supporting a queue of requests, factor out
mmc_queue_alloc_sgs().
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Harjani Ritesh <riteshh@codeaurora.org>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
-rw-r--r-- | drivers/mmc/card/queue.c | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/drivers/mmc/card/queue.c b/drivers/mmc/card/queue.c index 46b7b1f0cade..280708d804b9 100644 --- a/drivers/mmc/card/queue.c +++ b/drivers/mmc/card/queue.c | |||
@@ -237,6 +237,21 @@ static int mmc_queue_alloc_bounce_sgs(struct mmc_queue *mq, | |||
237 | } | 237 | } |
238 | #endif | 238 | #endif |
239 | 239 | ||
240 | static int mmc_queue_alloc_sgs(struct mmc_queue *mq, int max_segs) | ||
241 | { | ||
242 | struct mmc_queue_req *mqrq_cur = mq->mqrq_cur; | ||
243 | struct mmc_queue_req *mqrq_prev = mq->mqrq_prev; | ||
244 | int ret; | ||
245 | |||
246 | mqrq_cur->sg = mmc_alloc_sg(max_segs, &ret); | ||
247 | if (ret) | ||
248 | return ret; | ||
249 | |||
250 | mqrq_prev->sg = mmc_alloc_sg(max_segs, &ret); | ||
251 | |||
252 | return ret; | ||
253 | } | ||
254 | |||
240 | /** | 255 | /** |
241 | * mmc_init_queue - initialise a queue structure. | 256 | * mmc_init_queue - initialise a queue structure. |
242 | * @mq: mmc queue | 257 | * @mq: mmc queue |
@@ -309,12 +324,7 @@ int mmc_init_queue(struct mmc_queue *mq, struct mmc_card *card, | |||
309 | blk_queue_max_segments(mq->queue, host->max_segs); | 324 | blk_queue_max_segments(mq->queue, host->max_segs); |
310 | blk_queue_max_segment_size(mq->queue, host->max_seg_size); | 325 | blk_queue_max_segment_size(mq->queue, host->max_seg_size); |
311 | 326 | ||
312 | mqrq_cur->sg = mmc_alloc_sg(host->max_segs, &ret); | 327 | ret = mmc_queue_alloc_sgs(mq, host->max_segs); |
313 | if (ret) | ||
314 | goto cleanup_queue; | ||
315 | |||
316 | |||
317 | mqrq_prev->sg = mmc_alloc_sg(host->max_segs, &ret); | ||
318 | if (ret) | 328 | if (ret) |
319 | goto cleanup_queue; | 329 | goto cleanup_queue; |
320 | } | 330 | } |