spi: mpc8xxx: Simplify if
authorMario Six <mario.six@gdsys.cc>
Sun, 28 Apr 2019 20:28:43 +0000 (01:58 +0530)
committerJagan Teki <jagan@amarulasolutions.com>
Mon, 10 Jun 2019 12:29:48 +0000 (17:59 +0530)
Instead of having a nested if block, just have two branches within the
overarching if block to eliminate one nesting level.

Signed-off-by: Mario Six <mario.six@gdsys.cc>
Acked-by: Jagan Teki <jagan@amarulasolutions.com>
drivers/spi/mpc8xxx_spi.c

index da9e1e3f98c840526b0b38637edec55e8bebe531..ca345709012966cdbe66e76bc497002fd155bb77 100644 (file)
@@ -120,13 +120,11 @@ int spi_xfer(struct spi_slave *slave, uint bitlen, const void *dout, void *din,
 
                clrbits_be32(&spi->mode, SPI_MODE_EN);
 
-               if (bitlen <= 16) {
-                       if (bitlen <= 4)
-                               clrsetbits_be32(&spi->mode, 0x00f00000,
-                                               (3 << 20));
-                       else
-                               clrsetbits_be32(&spi->mode, 0x00f00000,
-                                               ((bitlen - 1) << 20));
+               if (bitlen <= 4) {
+                       clrsetbits_be32(&spi->mode, 0x00f00000, (3 << 20));
+               } else if (bitlen <= 16) {
+                       clrsetbits_be32(&spi->mode, 0x00f00000,
+                                       ((bitlen - 1) << 20));
                } else {
                        clrbits_be32(&spi->mode, 0x00f00000);
                        /* Set up the next iteration if sending > 32 bits */