Received: by 10.223.185.116 with SMTP id b49csp5459907wrg; Tue, 27 Feb 2018 13:49:48 -0800 (PST) X-Google-Smtp-Source: AH8x2276mea60IHiN/MSxfHK5POvVbKZBe9nOSCbSzSxbKSiDqOVa0iLQuL8OFAOXgG8Jb9Dq3oQ X-Received: by 10.99.144.74 with SMTP id a71mr12232236pge.244.1519768188328; Tue, 27 Feb 2018 13:49:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519768188; cv=none; d=google.com; s=arc-20160816; b=okYW4JSUpwJI7MEZ7+nYDlhxM+n0Oluq4BbZiy2S3n5rRmQsU76Eg2LcqfjCXHqe5G jhn4d40EdRhSngWOBbj1SBWRcxGGC37lTHHLrf62gtWcbIiH7aDRVEGTBWlVA9Pw3+nQ XU9NpdiJorNuY7rDPwY974yvXvBQlOgo1ClXBqKd9/nMza1XBLJSKi1wB4x029I8uHt8 RysKPdufp5tUy8nPjN7Jr2ac2GH5ieAPOnwhEyQESP9wKdtDXm3rhBbwJv8L/Gm04dV8 2CtctId5H0TVUV/O+IFBO4Qn8THPFiL6fQr5y1neXQW0IhOxsWNPa/b5bkKoj1amlKIp 5tIg== 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=4E/3/rJWtmX2a1L4mE7Y0A271v6piIT7Q9xNteHXHck=; b=H832zyJxDGS2uooAYVRQ9VEw4sCNjmzwVGopzANuJ503thJhgDrmgVKkQhNpAsk+xj rjsU1BDP1hLYsWht1G69IzQq2yzUb2xJRI5A6rzrecBX1cEmAaVKWdL6vOGlDHGQZ2zU DNAvuGG/p6Dkn3S+jqffRW16iuWaGmhm5g+M3/zvnlHLbnMeHgoz3He10+HX9mZ6c/02 dVXHmICf+uKi+MGmzyQAwk/TbGBTitv74nZIypNmn06mFE9qw7q1CPKqY7Yxfl6FHn6r sZDfkyY3eg/kdZmnqDEC30ft7wRA0qr/e5k9SBVM+OshFtJ7bApe+qJB2re5v3BqvP4O uVkQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=BN8R9bsn; dkim=pass header.i=@codeaurora.org header.s=default header.b=BN8R9bsn; 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 2si84768pfd.275.2018.02.27.13.49.33; Tue, 27 Feb 2018 13:49:48 -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=BN8R9bsn; dkim=pass header.i=@codeaurora.org header.s=default header.b=BN8R9bsn; 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 S1751940AbeB0VsT (ORCPT + 99 others); Tue, 27 Feb 2018 16:48:19 -0500 Received: from smtp.codeaurora.org ([198.145.29.96]:40958 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751139AbeB0VsR (ORCPT ); Tue, 27 Feb 2018 16:48:17 -0500 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id E3750607EF; Tue, 27 Feb 2018 21:48:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1519768096; bh=uRSxZgZwf0eoUq/lrQk5aa/oy7LwWMGFRN6f8+DbIb8=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=BN8R9bsnItKOrEzj0Fn8MxtAcg0DtCTClY0OeEjuQOJDQFZoqwBH+Axbqc+wFQBHp x7otMAjfBEbmYoxKYY8sS8q4rjQRA/CcOiKnOmQILzRwZxj9DRYPfM1MTv6ca3qzDw +UJ+L1XWtRU7mjXFvdkg1w4ODdXzvohVY598CrDI= 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 8E5F3600C1; Tue, 27 Feb 2018 21:48:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1519768096; bh=uRSxZgZwf0eoUq/lrQk5aa/oy7LwWMGFRN6f8+DbIb8=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=BN8R9bsnItKOrEzj0Fn8MxtAcg0DtCTClY0OeEjuQOJDQFZoqwBH+Axbqc+wFQBHp x7otMAjfBEbmYoxKYY8sS8q4rjQRA/CcOiKnOmQILzRwZxj9DRYPfM1MTv6ca3qzDw +UJ+L1XWtRU7mjXFvdkg1w4ODdXzvohVY598CrDI= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 8E5F3600C1 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 02/12] i2c: qup: minor code reorganization for use_dma 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-3-git-send-email-absahu@codeaurora.org> From: "Christ, Austin" Message-ID: <73c94c05-e4a8-cb02-1919-1f872aafd96a@codeaurora.org> Date: Tue, 27 Feb 2018 14:48:14 -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-3-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 Tested on Centriq 2400 Reviewed-by: Austin Christ On 2/3/2018 12:58 AM, Abhishek Sahu wrote: > 1. Assigns use_dma in qup_dev structure itself which will > help in subsequent patches to determine the mode in IRQ handler. > 2. Does minor code reorganization for loops to reduce the > unnecessary comparison and assignment. > > Signed-off-by: Abhishek Sahu > --- > drivers/i2c/busses/i2c-qup.c | 19 +++++++++++-------- > 1 file changed, 11 insertions(+), 8 deletions(-) > > diff --git a/drivers/i2c/busses/i2c-qup.c b/drivers/i2c/busses/i2c-qup.c > index 9faa26c41a..c68f433 100644 > --- a/drivers/i2c/busses/i2c-qup.c > +++ b/drivers/i2c/busses/i2c-qup.c > @@ -190,6 +190,8 @@ struct qup_i2c_dev { > > /* dma parameters */ > bool is_dma; > + /* To check if the current transfer is using DMA */ > + bool use_dma; > struct dma_pool *dpool; > struct qup_i2c_tag start_tag; > struct qup_i2c_bam brx; > @@ -1297,7 +1299,7 @@ static int qup_i2c_xfer_v2(struct i2c_adapter *adap, > int num) > { > struct qup_i2c_dev *qup = i2c_get_adapdata(adap); > - int ret, len, idx = 0, use_dma = 0; > + int ret, len, idx = 0; > > qup->bus_err = 0; > qup->qup_err = 0; > @@ -1326,13 +1328,12 @@ static int qup_i2c_xfer_v2(struct i2c_adapter *adap, > len = (msgs[idx].len > qup->out_fifo_sz) || > (msgs[idx].len > qup->in_fifo_sz); > > - if ((!is_vmalloc_addr(msgs[idx].buf)) && len) { > - use_dma = 1; > - } else { > - use_dma = 0; > + if (is_vmalloc_addr(msgs[idx].buf) || !len) > break; > - } > } > + > + if (idx == num) > + qup->use_dma = true; > } > > idx = 0; > @@ -1356,15 +1357,17 @@ static int qup_i2c_xfer_v2(struct i2c_adapter *adap, > > reinit_completion(&qup->xfer); > > - if (use_dma) { > + if (qup->use_dma) { > ret = qup_i2c_bam_xfer(adap, &msgs[idx], num); > + qup->use_dma = false; > + break; > } else { > if (msgs[idx].flags & I2C_M_RD) > ret = qup_i2c_read_one_v2(qup, &msgs[idx]); > else > ret = qup_i2c_write_one_v2(qup, &msgs[idx]); > } > - } while ((idx++ < (num - 1)) && !use_dma && !ret); > + } while ((idx++ < (num - 1)) && !ret); > > if (!ret) > ret = qup_i2c_change_state(qup, QUP_RESET_STATE); > -- 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.