Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1737471
| From | Adrian Hunter <adrian.hunter@intel.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH V9 08/15] mmc: block: Factor out mmc_setup_queue() |
| Date | 2017-09-22 14:50 +0200 |
| Message-ID | <usvz4-68T-27@gated-at.bofh.it> (permalink) |
| References | <usvz3-68T-3@gated-at.bofh.it> |
| Organization | Intel Finland Oy, Registered Address: PL 281, 00181 Helsinki, Business Identity Code: 0357606 - 4, Domiciled in Helsinki |
Factor out some common code that will also be used with blk-mq.
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
---
drivers/mmc/core/queue.c | 39 ++++++++++++++++++++++++---------------
1 file changed, 24 insertions(+), 15 deletions(-)
diff --git a/drivers/mmc/core/queue.c b/drivers/mmc/core/queue.c
index f74f9ef460cc..4f33d277b125 100644
--- a/drivers/mmc/core/queue.c
+++ b/drivers/mmc/core/queue.c
@@ -177,6 +177,29 @@ static void mmc_exit_request(struct request_queue *q, struct request *req)
mq_rq->sg = NULL;
}
+static void mmc_setup_queue(struct mmc_queue *mq, struct mmc_card *card)
+{
+ struct mmc_host *host = card->host;
+ u64 limit = BLK_BOUNCE_HIGH;
+
+ if (mmc_dev(host)->dma_mask && *mmc_dev(host)->dma_mask)
+ limit = (u64)dma_max_pfn(mmc_dev(host)) << PAGE_SHIFT;
+
+ queue_flag_set_unlocked(QUEUE_FLAG_NONROT, mq->queue);
+ queue_flag_clear_unlocked(QUEUE_FLAG_ADD_RANDOM, mq->queue);
+ if (mmc_can_erase(card))
+ mmc_queue_setup_discard(mq->queue, card);
+
+ blk_queue_bounce_limit(mq->queue, limit);
+ blk_queue_max_hw_sectors(mq->queue,
+ min(host->max_blk_count, host->max_req_size / 512));
+ blk_queue_max_segments(mq->queue, host->max_segs);
+ blk_queue_max_segment_size(mq->queue, host->max_seg_size);
+
+ /* Initialize thread_sem even if it is not used */
+ sema_init(&mq->thread_sem, 1);
+}
+
/**
* mmc_init_queue - initialise a queue structure.
* @mq: mmc queue
@@ -190,12 +213,8 @@ int mmc_init_queue(struct mmc_queue *mq, struct mmc_card *card,
spinlock_t *lock, const char *subname)
{
struct mmc_host *host = card->host;
- u64 limit = BLK_BOUNCE_HIGH;
int ret = -ENOMEM;
- if (mmc_dev(host)->dma_mask && *mmc_dev(host)->dma_mask)
- limit = (u64)dma_max_pfn(mmc_dev(host)) << PAGE_SHIFT;
-
mq->card = card;
mq->queue = blk_alloc_queue(GFP_KERNEL);
if (!mq->queue)
@@ -214,18 +233,8 @@ int mmc_init_queue(struct mmc_queue *mq, struct mmc_card *card,
}
blk_queue_prep_rq(mq->queue, mmc_prep_request);
- queue_flag_set_unlocked(QUEUE_FLAG_NONROT, mq->queue);
- queue_flag_clear_unlocked(QUEUE_FLAG_ADD_RANDOM, mq->queue);
- if (mmc_can_erase(card))
- mmc_queue_setup_discard(mq->queue, card);
- blk_queue_bounce_limit(mq->queue, limit);
- blk_queue_max_hw_sectors(mq->queue,
- min(host->max_blk_count, host->max_req_size / 512));
- blk_queue_max_segments(mq->queue, host->max_segs);
- blk_queue_max_segment_size(mq->queue, host->max_seg_size);
-
- sema_init(&mq->thread_sem, 1);
+ mmc_setup_queue(mq, card);
mq->thread = kthread_run(mmc_queue_thread, mq, "mmcqd/%d%s",
host->index, subname ? subname : "");
--
1.9.1
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH V9 00/15] mmc: Add Command Queue support Adrian Hunter <adrian.hunter@intel.com> - 2017-09-22 14:50 +0200
[PATCH V9 02/15] mmc: core: Introduce host claiming by context Adrian Hunter <adrian.hunter@intel.com> - 2017-09-22 14:50 +0200
[PATCH V9 12/15] mmc: core: Export mmc_retune_hold_now() and mmc_retune_release() Adrian Hunter <adrian.hunter@intel.com> - 2017-09-22 14:50 +0200
[PATCH V9 08/15] mmc: block: Factor out mmc_setup_queue() Adrian Hunter <adrian.hunter@intel.com> - 2017-09-22 14:50 +0200
Re: [PATCH V9 08/15] mmc: block: Factor out mmc_setup_queue() Linus Walleij <linus.walleij@linaro.org> - 2017-09-26 17:40 +0200
[PATCH V9 10/15] mmc: core: Export mmc_start_bkops() Adrian Hunter <adrian.hunter@intel.com> - 2017-09-22 14:50 +0200
[PATCH V9 03/15] mmc: core: Add support for handling CQE requests Adrian Hunter <adrian.hunter@intel.com> - 2017-09-22 14:50 +0200
Re: [PATCH V9 03/15] mmc: core: Add support for handling CQE requests Linus Walleij <linus.walleij@linaro.org> - 2017-09-26 17:40 +0200
[PATCH V9 06/15] mmc: block: Use local variables in mmc_blk_data_prep() Adrian Hunter <adrian.hunter@intel.com> - 2017-09-22 14:50 +0200
Re: [PATCH V9 06/15] mmc: block: Use local variables in mmc_blk_data_prep() Linus Walleij <linus.walleij@linaro.org> - 2017-09-26 17:40 +0200
[PATCH V9 15/15] mmc: sdhci-pci: Add CQHCI support for Intel GLK Adrian Hunter <adrian.hunter@intel.com> - 2017-09-22 14:50 +0200
RE: [PATCH V9 14/15] mmc: cqhci: support for command queue enabled host Bough Chen <haibo.chen@nxp.com> - 2017-09-25 04:50 +0200
Re: [PATCH V9 14/15] mmc: cqhci: support for command queue enabled host Adrian Hunter <adrian.hunter@intel.com> - 2017-09-25 08:40 +0200
csiph-web