Skip to content

Commit 119736c

Browse files
author
Wolfram Sang
committed
i2c: testunit: avoid re-issued work after read message
The to-be-fixed commit rightfully prevented that the registers will be cleared. However, the index must be cleared. Otherwise a read message will re-issue the last work. Fix it and add a comment describing the situation. Fixes: c422b6a ("i2c: testunit: don't erase registers after STOP") Signed-off-by: Wolfram Sang <[email protected]> Reviewed-by: Andi Shyti <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
1 parent bd9f534 commit 119736c

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

drivers/i2c/i2c-slave-testunit.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,13 @@ static int i2c_slave_testunit_slave_cb(struct i2c_client *client,
118118
queue_delayed_work(system_long_wq, &tu->worker,
119119
msecs_to_jiffies(10 * tu->regs[TU_REG_DELAY]));
120120
}
121+
122+
/*
123+
* Reset reg_idx to avoid that work gets queued again in case of
124+
* STOP after a following read message. But do not clear TU regs
125+
* here because we still need them in the workqueue!
126+
*/
127+
tu->reg_idx = 0;
121128
break;
122129

123130
case I2C_SLAVE_WRITE_REQUESTED:

0 commit comments

Comments
 (0)