]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
i2c: testunit: sort case blocks
authorWolfram Sang <wsa+renesas@sang-engineering.com>
Sun, 11 Aug 2024 21:23:13 +0000 (23:23 +0200)
committerWolfram Sang <wsa+renesas@sang-engineering.com>
Wed, 14 Aug 2024 17:55:03 +0000 (19:55 +0200)
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>
drivers/i2c/i2c-slave-testunit.c

index 4c550306f3ec5955f553251724a7d3ebe3d8547c..be1d2e900aef3a1c203f5e76277cd787fff6feaa 100644 (file)
@@ -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]--;