Re: [PATCH v3] i2c: Add FTDI FT4222H USB I2C adapter

From: Francesco Lavra

Date: Mon Feb 09 2026 - 04:18:28 EST


On Wed, 2026-02-04 at 23:06 +0100, Andi Shyti wrote:
...
> > +       buf[0] = slave_addr << 1;
> > +       buf[2] = buf[3] = 0;
> > +       do {
> > +               int pkt_len = min(FT4222_TX_HDRLEN + len - written,
> > +                                 FT4222_BULK_MAXLEN);
> > +               bool first_pkt = (written == 0);
> > +               bool last_pkt = (written + pkt_len == FT4222_TX_HDRLEN
> > + len);
> > +               int ret, actual_len;
> > +
> > +               buf[1] = 0;
> > +               if (first_pkt)
> > +                       buf[1] |= flags & FT4222_FLAG_RESTART;
>
> Aren't we losing the _START case here?

The _RESTART flag is 0x3, and the _START flag is 0x02, so by applying the
_RESTART mask we are including the _START case too. But the code shouldn't
depend on this detail, I will change it to `flags & (FT4222_FLAG_START |
FT4222_FLAG_RESTART)`.