Skip to content

Commit 9491be5

Browse files
Linus WalleijUlf Hansson
authored andcommitted
mmc: queue: turn queue flags into bools
Instead of masking and setting two bits in the "flags" field for the mmc_queue, just use two bools named "suspended" and "new_request". The masking and setting would likely have race conditions anyways, it is better to use a simple member like this. Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
1 parent 74f5ba3 commit 9491be5

3 files changed

Lines changed: 11 additions & 12 deletions

File tree

‎drivers/mmc/core/block.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1663,7 +1663,7 @@ static void mmc_blk_issue_rw_rq(struct mmc_queue *mq, struct request *new_req)
16631663
* complete.
16641664
*/
16651665
if (status == MMC_BLK_NEW_REQUEST)
1666-
mq->flags |= MMC_QUEUE_NEW_REQUEST;
1666+
mq->new_request = true;
16671667
return;
16681668
}
16691669

@@ -1802,7 +1802,7 @@ void mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req)
18021802
goto out;
18031803
}
18041804

1805-
mq->flags &= ~MMC_QUEUE_NEW_REQUEST;
1805+
mq->new_request = false;
18061806
if (req && req_op(req) == REQ_OP_DISCARD) {
18071807
/* complete ongoing async transfer before issuing discard */
18081808
if (card->host->areq)
@@ -1823,7 +1823,7 @@ void mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req)
18231823
}
18241824

18251825
out:
1826-
if ((!req && !(mq->flags & MMC_QUEUE_NEW_REQUEST)) || req_is_special)
1826+
if ((!req && !mq->new_request) || req_is_special)
18271827
/*
18281828
* Release host when there are no more requests
18291829
* and after special request(discard, flush) is done.

‎drivers/mmc/core/queue.c‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,8 @@ static int mmc_queue_thread(void *d)
8686
set_current_state(TASK_RUNNING);
8787
mmc_blk_issue_rq(mq, req);
8888
cond_resched();
89-
if (mq->flags & MMC_QUEUE_NEW_REQUEST) {
90-
mq->flags &= ~MMC_QUEUE_NEW_REQUEST;
89+
if (mq->new_request) {
90+
mq->new_request = false;
9191
continue; /* fetch again */
9292
}
9393

@@ -401,8 +401,8 @@ void mmc_queue_suspend(struct mmc_queue *mq)
401401
struct request_queue *q = mq->queue;
402402
unsigned long flags;
403403

404-
if (!(mq->flags & MMC_QUEUE_SUSPENDED)) {
405-
mq->flags |= MMC_QUEUE_SUSPENDED;
404+
if (!mq->suspended) {
405+
mq->suspended |= true;
406406

407407
spin_lock_irqsave(q->queue_lock, flags);
408408
blk_stop_queue(q);
@@ -421,8 +421,8 @@ void mmc_queue_resume(struct mmc_queue *mq)
421421
struct request_queue *q = mq->queue;
422422
unsigned long flags;
423423

424-
if (mq->flags & MMC_QUEUE_SUSPENDED) {
425-
mq->flags &= ~MMC_QUEUE_SUSPENDED;
424+
if (mq->suspended) {
425+
mq->suspended = false;
426426

427427
up(&mq->thread_sem);
428428

‎drivers/mmc/core/queue.h‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,8 @@ struct mmc_queue {
4040
struct mmc_card *card;
4141
struct task_struct *thread;
4242
struct semaphore thread_sem;
43-
unsigned int flags;
44-
#define MMC_QUEUE_SUSPENDED (1 << 0)
45-
#define MMC_QUEUE_NEW_REQUEST (1 << 1)
43+
bool new_request;
44+
bool suspended;
4645
bool asleep;
4746
struct mmc_blk_data *blkdata;
4847
struct request_queue *queue;

0 commit comments

Comments
 (0)