[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <e4343807-60ad-3f40-7cd5-4acf8bc52bd9@collabora.com>
Date: Thu, 13 Apr 2023 12:40:09 +0300
From: Dmitry Osipenko <dmitry.osipenko@...labora.com>
To: Akhil R <akhilrajeev@...dia.com>, christian.koenig@....com,
digetx@...il.com, jonathanh@...dia.com, ldewangan@...dia.com,
linux-i2c@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-tegra@...r.kernel.org, sumit.semwal@...aro.org,
thierry.reding@...il.com, wsa@...nel.org
Subject: Re: [PATCH v4 1/2] i2c: tegra: Fix PEC support for SMBUS block read
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
Powered by blists - more mailing lists