@@ -378,14 +378,37 @@ static void mmc_setup_queue(struct mmc_queue *mq, struct mmc_card *card)
378378 init_waitqueue_head (& mq -> wait );
379379}
380380
381- static int mmc_mq_init_queue (struct mmc_queue * mq , int q_depth ,
382- const struct blk_mq_ops * mq_ops , spinlock_t * lock )
381+ /* Set queue depth to get a reasonable value for q->nr_requests */
382+ #define MMC_QUEUE_DEPTH 64
383+
384+ /**
385+ * mmc_init_queue - initialise a queue structure.
386+ * @mq: mmc queue
387+ * @card: mmc card to attach this queue
388+ * @lock: queue lock
389+ *
390+ * Initialise a MMC card request queue.
391+ */
392+ int mmc_init_queue (struct mmc_queue * mq , struct mmc_card * card ,
393+ spinlock_t * lock )
383394{
395+ struct mmc_host * host = card -> host ;
384396 int ret ;
385397
398+ mq -> card = card ;
399+ mq -> use_cqe = host -> cqe_enabled ;
400+
386401 memset (& mq -> tag_set , 0 , sizeof (mq -> tag_set ));
387- mq -> tag_set .ops = mq_ops ;
388- mq -> tag_set .queue_depth = q_depth ;
402+ mq -> tag_set .ops = & mmc_mq_ops ;
403+ /*
404+ * The queue depth for CQE must match the hardware because the request
405+ * tag is used to index the hardware queue.
406+ */
407+ if (mq -> use_cqe )
408+ mq -> tag_set .queue_depth =
409+ min_t (int , card -> ext_csd .cmdq_depth , host -> cqe_qdepth );
410+ else
411+ mq -> tag_set .queue_depth = MMC_QUEUE_DEPTH ;
389412 mq -> tag_set .numa_node = NUMA_NO_NODE ;
390413 mq -> tag_set .flags = BLK_MQ_F_SHOULD_MERGE | BLK_MQ_F_SG_MERGE |
391414 BLK_MQ_F_BLOCKING ;
@@ -405,66 +428,16 @@ static int mmc_mq_init_queue(struct mmc_queue *mq, int q_depth,
405428
406429 mq -> queue -> queue_lock = lock ;
407430 mq -> queue -> queuedata = mq ;
431+ blk_queue_rq_timeout (mq -> queue , 60 * HZ );
408432
433+ mmc_setup_queue (mq , card );
409434 return 0 ;
410435
411436free_tag_set :
412437 blk_mq_free_tag_set (& mq -> tag_set );
413-
414438 return ret ;
415439}
416440
417- /* Set queue depth to get a reasonable value for q->nr_requests */
418- #define MMC_QUEUE_DEPTH 64
419-
420- static int mmc_mq_init (struct mmc_queue * mq , struct mmc_card * card ,
421- spinlock_t * lock )
422- {
423- struct mmc_host * host = card -> host ;
424- int q_depth ;
425- int ret ;
426-
427- /*
428- * The queue depth for CQE must match the hardware because the request
429- * tag is used to index the hardware queue.
430- */
431- if (mq -> use_cqe )
432- q_depth = min_t (int , card -> ext_csd .cmdq_depth , host -> cqe_qdepth );
433- else
434- q_depth = MMC_QUEUE_DEPTH ;
435-
436- ret = mmc_mq_init_queue (mq , q_depth , & mmc_mq_ops , lock );
437- if (ret )
438- return ret ;
439-
440- blk_queue_rq_timeout (mq -> queue , 60 * HZ );
441-
442- mmc_setup_queue (mq , card );
443-
444- return 0 ;
445- }
446-
447- /**
448- * mmc_init_queue - initialise a queue structure.
449- * @mq: mmc queue
450- * @card: mmc card to attach this queue
451- * @lock: queue lock
452- * @subname: partition subname
453- *
454- * Initialise a MMC card request queue.
455- */
456- int mmc_init_queue (struct mmc_queue * mq , struct mmc_card * card ,
457- spinlock_t * lock , const char * subname )
458- {
459- struct mmc_host * host = card -> host ;
460-
461- mq -> card = card ;
462-
463- mq -> use_cqe = host -> cqe_enabled ;
464-
465- return mmc_mq_init (mq , card , lock );
466- }
467-
468441void mmc_queue_suspend (struct mmc_queue * mq )
469442{
470443 blk_mq_quiesce_queue (mq -> queue );
0 commit comments