Commit 9491be5f authored by Linus Walleij's avatar Linus Walleij Committed by Ulf Hansson

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: default avatarLinus Walleij <linus.walleij@linaro.org>
Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
parent 74f5ba35
...@@ -1663,7 +1663,7 @@ static void mmc_blk_issue_rw_rq(struct mmc_queue *mq, struct request *new_req) ...@@ -1663,7 +1663,7 @@ static void mmc_blk_issue_rw_rq(struct mmc_queue *mq, struct request *new_req)
* complete. * complete.
*/ */
if (status == MMC_BLK_NEW_REQUEST) if (status == MMC_BLK_NEW_REQUEST)
mq->flags |= MMC_QUEUE_NEW_REQUEST; mq->new_request = true;
return; return;
} }
...@@ -1802,7 +1802,7 @@ void mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req) ...@@ -1802,7 +1802,7 @@ void mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req)
goto out; goto out;
} }
mq->flags &= ~MMC_QUEUE_NEW_REQUEST; mq->new_request = false;
if (req && req_op(req) == REQ_OP_DISCARD) { if (req && req_op(req) == REQ_OP_DISCARD) {
/* complete ongoing async transfer before issuing discard */ /* complete ongoing async transfer before issuing discard */
if (card->host->areq) if (card->host->areq)
...@@ -1823,7 +1823,7 @@ void mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req) ...@@ -1823,7 +1823,7 @@ void mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req)
} }
out: out:
if ((!req && !(mq->flags & MMC_QUEUE_NEW_REQUEST)) || req_is_special) if ((!req && !mq->new_request) || req_is_special)
/* /*
* Release host when there are no more requests * Release host when there are no more requests
* and after special request(discard, flush) is done. * and after special request(discard, flush) is done.
......
...@@ -86,8 +86,8 @@ static int mmc_queue_thread(void *d) ...@@ -86,8 +86,8 @@ static int mmc_queue_thread(void *d)
set_current_state(TASK_RUNNING); set_current_state(TASK_RUNNING);
mmc_blk_issue_rq(mq, req); mmc_blk_issue_rq(mq, req);
cond_resched(); cond_resched();
if (mq->flags & MMC_QUEUE_NEW_REQUEST) { if (mq->new_request) {
mq->flags &= ~MMC_QUEUE_NEW_REQUEST; mq->new_request = false;
continue; /* fetch again */ continue; /* fetch again */
} }
...@@ -401,8 +401,8 @@ void mmc_queue_suspend(struct mmc_queue *mq) ...@@ -401,8 +401,8 @@ void mmc_queue_suspend(struct mmc_queue *mq)
struct request_queue *q = mq->queue; struct request_queue *q = mq->queue;
unsigned long flags; unsigned long flags;
if (!(mq->flags & MMC_QUEUE_SUSPENDED)) { if (!mq->suspended) {
mq->flags |= MMC_QUEUE_SUSPENDED; mq->suspended |= true;
spin_lock_irqsave(q->queue_lock, flags); spin_lock_irqsave(q->queue_lock, flags);
blk_stop_queue(q); blk_stop_queue(q);
...@@ -421,8 +421,8 @@ void mmc_queue_resume(struct mmc_queue *mq) ...@@ -421,8 +421,8 @@ void mmc_queue_resume(struct mmc_queue *mq)
struct request_queue *q = mq->queue; struct request_queue *q = mq->queue;
unsigned long flags; unsigned long flags;
if (mq->flags & MMC_QUEUE_SUSPENDED) { if (mq->suspended) {
mq->flags &= ~MMC_QUEUE_SUSPENDED; mq->suspended = false;
up(&mq->thread_sem); up(&mq->thread_sem);
......
...@@ -40,9 +40,8 @@ struct mmc_queue { ...@@ -40,9 +40,8 @@ struct mmc_queue {
struct mmc_card *card; struct mmc_card *card;
struct task_struct *thread; struct task_struct *thread;
struct semaphore thread_sem; struct semaphore thread_sem;
unsigned int flags; bool new_request;
#define MMC_QUEUE_SUSPENDED (1 << 0) bool suspended;
#define MMC_QUEUE_NEW_REQUEST (1 << 1)
bool asleep; bool asleep;
struct mmc_blk_data *blkdata; struct mmc_blk_data *blkdata;
struct request_queue *queue; struct request_queue *queue;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment