Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp2174453rwl; Thu, 13 Apr 2023 02:43:08 -0700 (PDT) X-Google-Smtp-Source: AKy350a1WaYUI5ElGTxKBpzJxBJIlZRT/4OiLcZbiz9s8jmHTs+OSezSnpoPn0HBkUkL/rcg6vBj X-Received: by 2002:a17:907:2b0e:b0:94a:a350:2e39 with SMTP id gc14-20020a1709072b0e00b0094aa3502e39mr2130529ejc.62.1681378988147; Thu, 13 Apr 2023 02:43:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681378988; cv=none; d=google.com; s=arc-20160816; b=ttHdVmOA6B7dTq6bPzJSXvBlEPVOgQPAT6wtUmaH+eSqWVeE7AXeWED8XGgj0OGdXM 7mPCyCuGFukqdvU3BQ0mTtlAtTjx7FYEnSiRS9Vim42fhiyQXffpS+uq5NAoloQTM7wp wqUvz20wUnRsYUt1CF2s+mtIdTunv1krbxqWYOlZNFWl52ilLA3k/ucT2CUzyt6ynWge whLdJdSIHLyPP4Q5lMpjxmLQty/82q+qgOqxCdFtun3X+PGzTIsJ+8hEhcMRVV77JeXL xwWEzckaKNWxgBT9yveoRJOo+1V2e/XKG/uRbDGDb+NJI80NK16+TGMgitW4KSqqzhYa P6Ow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:to:content-language:subject:user-agent:mime-version:date :message-id:dkim-signature; bh=2gl0yW3SPGxvDSPnFsUDJoBJmWfSbRDAD6Sv7y6hlhQ=; b=JOOdaKkpQj1i53mUybeZTVOtS2p7QhMSjG0APQiFW4V7QHpH/MfDNk/Bl+6+gVweN/ S/30o/Yj5rxjZg6ggmc0MaiCG1zZEbCVMctk8elwbDozeXGoPtM1Ibd6TxuPQZU1RNot tF9DzXMHpMtXSXJiAxsLwgtGYh/KqP+wcEH53Rf4iWgTfp0mdm+fkPK2bdfuV/gw7cJd 4jpthKxuHc8OouNtKCLnuUAihNEjc/joZpSiGuSul83Kpy/aFxPqtwh1qmSstkKbWWO4 yaQD8DaKd7YYQYx1IfdU7RCa+PFfoEs4QPyKBA1Ib8j58O88tbie3mIjUZRU0ft/aUZ4 8hJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b="a/abK8QM"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id fn23-20020a1709069d1700b0094e9147fbbesi1260144ejc.491.2023.04.13.02.42.43; Thu, 13 Apr 2023 02:43:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b="a/abK8QM"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229720AbjDMJkV (ORCPT + 99 others); Thu, 13 Apr 2023 05:40:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34248 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229580AbjDMJkS (ORCPT ); Thu, 13 Apr 2023 05:40:18 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6AD9A10C2; Thu, 13 Apr 2023 02:40:15 -0700 (PDT) Received: from [192.168.2.164] (109-252-119-170.nat.spd-mgts.ru [109.252.119.170]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: dmitry.osipenko) by madras.collabora.co.uk (Postfix) with ESMTPSA id 5D8F86603207; Thu, 13 Apr 2023 10:40:13 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1681378814; bh=j0PvH5Ogecj9RSBYwtl96lu2V0fvpKZWcVehXb8syVI=; h=Date:Subject:To:References:From:In-Reply-To:From; b=a/abK8QMsJFVk8AOi1GfbnJq5Ma+VVmWJCm8AKtmO7CxiX0E/3ofrm42er5ShhHpx HRHgGMjbjzbWBq6N3KfPjx9IP7KhOdQ0WCWj2C/5L9R3JUzkMJRTPZbhgjomEQ80Bj v0wrAIjBj4AGFNPuXlJbaDQyKlZgzFuYnW9tTA/0j27K8YcZSYxNXCX5EAalsN1QRy Rv9HpvUhL+Vun4Ox7S53tZBDx+YjgHfxr6W24pG1AqyD1aCgREj/0S9kOfzOvN3yP7 VX2Kr4aqMxRGwIrRuUF7HZ/dktizKhMiJzvZwQQIYRcSSyNg6pYP3xtmBG4g6nrRwZ HodAM8Bry7qRQ== Message-ID: Date: Thu, 13 Apr 2023 12:40:09 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.9.1 Subject: Re: [PATCH v4 1/2] i2c: tegra: Fix PEC support for SMBUS block read Content-Language: en-US To: Akhil R , christian.koenig@amd.com, digetx@gmail.com, jonathanh@nvidia.com, ldewangan@nvidia.com, linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, linux-tegra@vger.kernel.org, sumit.semwal@linaro.org, thierry.reding@gmail.com, wsa@kernel.org References: <20230324115924.64218-1-akhilrajeev@nvidia.com> <20230324115924.64218-2-akhilrajeev@nvidia.com> From: Dmitry Osipenko In-Reply-To: <20230324115924.64218-2-akhilrajeev@nvidia.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-0.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,SORTED_RECIPS, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 3/24/23 14:59, Akhil R wrote: ... > @@ -279,6 +280,7 @@ struct tegra_i2c_dev { > size_t msg_buf_remaining; > int msg_err; > u8 *msg_buf; > + __u16 msg_len; __u16 is for UAPI headers, please use unsigned int. Also keep variables sorted by string length. > struct completion dma_complete; > struct dma_chan *tx_dma_chan; > @@ -1169,7 +1171,7 @@ static void tegra_i2c_push_packet_header(struct tegra_i2c_dev *i2c_dev, > else > i2c_writel(i2c_dev, packet_header, I2C_TX_FIFO); > > - packet_header = msg->len - 1; > + packet_header = i2c_dev->msg_len - 1; > > if (i2c_dev->dma_mode && !i2c_dev->msg_read) > *dma_buf++ = packet_header; > @@ -1242,20 +1244,32 @@ static int tegra_i2c_xfer_msg(struct tegra_i2c_dev *i2c_dev, > return err; > > i2c_dev->msg_buf = msg->buf; > + i2c_dev->msg_len = msg->len; > > - /* The condition true implies smbus block read and len is already read */ > - if (msg->flags & I2C_M_RECV_LEN && end_state != MSG_END_CONTINUE) > - i2c_dev->msg_buf = msg->buf + 1; > - > - i2c_dev->msg_buf_remaining = msg->len; > i2c_dev->msg_err = I2C_ERR_NONE; > i2c_dev->msg_read = !!(msg->flags & I2C_M_RD); > reinit_completion(&i2c_dev->msg_complete); > > + /* * Please correct the comment style > + * For SMBUS block read command, read only 1 byte in the first transfer. > + * Adjust that 1 byte for the next transfer in the msg buffer and msg > + * length. > + */ -- Best regards, Dmitry