From patchwork Thu Jan 26 15:04:33 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 9539409 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A8081601D7 for ; Thu, 26 Jan 2017 15:05:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A20E82041F for ; Thu, 26 Jan 2017 15:05:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 96C4327F17; Thu, 26 Jan 2017 15:05:06 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 336BA2684F for ; Thu, 26 Jan 2017 15:05:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753115AbdAZPFE (ORCPT ); Thu, 26 Jan 2017 10:05:04 -0500 Received: from mail-lf0-f48.google.com ([209.85.215.48]:34560 "EHLO mail-lf0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753220AbdAZPFD (ORCPT ); Thu, 26 Jan 2017 10:05:03 -0500 Received: by mail-lf0-f48.google.com with SMTP id v186so146965807lfa.1 for ; Thu, 26 Jan 2017 07:05:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=tDEBrNPhm4nc7Au24hWJvVDhgs7U/hvJ+ifcb3qJhGs=; b=cuyweW19OU0Vr85hFjlZySvHkpsQe6UBbRV5PhaEQ7oeCGu2nrYCk4BHmrO+JAnQfC eRBgRvykLyMh+s3OZCGRo9B+yOVaOrLEOs57Z1OpsHyCzclbuSZZnC+ESnAJI71d7u8b p0+FxdFinfqF0Y22FDWn814EIxpQf+QsAtl9w= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=tDEBrNPhm4nc7Au24hWJvVDhgs7U/hvJ+ifcb3qJhGs=; b=dcPTiyy9fHdlKA+EC8mk+WsZazV+SZpRThBbML31j4RY8vfhW3KFebowmWPq+o10+K BKkZfluvpu5Cd950G2+L8FdSVjrfBhzprKqacw6sgQYFFG3yuWH5VrsAa9GmxV6uv2rm ZenYA5nn5niMURfhe0VKfHOLz5K2XzWq5WDCvVbbdzOc1/Z5+BMT7uQ4anmVrYhJjxCZ 9l5/7OgBd6gH0FfMTQS7bjq7IfolZjvEYLa4wBRwd5WvVRqs+q/xItZhrCDbHRFz5SKe crwth6upXlPcxbwjcwawYMtGL4mDjw6euqdIRHDgNJcWMj3LFirq6A1TZrlh1772deMQ HuBw== X-Gm-Message-State: AIkVDXLhlVEpiV74WBPoMP/QB8CHiMM/yO3gZQFOkLGzLJGHOZKXS7c10z4gB4WPytI6f224 X-Received: by 10.25.203.87 with SMTP id b84mr1024791lfg.158.1485443101874; Thu, 26 Jan 2017 07:05:01 -0800 (PST) Received: from gnarp.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id s7sm540332lja.27.2017.01.26.07.05.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 26 Jan 2017 07:05:00 -0800 (PST) From: Linus Walleij To: linux-mmc@vger.kernel.org, linux-block@vger.kernel.org, Ulf Hansson Cc: Chunyan Zhang , Baolin Wang , Paolo Valente , Linus Walleij Subject: [PATCH 6/6] mmc: queue: turn queue flags into bools Date: Thu, 26 Jan 2017 16:04:33 +0100 Message-Id: <20170126150433.14038-6-linus.walleij@linaro.org> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170126150433.14038-1-linus.walleij@linaro.org> References: <20170126150433.14038-1-linus.walleij@linaro.org> Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- drivers/mmc/core/block.c | 6 +++--- drivers/mmc/core/queue.c | 12 ++++++------ drivers/mmc/core/queue.h | 5 ++--- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c index 04c7162f444e..7be50ebf300f 100644 --- a/drivers/mmc/core/block.c +++ b/drivers/mmc/core/block.c @@ -1665,7 +1665,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; } @@ -1804,7 +1804,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) @@ -1825,7 +1825,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. diff --git a/drivers/mmc/core/queue.c b/drivers/mmc/core/queue.c index 611f5c6d1950..5cb369c2664b 100644 --- a/drivers/mmc/core/queue.c +++ b/drivers/mmc/core/queue.c @@ -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); diff --git a/drivers/mmc/core/queue.h b/drivers/mmc/core/queue.h index e0cd5b1f40ee..e298f100101b 100644 --- a/drivers/mmc/core/queue.h +++ b/drivers/mmc/core/queue.h @@ -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;