summaryrefslogtreecommitdiffstats
path: root/drivers/i2c/i2c-slave-testunit.c
diff options
context:
space:
mode:
authorWolfram Sang <wsa+renesas@sang-engineering.com>2024-08-11 23:23:13 +0200
committerWolfram Sang <wsa+renesas@sang-engineering.com>2024-08-14 19:55:03 +0200
commitadd03629dbae457692d7ce4dcdb6fe3a40356538 (patch)
treec5e50ce3b776aba4a387c9037a9294a9b40632d5 /drivers/i2c/i2c-slave-testunit.c
parentLinux 6.11-rc3 (diff)
downloadlinux-add03629dbae457692d7ce4dcdb6fe3a40356538.tar.xz
linux-add03629dbae457692d7ce4dcdb6fe3a40356538.zip
i2c: testunit: sort case blocks
Because a 'fallthrough' was refactored away, the order of 'case' statements can be sorted better now to ease understanding the flow of events. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Diffstat (limited to 'drivers/i2c/i2c-slave-testunit.c')
-rw-r--r--drivers/i2c/i2c-slave-testunit.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/drivers/i2c/i2c-slave-testunit.c b/drivers/i2c/i2c-slave-testunit.c
index 4c550306f3ec..be1d2e900aef 100644
--- a/drivers/i2c/i2c-slave-testunit.c
+++ b/drivers/i2c/i2c-slave-testunit.c
@@ -94,6 +94,14 @@ static int i2c_slave_testunit_slave_cb(struct i2c_client *client,
int ret = 0;
switch (event) {
+ case I2C_SLAVE_WRITE_REQUESTED:
+ if (test_bit(TU_FLAG_IN_PROCESS, &tu->flags))
+ return -EBUSY;
+
+ memset(tu->regs, 0, TU_NUM_REGS);
+ tu->reg_idx = 0;
+ break;
+
case I2C_SLAVE_WRITE_RECEIVED:
if (test_bit(TU_FLAG_IN_PROCESS, &tu->flags))
return -EBUSY;
@@ -127,14 +135,6 @@ static int i2c_slave_testunit_slave_cb(struct i2c_client *client,
tu->reg_idx = 0;
break;
- case I2C_SLAVE_WRITE_REQUESTED:
- if (test_bit(TU_FLAG_IN_PROCESS, &tu->flags))
- return -EBUSY;
-
- memset(tu->regs, 0, TU_NUM_REGS);
- tu->reg_idx = 0;
- break;
-
case I2C_SLAVE_READ_PROCESSED:
if (is_proc_call && tu->regs[TU_REG_DATAH])
tu->regs[TU_REG_DATAH]--;