Re: [PATCH v2] i2c: add EFI i2c master driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 |




[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux