Received: by 10.223.185.116 with SMTP id b49csp5462281wrg; Tue, 27 Feb 2018 13:52:56 -0800 (PST) X-Google-Smtp-Source: AH8x224uuMi1uw91b2Opd3iaMX5ye6ttq9VZq3cgnA1iel2BJ1TWAT5dI2MA9b8bWCLPiUFN9L5y X-Received: by 2002:a17:902:523:: with SMTP id 32-v6mr15466781plf.145.1519768375967; Tue, 27 Feb 2018 13:52:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519768375; cv=none; d=google.com; s=arc-20160816; b=W5Zj3Wfudsp4o/wQlyd817zrhPhiygv/i9BIHXm6URD6M8xicqAXlPKn6DJX7e5bLN veJcWPf58iJuyKEtc2jN9Q8bw48g1PvWpWDBj3NR8GrBlolrf0zQlmATcwR9gAiRKDdU ip7bWj5xvAgN8rNyQDR5DdveDqwgjhmDuPVQg75fsRSIxIB/wFRatiL9/7/yJ1Jd6NqD SrItsAZZEMdIZpUABDbJSFP8BzwbH61UOfPV8RUW7V81MN/UhelmNLRbYajPq/QtWy6+ oEf2b3szuGLGxmiE+A/9mo3cMPkWCmGsGglqYpF2H7rIXvn3vSBvcGUAR+rILjL2DmR0 pK6w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dmarc-filter :dkim-signature:dkim-signature:arc-authentication-results; bh=glB3BDMXzy1NzTT7IHQBS1h8NR+Lvaxlm0IQNhVykFE=; b=S7alUeU5bQwVMY7c1VrJOfa2mUb18F8ioxE5dkrZzeSHL+ns+aLGFKIo+mImJMCUQH EcaKE7TMInXCJRKmOof7VfcwCiyB+h7jrtLqGwbQ+nZNl0GE6NIh97X10pJ7qA4sg2pt //IUUMLsONRMOgzkjLo1eDeCOUOBDm1DbzjWqrm5E8N7yVb+I56RiUXM7OitnAHg/kcN PydKal3u8wsS0RjFKoDRiH1k/APEN/FDW2tnZoK8ifzJssxbPan2wCMnzjeA8DvLsyLb 0tazK1B4oio59dFhhDFTsfm6m+kn4lWpncOKxcsyKTFKSwgiChtJb9M4UUlsB8w7JSIA 01+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=fgeIG4G3; dkim=pass header.i=@codeaurora.org header.s=default header.b=AkZX+9Mp; 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 x21-v6si83859pln.416.2018.02.27.13.52.41; Tue, 27 Feb 2018 13:52:55 -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=fgeIG4G3; dkim=pass header.i=@codeaurora.org header.s=default header.b=AkZX+9Mp; 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 S1751956AbeB0VvQ (ORCPT + 99 others); Tue, 27 Feb 2018 16:51:16 -0500 Received: from smtp.codeaurora.org ([198.145.29.96]:41774 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751550AbeB0VvO (ORCPT ); Tue, 27 Feb 2018 16:51:14 -0500 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 46E1C607EF; Tue, 27 Feb 2018 21:51:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1519768274; bh=zAt79J7XQgSdDS3SJY9tVVuAMRfcfEAoXpVKaUaiWoM=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=fgeIG4G3UHIK4EZro4hb4xl4kVIQq0tDrAnfOlCRC0VqrcIAYNYVKdTvM9scP4ZIu UAd12S6ndRudqLS5z65kCqSx4TOeIwlmerM6xbLG7/V3JZg1QEg2Aobf3IVAdXr5l9 hcqx1ZnxuMOjozywyK/k+kHo52JUJ+CRv/0kcfBo= 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 [10.226.60.117] (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: austinwc@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 01B5160390; Tue, 27 Feb 2018 21:51:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1519768273; bh=zAt79J7XQgSdDS3SJY9tVVuAMRfcfEAoXpVKaUaiWoM=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=AkZX+9Mp7sB4827/yH2frQH/HOQ/osyDoaIFgbg8OOFsjlU17u4HbIvFXtoAkI0Y7 We/BuIX2FEAZsVHMdUPRfMzWbSI18NeOfQpxQTuOOk2JdrjCBrlZOiQoByCBHu5v/z iZsioXrlkZPYTBmS7ED+N1f3xOex9FkE88f+EnRI= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 01B5160390 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=austinwc@codeaurora.org Subject: Re: [PATCH 03/12] i2c: qup: remove redundant variables for BAM SG count To: Abhishek Sahu , 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 References: <1517644697-30806-1-git-send-email-absahu@codeaurora.org> <1517644697-30806-4-git-send-email-absahu@codeaurora.org> From: "Christ, Austin" Message-ID: <80caf699-0680-7dbc-ef63-0cacd21ee607@codeaurora.org> Date: Tue, 27 Feb 2018 14:51:12 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <1517644697-30806-4-git-send-email-absahu@codeaurora.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org I agree with Sricharan's comments about naming, otherwise looks good. Tested on Centriq 2400 Reviewed-by: Austin Christ On 2/3/2018 12:58 AM, Abhishek Sahu wrote: > 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 Datacenter Technologies as an affiliate of Qualcomm Technologies, Inc. Qualcomm Technologies, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project.