From patchwork Wed Feb 1 12:47:56 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 93016 Delivered-To: patch@linaro.org Received: by 10.182.3.34 with SMTP id 2csp2301224obz; Wed, 1 Feb 2017 04:49:05 -0800 (PST) X-Received: by 10.99.112.75 with SMTP id a11mr3422742pgn.7.1485953344768; Wed, 01 Feb 2017 04:49:04 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b69si19054885pfk.235.2017.02.01.04.49.04; Wed, 01 Feb 2017 04:49:04 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-mmc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-mmc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-mmc-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750962AbdBAMtD (ORCPT + 5 others); Wed, 1 Feb 2017 07:49:03 -0500 Received: from mail-lf0-f41.google.com ([209.85.215.41]:33867 "EHLO mail-lf0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750956AbdBAMtC (ORCPT ); Wed, 1 Feb 2017 07:49:02 -0500 Received: by mail-lf0-f41.google.com with SMTP id v186so227910954lfa.1 for ; Wed, 01 Feb 2017 04:49: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=v3F/OHbpvFFem2OXfPoTyfXMqhk4G/nfAAAoaMtktfQ=; b=Zy/BREgfvixRhaxNEvPGVpiJnDr+OwJ7c/Kaueqt6IG0JTVS6TyT1GiFntZFeaAHtS wRa6BG7duL3gPGyuwfofIDPWLOfdehnQ8MaqX/uMqO6K0Co5Z+AzCdNlhEAoLkdgBExN lnuhmKKorjEZoyrNa3vWRZTXHXAAsfGq3rMHE= 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=v3F/OHbpvFFem2OXfPoTyfXMqhk4G/nfAAAoaMtktfQ=; b=S9jNfklquBEe/TSg7xSscdqOV1KK5Xnuy0keqvI6UBI0bqjVb+QZFZgeEposT8Zx5M IYaWe3TlKZOseeH+PNKBTRzr8qKY9Fp2Xe+eXUB6uYN/yKnflAjNP6zHSacyZggjz4yJ QZFVJZW7apsTEprv9NNb3LiDVR2togPyKSeStCshwf4oIc/iIxe8A1PgYniy/U4K8TWz R+n7GD35yMOivlUKJOIQKlvZdN/AhvIQtaivxyAmMWbfubBNprO6o4Cx8wK4rU88xJJR k6ku+1xYU4jDjkBOXN9OWEPjYIy3buf83Pwl5LvCb4lNV7pm3dkqBBy1/vvzlTJyuYPS lunw== X-Gm-Message-State: AIkVDXISHAe8kN0nVvX2c3BF+nfjEK6baTG++TCkWOm0WVh0hX+0Clw2HKg75P4J+SQhR+wO X-Received: by 10.25.167.135 with SMTP id q129mr1019826lfe.115.1485953341109; Wed, 01 Feb 2017 04:49:01 -0800 (PST) Received: from gnarp.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id t126sm5707754lff.31.2017.02.01.04.48.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 01 Feb 2017 04:48:59 -0800 (PST) From: Linus Walleij To: linux-mmc@vger.kernel.org, Ulf Hansson Cc: Chunyan Zhang , Baolin Wang , Linus Walleij Subject: [PATCH 06/10] mmc: queue: turn queue flags into bools Date: Wed, 1 Feb 2017 13:47:56 +0100 Message-Id: <20170201124800.13865-7-linus.walleij@linaro.org> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170201124800.13865-1-linus.walleij@linaro.org> References: <20170201124800.13865-1-linus.walleij@linaro.org> Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org 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(-) -- 2.9.3 -- To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c index 7dcc27763381..1ac7fec03c97 100644 --- a/drivers/mmc/core/block.c +++ b/drivers/mmc/core/block.c @@ -1668,7 +1668,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; } @@ -1807,7 +1807,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) @@ -1828,7 +1828,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;