]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
mmc: queue: turn queue flags into bools
authorLinus Walleij <linus.walleij@linaro.org>
Wed, 1 Feb 2017 12:47:56 +0000 (13:47 +0100)
committerUlf Hansson <ulf.hansson@linaro.org>
Mon, 13 Feb 2017 12:21:00 +0000 (13:21 +0100)
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>
drivers/mmc/core/block.c
drivers/mmc/core/queue.c
drivers/mmc/core/queue.h

index 2a3e9e678a2325ad84cae8773874268800702bb6..7f0b9af8229c84bf553f23055fc0e60b79931ce9 100644 (file)
@@ -1663,7 +1663,7 @@ static void mmc_blk_issue_rw_rq(struct mmc_queue *mq, struct request *new_req)
                         * complete.
                         */
                        if (status == MMC_BLK_NEW_REQUEST)
-                               mq->flags |= MMC_QUEUE_NEW_REQUEST;
+                               mq->new_request = true;
                        return;
                }
 
@@ -1802,7 +1802,7 @@ void mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req)
                goto out;
        }
 
-       mq->flags &= ~MMC_QUEUE_NEW_REQUEST;
+       mq->new_request = false;
        if (req && req_op(req) == REQ_OP_DISCARD) {
                /* complete ongoing async transfer before issuing discard */
                if (card->host->areq)
@@ -1823,7 +1823,7 @@ void mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req)
        }
 
 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
                 * and after special request(discard, flush) is done.
index 611f5c6d195053f2f2afb71ce0f17fa8ab11c0c6..5cb369c2664bd9ca1b62ea769e04ffa406eb2447 100644 (file)
@@ -86,8 +86,8 @@ static int mmc_queue_thread(void *d)
                        set_current_state(TASK_RUNNING);
                        mmc_blk_issue_rq(mq, req);
                        cond_resched();
-                       if (mq->flags & MMC_QUEUE_NEW_REQUEST) {
-                               mq->flags &= ~MMC_QUEUE_NEW_REQUEST;
+                       if (mq->new_request) {
+                               mq->new_request = false;
                                continue; /* fetch again */
                        }
 
@@ -401,8 +401,8 @@ void mmc_queue_suspend(struct mmc_queue *mq)
        struct request_queue *q = mq->queue;
        unsigned long flags;
 
-       if (!(mq->flags & MMC_QUEUE_SUSPENDED)) {
-               mq->flags |= MMC_QUEUE_SUSPENDED;
+       if (!mq->suspended) {
+               mq->suspended |= true;
 
                spin_lock_irqsave(q->queue_lock, flags);
                blk_stop_queue(q);
@@ -421,8 +421,8 @@ void mmc_queue_resume(struct mmc_queue *mq)
        struct request_queue *q = mq->queue;
        unsigned long flags;
 
-       if (mq->flags & MMC_QUEUE_SUSPENDED) {
-               mq->flags &= ~MMC_QUEUE_SUSPENDED;
+       if (mq->suspended) {
+               mq->suspended = false;
 
                up(&mq->thread_sem);
 
index e0cd5b1f40eebf7f98de84b07b0c8062f55a8c00..e298f100101b9c3807dc0249bc2412b0f64bb77e 100644 (file)
@@ -40,9 +40,8 @@ struct mmc_queue {
        struct mmc_card         *card;
        struct task_struct      *thread;
        struct semaphore        thread_sem;
-       unsigned int            flags;
-#define MMC_QUEUE_SUSPENDED    (1 << 0)
-#define MMC_QUEUE_NEW_REQUEST  (1 << 1)
+       bool                    new_request;
+       bool                    suspended;
        bool                    asleep;
        struct mmc_blk_data     *blkdata;
        struct request_queue    *queue;