From 2049b5bcdd2172424c1ffc9b87d8f40020e9ebd6 Mon Sep 17 00:00:00 2001 From: Felipe Balbi Date: Wed, 12 Sep 2012 16:27:57 +0530 Subject: i2c: omap: decrease indentation level on data handling The patch intends to decrease the indentation level on the data handling by using the fact that else of if (dev->buf_len) is same as if (!dev->buf_len) if (dev->buf_len) { aaa; } else { bbb; break; } to if (!dev->buf_len) { bbb; break; } aaa; Hence no functional changes. Signed-off-by: Felipe Balbi Reviewed-by : Santosh Shilimkar Signed-off-by: Shubhrajyoti D Signed-off-by: Wolfram Sang --- drivers/i2c/busses/i2c-omap.c | 63 +++++++++++++++++++++---------------------- 1 file changed, 31 insertions(+), 32 deletions(-) (limited to 'drivers/i2c') diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c index 236cb38bb859..0dd647abb89d 100644 --- a/drivers/i2c/busses/i2c-omap.c +++ b/drivers/i2c/busses/i2c-omap.c @@ -813,22 +813,7 @@ complete: >> 8) & 0x3F; } while (num_bytes--) { - w = omap_i2c_read_reg(dev, OMAP_I2C_DATA_REG); - if (dev->buf_len) { - *dev->buf++ = w; - dev->buf_len--; - /* - * Data reg in 2430, omap3 and - * omap4 is 8 bit wide - */ - if (dev->flags & - OMAP_I2C_FLAG_16BIT_DATA_REG) { - if (dev->buf_len) { - *dev->buf++ = w >> 8; - dev->buf_len--; - } - } - } else { + if (!dev->buf_len) { if (stat & OMAP_I2C_STAT_RRDY) dev_err(dev->dev, "RRDY IRQ while no data" @@ -839,6 +824,21 @@ complete: " requested\n"); break; } + + w = omap_i2c_read_reg(dev, OMAP_I2C_DATA_REG); + *dev->buf++ = w; + dev->buf_len--; + /* + * Data reg in 2430, omap3 and + * omap4 is 8 bit wide + */ + if (dev->flags & + OMAP_I2C_FLAG_16BIT_DATA_REG) { + if (dev->buf_len) { + *dev->buf++ = w >> 8; + dev->buf_len--; + } + } } omap_i2c_ack_stat(dev, stat & (OMAP_I2C_STAT_RRDY | OMAP_I2C_STAT_RDR)); @@ -855,22 +855,7 @@ complete: & 0x3F; } while (num_bytes--) { - w = 0; - if (dev->buf_len) { - w = *dev->buf++; - dev->buf_len--; - /* - * Data reg in 2430, omap3 and - * omap4 is 8 bit wide - */ - if (dev->flags & - OMAP_I2C_FLAG_16BIT_DATA_REG) { - if (dev->buf_len) { - w |= *dev->buf++ << 8; - dev->buf_len--; - } - } - } else { + if (!dev->buf_len) { if (stat & OMAP_I2C_STAT_XRDY) dev_err(dev->dev, "XRDY IRQ while no " @@ -882,6 +867,20 @@ complete: break; } + w = *dev->buf++; + dev->buf_len--; + /* + * Data reg in 2430, omap3 and + * omap4 is 8 bit wide + */ + if (dev->flags & + OMAP_I2C_FLAG_16BIT_DATA_REG) { + if (dev->buf_len) { + w |= *dev->buf++ << 8; + dev->buf_len--; + } + } + if ((dev->errata & I2C_OMAP_ERRATA_I462) && errata_omap3_i462(dev, &stat, &err)) goto complete; -- cgit v1.2.1