Received: by 10.223.176.5 with SMTP id f5csp326571wra; Sat, 3 Feb 2018 00:04:22 -0800 (PST) X-Google-Smtp-Source: AH8x224M1KH0T3OxjDLEV+5C68h52emo1fTq+fNt3Na1p2JRKKdC+4KcJI09IguvoQxbnnTKbIgG X-Received: by 2002:a17:902:7848:: with SMTP id e8-v6mr21902592pln.386.1517645062661; Sat, 03 Feb 2018 00:04:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517645062; cv=none; d=google.com; s=arc-20160816; b=p2CTU5cFKC7iWVA5eKjpsDeBgTptGh3Oym8SlzrKkm50iEN6Na0jS7btW/kOKu6Cu+ O86mPbo37ea9brU9AqL5jO4z/SmoCgjqEvZiE5a0+CBcY7APA2RlhtS7h3CHWa2B8Qlg QzkTqJgI9JsgPWTNzaXBqa7cm9MkwwR6AIZ4MPj/ITua645FbpMz5TACUU6ENa+gZ3U1 EGQ8Os87jZviX8+HH8J8yV3MlIhh4PIXm+YVZCCnKKKsWI7abtDWl9xZbi+WPJ8FQM3h 7A4VGWO3JVEtocGekD2qrAYYQDWk6cIT8yaNH9S7qp9nkqfvMvaEUNJjH2R1Mo3eRxp0 FvRQ== 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:message-id:date :subject:cc:to:from:dmarc-filter:dkim-signature:dkim-signature :arc-authentication-results; bh=R3JeGc50b6X6C3S/BVPztE7HecWVa+E5wYRPakJtw8E=; b=llGC2QnLaUsGQZmQfAe3+kDQNLO/6kpmwEF452eF1LIwoIvO4u0Bct3246eiyx8u0J ApeI+tRqVTEH/92y8L6CvdkOb66LHnlvr3suzTPrRuK+9KZdqwyeU6ogUR6ZX3Wz/ysl kTV8XPE2L9XakFf76wRMY5u9kNBjLKZatmuoIsBXDWST2NGsqw25+TQnB1KBAC7Yxivn ZJ/1VitDywtya2erEtteo+9iR/viFAgsRZ6CCPyxl+8PXF+RPollmKpXO5q6Udu1UCIr 0CRU/ILnElzVUp+sQC47o0B9WlDBMLMWVS9oZXZRTl3XqU4ZSK7u4Vb8vJG6xmYLSpua DGDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=CgrTq7kS; dkim=pass header.i=@codeaurora.org header.s=default header.b=gACBEtov; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a1-v6si3327376plt.588.2018.02.03.00.04.08; Sat, 03 Feb 2018 00:04:22 -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=@codeaurora.org header.s=default header.b=CgrTq7kS; dkim=pass header.i=@codeaurora.org header.s=default header.b=gACBEtov; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752167AbeBCH71 (ORCPT + 99 others); Sat, 3 Feb 2018 02:59:27 -0500 Received: from smtp.codeaurora.org ([198.145.29.96]:35422 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751757AbeBCH6k (ORCPT ); Sat, 3 Feb 2018 02:58:40 -0500 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 9F48A6081C; Sat, 3 Feb 2018 07:58:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1517644719; bh=HUZ9Ui8A3iNdL725zms/RuoFqvo+wwF5lvbSpBmZA+M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CgrTq7kSHND8OwiEh4WY2Fjtk52iaucW08Tv8J67GC4AYpUi9OJfyCxvRR9ZcMj0G eSMvk6brJf+bpF5XKw3w/Oh73Z7oe168i7mRtuDL/0tqKvnE17JCet9KCQ8iw3esVg egmJZYMq1PUicg3Kr5BdetWs8hKyy0emzljGDzt0= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.0 Received: from absahu-linux.qualcomm.com (blr-c-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.19.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: absahu@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 6D2B66081C; Sat, 3 Feb 2018 07:58:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1517644718; bh=HUZ9Ui8A3iNdL725zms/RuoFqvo+wwF5lvbSpBmZA+M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gACBEtovqiSU8/hsEvTmBgDRHLQY1dhASEovtTsn249sXWACsba5KR5aXQbEdVTsh 03V0gWeRbgiHrk+FXS56FBUJ9l5Y2HJ10oZt4WRlD2nxKCwBi2NJHhcxHF08rnQ6RS Jr02RqPEo8nIl/UOYopDQV5JAwFJeToVZ3P/fULE= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 6D2B66081C Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=absahu@codeaurora.org From: Abhishek Sahu To: Andy Gross , Wolfram Sang Cc: David Brown , Sricharan R , linux-arm-msm@vger.kernel.org, linux-soc@vger.kernel.org, linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, Abhishek Sahu Subject: [PATCH 03/12] i2c: qup: remove redundant variables for BAM SG count Date: Sat, 3 Feb 2018 13:28:08 +0530 Message-Id: <1517644697-30806-4-git-send-email-absahu@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1517644697-30806-1-git-send-email-absahu@codeaurora.org> References: <1517644697-30806-1-git-send-email-absahu@codeaurora.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The rx_nents and tx_nents are redundant. rx_buf and tx_buf can be used for total number of SG entries. Signed-off-by: Abhishek Sahu --- drivers/i2c/busses/i2c-qup.c | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/drivers/i2c/busses/i2c-qup.c b/drivers/i2c/busses/i2c-qup.c index c68f433..bb83a2967 100644 --- a/drivers/i2c/busses/i2c-qup.c +++ b/drivers/i2c/busses/i2c-qup.c @@ -692,7 +692,7 @@ static int qup_i2c_bam_do_xfer(struct qup_i2c_dev *qup, struct i2c_msg *msg, struct dma_async_tx_descriptor *txd, *rxd = NULL; int ret = 0, idx = 0, limit = QUP_READ_LIMIT; dma_cookie_t cookie_rx, cookie_tx; - u32 rx_nents = 0, tx_nents = 0, len, blocks, rem; + u32 len, blocks, rem; u32 i, tlen, tx_len, tx_buf = 0, rx_buf = 0, off = 0; u8 *tags; @@ -707,9 +707,6 @@ static int qup_i2c_bam_do_xfer(struct qup_i2c_dev *qup, struct i2c_msg *msg, rem = msg->len - (blocks - 1) * limit; if (msg->flags & I2C_M_RD) { - rx_nents += (blocks * 2) + 1; - tx_nents += 1; - while (qup->blk.pos < blocks) { tlen = (i == (blocks - 1)) ? rem : limit; tags = &qup->start_tag.start[off + len]; @@ -748,8 +745,6 @@ static int qup_i2c_bam_do_xfer(struct qup_i2c_dev *qup, struct i2c_msg *msg, if (ret) return ret; } else { - tx_nents += (blocks * 2); - while (qup->blk.pos < blocks) { tlen = (i == (blocks - 1)) ? rem : limit; tags = &qup->start_tag.start[off + tx_len]; @@ -775,7 +770,7 @@ static int qup_i2c_bam_do_xfer(struct qup_i2c_dev *qup, struct i2c_msg *msg, if (idx == (num - 1)) { len = 1; - if (rx_nents) { + if (rx_buf) { qup->btx.tag.start[0] = QUP_BAM_INPUT_EOT; len++; @@ -787,14 +782,13 @@ static int qup_i2c_bam_do_xfer(struct qup_i2c_dev *qup, struct i2c_msg *msg, len, qup, DMA_TO_DEVICE); if (ret) return ret; - tx_nents += 1; } } idx++; msg++; } - txd = dmaengine_prep_slave_sg(qup->btx.dma, qup->btx.sg, tx_nents, + txd = dmaengine_prep_slave_sg(qup->btx.dma, qup->btx.sg, tx_buf, DMA_MEM_TO_DEV, DMA_PREP_INTERRUPT | DMA_PREP_FENCE); if (!txd) { @@ -803,7 +797,7 @@ static int qup_i2c_bam_do_xfer(struct qup_i2c_dev *qup, struct i2c_msg *msg, goto desc_err; } - if (!rx_nents) { + if (!rx_buf) { txd->callback = qup_i2c_bam_cb; txd->callback_param = qup; } @@ -816,9 +810,9 @@ static int qup_i2c_bam_do_xfer(struct qup_i2c_dev *qup, struct i2c_msg *msg, dma_async_issue_pending(qup->btx.dma); - if (rx_nents) { + if (rx_buf) { rxd = dmaengine_prep_slave_sg(qup->brx.dma, qup->brx.sg, - rx_nents, DMA_DEV_TO_MEM, + rx_buf, DMA_DEV_TO_MEM, DMA_PREP_INTERRUPT); if (!rxd) { dev_err(qup->dev, "failed to get rx desc\n"); @@ -853,7 +847,7 @@ static int qup_i2c_bam_do_xfer(struct qup_i2c_dev *qup, struct i2c_msg *msg, goto desc_err; } - if (rx_nents) + if (rx_buf) writel(QUP_BAM_INPUT_EOT, qup->base + QUP_OUT_FIFO_BASE); @@ -871,10 +865,10 @@ static int qup_i2c_bam_do_xfer(struct qup_i2c_dev *qup, struct i2c_msg *msg, } desc_err: - dma_unmap_sg(qup->dev, qup->btx.sg, tx_nents, DMA_TO_DEVICE); + dma_unmap_sg(qup->dev, qup->btx.sg, tx_buf, DMA_TO_DEVICE); - if (rx_nents) - dma_unmap_sg(qup->dev, qup->brx.sg, rx_nents, + if (rx_buf) + dma_unmap_sg(qup->dev, qup->brx.sg, rx_buf, DMA_FROM_DEVICE); return ret; -- QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation