mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Michal Simek <michal.simek@xilinx.com>
To: Adam Wujek <dev_public@wujek.eu>,
	Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>
Cc: Michal Simek <michal.simek@xilinx.com>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-i2c@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2] i2c: busses: i2c-cadence: fix message length when receive block message
Date: Tue, 24 May 2022 17:05:54 +0200	[thread overview]
Message-ID: <006cdaf6-2fe3-7f01-2597-50e7da1f88c8@xilinx.com> (raw)
In-Reply-To: <20220519231058.437365-1-dev_public@wujek.eu>



On 5/20/22 01:11, Adam Wujek wrote:
> Needed by hwmon/pmbus_core driver to calculate PEC correctly.
> The hwmon/pmbus_core driver relies on bus drivers to update the message
> length of receive block transfers. Only in this type of smbus transfer
> the length is not known before the transfer is started.
> 
> Signed-off-by: Adam Wujek <dev_public@wujek.eu>
> ---
> Notes:
>      Changes in v2:
>      - fix multiline comment
> 
>   drivers/i2c/busses/i2c-cadence.c | 7 +++++++
>   1 file changed, 7 insertions(+)
> 
> diff --git a/drivers/i2c/busses/i2c-cadence.c b/drivers/i2c/busses/i2c-cadence.c
> index 805c77143a0f..a679eb390ef5 100644
> --- a/drivers/i2c/busses/i2c-cadence.c
> +++ b/drivers/i2c/busses/i2c-cadence.c
> @@ -794,6 +794,13 @@ static int cdns_i2c_process_msg(struct cdns_i2c *id, struct i2c_msg *msg,
>   		return -ETIMEDOUT;
>   	}
> 
> +	/*
> +	 * Update message len, as i2c/smbus driver (function
> +	 * i2c_smbus_xfer_emulated) relies on i2c device drivers to do this.
> +	 */
> +	if ((msg->flags & I2C_M_RECV_LEN) && (msg->flags & I2C_M_RD))
> +		msg->len = msg->buf[0] + 2; /* add len byte + PEC byte */
> +
>   	cdns_i2c_writereg(CDNS_I2C_IXR_ALL_INTR_MASK,
>   			  CDNS_I2C_IDR_OFFSET);
> 
> --
> 2.17.1
> 
> 

Shubhrajyoti: Can you please test it?

Thanks,
Michal

      reply	other threads:[~2022-05-24 15:06 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-19 12:50 [PATCH] " Adam Wujek
2022-05-19 23:11 ` [PATCH v2] " Adam Wujek
2022-05-24 15:05   ` Michal Simek [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=006cdaf6-2fe3-7f01-2597-50e7da1f88c8@xilinx.com \
    --to=michal.simek@xilinx.com \
    --cc=dev_public@wujek.eu \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=shubhrajyoti.datta@xilinx.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®