From patchwork Mon Jan 14 19:17:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alamy Liu X-Patchwork-Id: 10763315 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6338C14E5 for ; Mon, 14 Jan 2019 19:17:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 54411289CF for ; Mon, 14 Jan 2019 19:17:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 484FD29679; Mon, 14 Jan 2019 19:17:49 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham 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 F3283289CF for ; Mon, 14 Jan 2019 19:17:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726815AbfANTRn (ORCPT ); Mon, 14 Jan 2019 14:17:43 -0500 Received: from mail-pg1-f193.google.com ([209.85.215.193]:41038 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726728AbfANTRn (ORCPT ); Mon, 14 Jan 2019 14:17:43 -0500 Received: by mail-pg1-f193.google.com with SMTP id m1so51064pgq.8; Mon, 14 Jan 2019 11:17:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=EGaVf28KQQ0R2S6vfsVu0HCs6MySjISxtykerEMR7gM=; b=Ehqd+iAXtywWB9bRgoduUjNSWjZbyJ6stv3eIE8ZZjVKRbI3P8huUvb6ZXlBaW58G1 UIBHxopU2ZQVaH+YS0qWzplui4WYErRKt1NJQ/V8J+KFKWsT1g8QhoR9Ig6bNaM1Gm6z N9/tRfIOLR5itCsDYgPBcFlGhrXPjSrbyIqmu+wgLj6A6ODrxo6LhA/QNmxlMthd0IfG obzDMSCy3ATVLXg8UbLtwWoOfpRzxMm2+jDxFKMnGVq6NcAQxrTAAwqOP5AbIfpJI8VZ qfaWBNgJYXsQkBFjWtNf2/QZ46lyhRZJxDtjfPOahGichR5vVlKzt9C06zdbwcfKtFgY Y96A== 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; bh=EGaVf28KQQ0R2S6vfsVu0HCs6MySjISxtykerEMR7gM=; b=a0xcNt+uZvtlOa32qhO6MRFc/BlM64ZNqJ+8lZXTibCkFW58wweLxZvoe6Lq7ZfYTl 5yGf5BiDMd0x5h41M/7fMt0dv9Q1E7sB+8iHyoW3GhoDz6QEVsptbAwV/YOOsUJnOEj1 66cq/WGfUXNzZGDic/6FZ25jO4IfBin0lwuhlIkJX7VtfIO6R50agD9cUAZ//2hyKoii gKAQuQiG0eQm6pG+g9K+DVY8YK2FNNp4bC7g7Bvfkld5FPcsZGqSFXhhx1iq0TTu4U6r cn/feKwHE3Yeryiu2totf7h7JstPZ8IGxkINzIyaBl5Yq9/iSOuY8uCrJ8b6Fi/uFef7 YAOw== X-Gm-Message-State: AJcUukcm46DveB9TqNRDCT1Uj3A2ed8xxDXTu892vy9wc4HQq4RYD2p/ clfMoDWJJUmrXtAtIewc/AA= X-Google-Smtp-Source: ALg8bN6xDqOam8yEIm+xQAvAbd/JbLk69yBKrw2YeFrxvkiby/N9eDK2+cLxGW8UjD9uUNMeu29avw== X-Received: by 2002:a63:ce08:: with SMTP id y8mr1527pgf.388.1547493462731; Mon, 14 Jan 2019 11:17:42 -0800 (PST) Received: from localhost.localdomain ([216.13.234.27]) by smtp.gmail.com with ESMTPSA id b2sm2672771pgg.87.2019.01.14.11.17.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 14 Jan 2019 11:17:42 -0800 (PST) From: Alamy Liu To: Ulf Hansson Cc: Alamy Liu , linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/2] mmc: cqhci: replace NUM_SLOTS with cq_host->num_slots Date: Mon, 14 Jan 2019 11:17:21 -0800 Message-Id: <20190114191724.29960-1-alamy.liu@gmail.com> X-Mailer: git-send-email 2.17.1 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 Prevent to use fixed value (NUM_SLOTS) after it had been determined and saved in a variable (cq_host->num_slots). Signed-off-by: Alamy Liu --- drivers/mmc/host/cqhci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mmc/host/cqhci.c b/drivers/mmc/host/cqhci.c index 159270e947..26d63594b7 100644 --- a/drivers/mmc/host/cqhci.c +++ b/drivers/mmc/host/cqhci.c @@ -699,7 +699,7 @@ static void cqhci_error_irq(struct mmc_host *mmc, u32 status, int cmd_error, * The only way to guarantee forward progress is to mark at * least one task in error, so if none is indicated, pick one. */ - for (tag = 0; tag < NUM_SLOTS; tag++) { + for (tag = 0; tag < cq_host->num_slots; tag++) { slot = &cq_host->slot[tag]; if (!slot->mrq) continue; From patchwork Mon Jan 14 19:17:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alamy Liu X-Patchwork-Id: 10763317 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BFAC391E for ; Mon, 14 Jan 2019 19:18:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B1C2D289CF for ; Mon, 14 Jan 2019 19:18:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A5D3C29679; Mon, 14 Jan 2019 19:18:10 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham 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 53DA8289CF for ; Mon, 14 Jan 2019 19:18:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726728AbfANTSJ (ORCPT ); Mon, 14 Jan 2019 14:18:09 -0500 Received: from mail-pg1-f195.google.com ([209.85.215.195]:46479 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726643AbfANTSJ (ORCPT ); Mon, 14 Jan 2019 14:18:09 -0500 Received: by mail-pg1-f195.google.com with SMTP id w7so38036pgp.13; Mon, 14 Jan 2019 11:18:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=h+sbqrLenk60F3eDSH1lBbRS/HpdojEGX59+/RMk3xw=; b=ofpEuWDh8iVbXpfpnZTDbkvUkcyWwJdR3CNDcCMArhhmSnAS+RGVyjaz06CMtNRZ6K y9h7bQRSd11Tp4lgO0dKQgGgsQaSSl+J3IMR51CpmKb4dG3i2SjNFiZ/0btMxvKYewse pjupwmDIfVooI6GFqE4f92cZGHcK5AlGz9rIQBF47gnme/MVGJBsR7N/jMsUxLkOWCUg kscO9w+WuNV5/6qp+6UdsqlJEIde+p5L9RHzFGOVf2n/tdaOuCXKRS2C0oelKMwsHFr4 l1RbfIjPpdFWZJIRvbnjCA3aRpwgjcLOJXuBsa4kLEP8DDcB9GhB68JQAsyZ1t1bFa81 xSkg== 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=h+sbqrLenk60F3eDSH1lBbRS/HpdojEGX59+/RMk3xw=; b=bbhv47XY/vuZrLx0YX8HIgjCCotLv2ODu9ldFHcG7YzEZSozHsQXm/QMrjjt9f4dNY T8DM9a7gWTdXcy00xC/1sjap2oL196Y1020HMCEBgqDSP7iOM52X8UyjuXvehqMZUpAs UpP3pigVMiNWBNBuL2UDuU8DArN+ayOCSbuXhsEE0oBjnLlaYunxo64gcckZeo0jNJQJ lmqYiuou0tIgWfZ2UTShXiGmPlpTJZHNuX45RavvuDp6Y3khmtfnnSEIkIZN7lNmGiOC 3LzeTkBVAvd2ROJBghWwhnTqeUjm6byxBame6Q6W1MjbNmqt6/LYacK/zvspLfwFx/pX Q9jw== X-Gm-Message-State: AJcUukcpEnY91YoPBn1hXcj07KEuAIOdR2/I54ZDwb1J/zlFcLAbTggU 8ZVZCxBIZdY42FgRuRBCDZ8= X-Google-Smtp-Source: ALg8bN79DnmFa88eYecS7YjlGHwMgeH99MXWpQHppNqjY/JMQmhayxToewLEOGUuPU3x69oYahUMGA== X-Received: by 2002:a62:3c1:: with SMTP id 184mr30042pfd.56.1547493488702; Mon, 14 Jan 2019 11:18:08 -0800 (PST) Received: from localhost.localdomain ([216.13.234.27]) by smtp.gmail.com with ESMTPSA id b2sm2672771pgg.87.2019.01.14.11.18.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 14 Jan 2019 11:18:08 -0800 (PST) From: Alamy Liu To: Ulf Hansson Cc: Alamy Liu , linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/2] mmc: cqhci: replace DCMD_SLOT with cq_host->dcmd_slot Date: Mon, 14 Jan 2019 11:17:22 -0800 Message-Id: <20190114191724.29960-2-alamy.liu@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190114191724.29960-1-alamy.liu@gmail.com> References: <20190114191724.29960-1-alamy.liu@gmail.com> 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 Prevent to use fixed value (DCMD_SLOT) after it had been determined and saved in a variable (cq_host->dcmd). Signed-off-by: Alamy Liu --- drivers/mmc/host/cqhci.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/mmc/host/cqhci.c b/drivers/mmc/host/cqhci.c index 26d63594b7..4cc7863c13 100644 --- a/drivers/mmc/host/cqhci.c +++ b/drivers/mmc/host/cqhci.c @@ -76,7 +76,8 @@ static void setup_trans_desc(struct cqhci_host *cq_host, u8 tag) if (cq_host->link_desc_len > 8) *(link_temp + 8) = 0; - if (tag == DCMD_SLOT && (cq_host->mmc->caps2 & MMC_CAP2_CQE_DCMD)) { + if ((tag == cq_host->dcmd_slot) + && (cq_host->mmc->caps2 & MMC_CAP2_CQE_DCMD)) { *link_temp = CQHCI_VALID(0) | CQHCI_ACT(0) | CQHCI_END(1); return; } @@ -548,9 +549,9 @@ static void cqhci_post_req(struct mmc_host *host, struct mmc_request *mrq) } } -static inline int cqhci_tag(struct mmc_request *mrq) +static inline int cqhci_tag(struct mmc_request *mrq, struct cqhci_host *cq_host) { - return mrq->cmd ? DCMD_SLOT : mrq->tag; + return mrq->cmd ? cq_host->dcmd_slot : mrq->tag; } static int cqhci_request(struct mmc_host *mmc, struct mmc_request *mrq) @@ -558,8 +559,8 @@ static int cqhci_request(struct mmc_host *mmc, struct mmc_request *mrq) int err = 0; u64 data = 0; u64 *task_desc = NULL; - int tag = cqhci_tag(mrq); struct cqhci_host *cq_host = mmc->cqe_private; + int tag = cqhci_tag(mrq, cq_host); unsigned long flags; if (!cq_host->enabled) { @@ -824,7 +825,7 @@ static bool cqhci_timeout(struct mmc_host *mmc, struct mmc_request *mrq, bool *recovery_needed) { struct cqhci_host *cq_host = mmc->cqe_private; - int tag = cqhci_tag(mrq); + int tag = cqhci_tag(mrq, cq_host); struct cqhci_slot *slot = &cq_host->slot[tag]; unsigned long flags; bool timed_out;