Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp8636758ybl; Thu, 16 Jan 2020 21:30:03 -0800 (PST) X-Google-Smtp-Source: APXvYqyRmYMAMImdd21PvLRY3HaitOE5zE2/GFLn/OdXbGllvMpmEojCc9pcG0Y3iTD675ws+8Yu X-Received: by 2002:a05:6808:643:: with SMTP id z3mr2198922oih.19.1579239003484; Thu, 16 Jan 2020 21:30:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579239003; cv=none; d=google.com; s=arc-20160816; b=cmV0o6npPL5N18A9fE84RVz1qiCns7H7JhQ3mfjAgWGQEaYgR3J958fUbGz/epwpfE VT3hBSHpdmyv+VqW15784tiCQFcMHuZBxNlPt0fqsSPrXb7rB07hsjaOczJmQMXnAf33 Nb7TTeKDYkKl/KlZRM5a2uGB50/8s2h2EbTXwvk0D1ZbxrF814jwfp7QJadZNZJIHWCc UnhMiHgEWPqIH4oX6CfF0rZyY7f8kH1oJfYQTsFjOST5+cYrELYtUO4qPM7ylX4kQPqH 1YCINwffZunci2mHNNG5SsvEwtRM4drOTZQCSmqOhPnE1gf5Emo5VJsiSTLQsMZodawS 8Emw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature; bh=vshR8ZZS65iuxTZnSrp2TIMyJRg+REwdcMvoNFK8Uas=; b=dkFr2NosoNdNrmrxqKu7UScUJTJ2GTjyU4Kfu8KvJcM0GNIHqoXjQOn5oZ0fPs+tan PWEdmLZfmv2raNq70phqFj7eArQKEtO/2NtJTQ0jefU1oMFGZtuHq3EdPyGG0z0YhtwT FmPFbTNEruQLT5sCPbeYb+fkEulFY+ukZVT6hJzxfawhueKV6yPiLR5TlL+4gM1/cPoG BW3vwWXql+XUzYSIWH+LJLM/4hdK7EDvHLCDcG2xbx+SRwIbepC7X0BeBnlaJuqBhIdz zIby5LYospj2d/8YrhA6Bzcr8O2ES8ilyTl6w8PHkKgtIL2aYD9w7T9p+3PCgoJPvn9S EMbQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Ia2y461W; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k37si16256755otk.89.2020.01.16.21.29.52; Thu, 16 Jan 2020 21:30:03 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Ia2y461W; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729439AbgAQFZi (ORCPT + 99 others); Fri, 17 Jan 2020 00:25:38 -0500 Received: from mail-pl1-f193.google.com ([209.85.214.193]:36412 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729365AbgAQFZf (ORCPT ); Fri, 17 Jan 2020 00:25:35 -0500 Received: by mail-pl1-f193.google.com with SMTP id a6so9385626plm.3; Thu, 16 Jan 2020 21:25:34 -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 :in-reply-to:references; bh=vshR8ZZS65iuxTZnSrp2TIMyJRg+REwdcMvoNFK8Uas=; b=Ia2y461WWqsew/Nr0qQp/XeD57dkMTXASnn1DHFrRDSCoOUf9ZWqHP29B40IwljdiW c7fwiMwpu0DuUBZ0j+20I2vqt70/3Ga8kpwaORFwFjwI8JdeO96uOKcAMotMG/SKzcmf ZEp7gGEmQcB6a+iQ3i7udYPPME8CkGLAxt4hTHp0I6lTDgOoOBvSr8UOTpEFl3l63KpE z962g7q80l6nH+/55zrcZpyAv05Qb/GkFbqXZna0FOSo+QPCDvrIJVk3vh0EU92d0GM2 U9lMFrKVLHNWuv7xpzsIakdqsTu+JVzk6vIJ4romGMlzK1TICpGQw+WsXoRn6ML0/guy Lz4w== 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:in-reply-to:references; bh=vshR8ZZS65iuxTZnSrp2TIMyJRg+REwdcMvoNFK8Uas=; b=q1/rhe7/7Va+VS2PV/I6Z8HQfk0UIM0ikpIAuU5agQto7CgB7WMvJD+Etyojj/XsDA 1YReenJUStS01NXYIfDWKBkTceTLeoh9O65qAGwR2aFA9m5/sbHst5m207E/wZcrhcbA k3iKUrxeS+6mHNpI/uboYKtTO+89923FCKmJtJAwf43+qvrfNZFpmQU1H6C77YiQl65m TouPs+AOpel83/bQ1xwf4SUTN+QoHSZ2qrj7pS3aoX+RkYaDnlndOq8E69UZGWuq+qzu 8hLhglwXYAiLPWsCLaibOEwDOS4lYZGn+lp6FK94Rg+5vqUDmJG/kUuqVXdtIGVtLYhB lRWw== X-Gm-Message-State: APjAAAX3YOw2O4I2QqzgkjacveEF7yDK2nnBKPd8XaqhzQVf0NY+5EUV aLwsbxrlftCu/m2OzDmITAY= X-Received: by 2002:a17:90a:d0c5:: with SMTP id y5mr3544709pjw.126.1579238734646; Thu, 16 Jan 2020 21:25:34 -0800 (PST) Received: from baolinwangubtpc.spreadtrum.com ([117.18.48.82]) by smtp.gmail.com with ESMTPSA id c26sm28844756pfj.101.2020.01.16.21.25.31 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 16 Jan 2020 21:25:34 -0800 (PST) From: Baolin Wang To: axboe@kernel.dk, paolo.valente@linaro.org, adrian.hunter@intel.com, ulf.hansson@linaro.org Cc: zhang.lyra@gmail.com, orsonzhai@gmail.com, arnd@arndb.de, linus.walleij@linaro.org, baolin.wang7@gmail.com, linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-block@vger.kernel.org Subject: [RFC PATCH 6/8] mmc: host: sdhci: Remove redundant sg_count member of struct sdhci_host Date: Fri, 17 Jan 2020 13:24:25 +0800 Message-Id: <07402baeaf54340483c8aa15c324939ba31e0473.1579164456.git.baolin.wang7@gmail.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The mmc_data structure has a member to save the mapped sg count, so no need introduce a redundant sg_count of struct sdhci_host, remove it. This is also a preparation patch to support ADMA3 transfer mode. Signed-off-by: Baolin Wang --- drivers/mmc/host/sdhci.c | 12 +++++------- drivers/mmc/host/sdhci.h | 2 -- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index f517121..645785d 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c @@ -707,7 +707,7 @@ static void sdhci_adma_mark_end(void *desc) } static void sdhci_adma_table_pre(struct sdhci_host *host, - struct mmc_data *data, int sg_count) + struct mmc_data *data) { struct scatterlist *sg; unsigned long flags; @@ -721,14 +721,12 @@ static void sdhci_adma_table_pre(struct sdhci_host *host, * We currently guess that it is LE. */ - host->sg_count = sg_count; - desc = host->adma_table; align = host->align_buffer; align_addr = host->align_addr; - for_each_sg(data->sg, sg, host->sg_count, i) { + for_each_sg(data->sg, sg, data->sg_count, i) { addr = sg_dma_address(sg); len = sg_dma_len(sg); @@ -800,7 +798,7 @@ static void sdhci_adma_table_post(struct sdhci_host *host, bool has_unaligned = false; /* Do a quick scan of the SG list for any unaligned mappings */ - for_each_sg(data->sg, sg, host->sg_count, i) + for_each_sg(data->sg, sg, data->sg_count, i) if (sg_dma_address(sg) & SDHCI_ADMA2_MASK) { has_unaligned = true; break; @@ -812,7 +810,7 @@ static void sdhci_adma_table_post(struct sdhci_host *host, align = host->align_buffer; - for_each_sg(data->sg, sg, host->sg_count, i) { + for_each_sg(data->sg, sg, data->sg_count, i) { if (sg_dma_address(sg) & SDHCI_ADMA2_MASK) { size = SDHCI_ADMA2_ALIGN - (sg_dma_address(sg) & SDHCI_ADMA2_MASK); @@ -1110,7 +1108,7 @@ static void sdhci_prepare_data(struct sdhci_host *host, struct mmc_command *cmd) WARN_ON(1); host->flags &= ~SDHCI_REQ_USE_DMA; } else if (host->flags & SDHCI_USE_ADMA) { - sdhci_adma_table_pre(host, data, sg_cnt); + sdhci_adma_table_pre(host, data); sdhci_set_adma_addr(host, host->adma_addr); } else { WARN_ON(sg_cnt != 1); diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h index a5df807..7bbdd8a 100644 --- a/drivers/mmc/host/sdhci.h +++ b/drivers/mmc/host/sdhci.h @@ -585,8 +585,6 @@ struct sdhci_host { struct sg_mapping_iter sg_miter; /* SG state for PIO */ unsigned int blocks; /* remaining PIO blocks */ - int sg_count; /* Mapped sg entries */ - void *adma_table; /* ADMA descriptor table */ void *align_buffer; /* Bounce buffer */ void *integr_table; /* ADMA3 intergrate descriptor table */ -- 1.7.9.5