Subject: Re: [PATCH v2 1/2] i2c: smbus: add core function handling SMBus host-notify

From: Wolfram Sang <[email-masked]>
Date: Sun, 2 Aug 2020 21:15:23 +0200

> I've simplified the index handling as you suggested. The only impact is that
> finally we do not consider anymore the I2C_SLAVE_WRITE_REQUESTED event as the
> beginning of the transaction since we don't perform the "reset" of the
> handling upon this event.

One more comment on this one because I had to update the testunit, too.
To be robust against multiple write messages in one transfer, we need to
reset both, after STOP and when I2C_SLAVE_WRITE_REQUESTED. See here:

 96         case I2C_SLAVE_STOP:
 97                 if (tu->reg_idx == TU_NUM_REGS)
 98                         queue_delayed_work(system_long_wq, &tu->worker,
 99                                            msecs_to_jiffies(100 * tu->regs[TU_REG_DELAY]));
100                 fallthrough;
101 
102         case I2C_SLAVE_WRITE_REQUESTED:
103                 tu->reg_idx = 0;
104                 break;

As you see, I used 'fallthrough' to avoid code duplication and that only
one reset part will be updated.

Dunno if you really need it, too, as I haven't seen your latest code yet.

_______________________________________________
linux-arm-kernel mailing list
[email-masked]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel