lkml.org 
[lkml]   [2020]   [Aug]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2 1/2] i2c: smbus: add core function handling SMBus host-notify
> 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.

[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2020-08-02 21:16    [W:0.082 / U:0.624 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site