mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Tomas Marek <tomas.marek@elrest.cz>
To: Sascha Hauer <s.hauer@pengutronix.de>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH v2] i2c: add EFI i2c master driver
Date: Thu, 4 Apr 2024 07:28:46 +0200	[thread overview]
Message-ID: <Zg46ji_wj9GPX9zZ@debian> (raw)
In-Reply-To: <Zg1IB9EmqjlyB-Gm@pengutronix.de>

Hi Sascha,

Thank you.

On Wed, Apr 03, 2024 at 02:13:59PM +0200, Sascha Hauer wrote:
> Hi Tomas,
> 
> Thanks for the patch. I applied it with some minor adjustments.
> 
> On Wed, Apr 03, 2024 at 09:49:09AM +0200, Tomas Marek wrote:
> > +static void i2c_msg_to_efi_op(
> > +	const struct efi_i2c_priv *i2c_priv,
> > +	const struct i2c_msg *msg,
> > +	struct efi_i2c_operation **op)
> 
> No need to pass a pointer to a pointer to the array, changed that to
> *op.

I'm afraid this won't work. The **op was an in/out pointer to the EFI
request operation array. The incremented pointer value was used by
subsequent calls to i2c_msg_to_efi_op(). If a pointer is used instead
of a pointer to a pointer, the op variable in the
i2c_msgs_to_efi_transaction() function isn't modified, and all I2C
messages are now stored in the first item of the EFI operations array.

> 
> > +{
> > +	unsigned int max_len = efi_i2c_max_len(i2c_priv, msg);
> > +	unsigned int remaining = msg->len;
> > +	u32 flags;
> > +
> > +	flags = (msg->flags & I2C_M_RD) ? EFI_I2C_FLAG_READ : 0;
> > +
> > +	do {
> > +		unsigned int len = (remaining < max_len) ? remaining : max_len;
> 
> We have a min() macro I used instead.

Perfect, thanks for the hint.

Best regards

Tomas

> 
> Sascha
> 
> -- 
> Pengutronix e.K.                           |                             |
> Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
> 31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
> Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



  reply	other threads:[~2024-04-04  5:29 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-03  7:49 Tomas Marek
2024-04-03 12:09 ` Sascha Hauer
2024-04-03 12:13 ` Sascha Hauer
2024-04-04  5:28   ` Tomas Marek [this message]
2024-04-04  6:35     ` Sascha Hauer

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=Zg46ji_wj9GPX9zZ@debian \
    --to=tomas.marek@elrest.cz \
    --cc=barebox@lists.infradead.org \
    --cc=s.hauer@pengutronix.de \
    /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