diff options
author | 2024-08-11 23:23:16 +0200 | |
---|---|---|
committer | 2024-08-14 19:56:51 +0200 | |
commit | 45c03c65ea77bd1a28ed1791b61594f579ee01ab (patch) | |
tree | fa692b6d60ff5bc8f2ad8b7d6d70658911660930 /drivers | |
parent | i2c: testunit: add command to support versioning and test rep_start (diff) | |
download | wireguard-linux-45c03c65ea77bd1a28ed1791b61594f579ee01ab.tar.xz wireguard-linux-45c03c65ea77bd1a28ed1791b61594f579ee01ab.zip |
i2c: testunit: return current command on read messages
Because the testunit can start tests in the future via the DELAY
register, it may happen that a command is still pending. Support
detecting that by returning the number of a command in progress (if
there is one).
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/i2c/i2c-slave-testunit.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/i2c/i2c-slave-testunit.c b/drivers/i2c/i2c-slave-testunit.c index 51b399aa09a0..04060bc8a9d0 100644 --- a/drivers/i2c/i2c-slave-testunit.c +++ b/drivers/i2c/i2c-slave-testunit.c @@ -15,7 +15,6 @@ #include <linux/slab.h> #include <linux/workqueue.h> /* FIXME: is system_long_wq the best choice? */ -#define TU_CUR_VERSION 0x01 #define TU_VERSION_MAX_LENGTH 128 enum testunit_cmds { @@ -159,7 +158,8 @@ static int i2c_slave_testunit_slave_cb(struct i2c_client *client, else if (is_proc_call) *val = tu->regs[TU_REG_DATAH]; else - *val = TU_CUR_VERSION; + *val = test_bit(TU_FLAG_IN_PROCESS, &tu->flags) ? + tu->regs[TU_REG_CMD] : 0; break; } |