[U-Boot] [PATCH v2 08/18] spi: mpc8xxx: Simplify if
Mario Six
mario.six at gdsys.cc
Thu Apr 19 12:36:23 UTC 2018
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 at gdsys.cc>
---
Changes v1 -> v2:
None
---
drivers/spi/mpc8xxx_spi.c | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/drivers/spi/mpc8xxx_spi.c b/drivers/spi/mpc8xxx_spi.c
index b5546aa502..c4a9ef53ef 100644
--- a/drivers/spi/mpc8xxx_spi.c
+++ b/drivers/spi/mpc8xxx_spi.c
@@ -121,13 +121,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 */
--
2.16.1
More information about the U-Boot
mailing list