summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDirk Eibach <dirk.eibach@gdsys.cc>2015-10-28 11:46:23 +0100
committerTom Rini <trini@konsulko.com>2015-11-12 15:59:01 -0500
commit3af0cdb137b5a94751913467615d7e961271a69c (patch)
treeebe2470af007387633f967b64a131264c5e86b1b
parent071be896947a2b6ab791657e250da6fc995360a8 (diff)
downloadu-boot-imx-3af0cdb137b5a94751913467615d7e961271a69c.zip
u-boot-imx-3af0cdb137b5a94751913467615d7e961271a69c.tar.gz
u-boot-imx-3af0cdb137b5a94751913467615d7e961271a69c.tar.bz2
i2c: ihs_i2c: Use macro bestpractices
Reinhard Pfau complained that macros in ihs_i2c do not follow best practices. Signed-off-by: Dirk Eibach <dirk.eibach@gdsys.cc> Acked-by: Heiko Schocher <hs@denx.de>
-rw-r--r--drivers/i2c/ihs_i2c.c24
1 files changed, 14 insertions, 10 deletions
diff --git a/drivers/i2c/ihs_i2c.c b/drivers/i2c/ihs_i2c.c
index 737beaf..e001459 100644
--- a/drivers/i2c/ihs_i2c.c
+++ b/drivers/i2c/ihs_i2c.c
@@ -13,24 +13,28 @@ DECLARE_GLOBAL_DATA_PTR;
#ifdef CONFIG_SYS_I2C_IHS_DUAL
#define I2C_SET_REG(fld, val) \
- { if (I2C_ADAP_HWNR & 0x10) \
- FPGA_SET_REG(I2C_ADAP_HWNR & 0xf, i2c1.fld, val); \
- else \
- FPGA_SET_REG(I2C_ADAP_HWNR, i2c0.fld, val); }
+ do { \
+ if (I2C_ADAP_HWNR & 0x10) \
+ FPGA_SET_REG(I2C_ADAP_HWNR & 0xf, i2c1.fld, val); \
+ else \
+ FPGA_SET_REG(I2C_ADAP_HWNR, i2c0.fld, val); \
+ } while (0)
#else
#define I2C_SET_REG(fld, val) \
- FPGA_SET_REG(I2C_ADAP_HWNR, i2c0.fld, val);
+ FPGA_SET_REG(I2C_ADAP_HWNR, i2c0.fld, val)
#endif
#ifdef CONFIG_SYS_I2C_IHS_DUAL
#define I2C_GET_REG(fld, val) \
- { if (I2C_ADAP_HWNR & 0x10) \
- FPGA_GET_REG(I2C_ADAP_HWNR & 0xf, i2c1.fld, val); \
- else \
- FPGA_GET_REG(I2C_ADAP_HWNR, i2c0.fld, val); }
+ do { \
+ if (I2C_ADAP_HWNR & 0x10) \
+ FPGA_GET_REG(I2C_ADAP_HWNR & 0xf, i2c1.fld, val); \
+ else \
+ FPGA_GET_REG(I2C_ADAP_HWNR, i2c0.fld, val); \
+ } while (0)
#else
#define I2C_GET_REG(fld, val) \
- FPGA_GET_REG(I2C_ADAP_HWNR, i2c0.fld, val);
+ FPGA_GET_REG(I2C_ADAP_HWNR, i2c0.fld, val)
#endif
enum {