Skip to content
Snippets Groups Projects
Commit 3af0cdb1 authored by Dirk Eibach's avatar Dirk Eibach Committed by Tom Rini
Browse files

i2c: ihs_i2c: Use macro bestpractices


Reinhard Pfau complained that macros in ihs_i2c do not follow best practices.

Signed-off-by: default avatarDirk Eibach <dirk.eibach@gdsys.cc>
Acked-by: default avatarHeiko Schocher <hs@denx.de>
parent 071be896
No related branches found
No related tags found
No related merge requests found
...@@ -13,24 +13,28 @@ DECLARE_GLOBAL_DATA_PTR; ...@@ -13,24 +13,28 @@ DECLARE_GLOBAL_DATA_PTR;
#ifdef CONFIG_SYS_I2C_IHS_DUAL #ifdef CONFIG_SYS_I2C_IHS_DUAL
#define I2C_SET_REG(fld, val) \ #define I2C_SET_REG(fld, val) \
{ if (I2C_ADAP_HWNR & 0x10) \ do { \
FPGA_SET_REG(I2C_ADAP_HWNR & 0xf, i2c1.fld, val); \ if (I2C_ADAP_HWNR & 0x10) \
else \ FPGA_SET_REG(I2C_ADAP_HWNR & 0xf, i2c1.fld, val); \
FPGA_SET_REG(I2C_ADAP_HWNR, i2c0.fld, val); } else \
FPGA_SET_REG(I2C_ADAP_HWNR, i2c0.fld, val); \
} while (0)
#else #else
#define I2C_SET_REG(fld, val) \ #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 #endif
#ifdef CONFIG_SYS_I2C_IHS_DUAL #ifdef CONFIG_SYS_I2C_IHS_DUAL
#define I2C_GET_REG(fld, val) \ #define I2C_GET_REG(fld, val) \
{ if (I2C_ADAP_HWNR & 0x10) \ do { \
FPGA_GET_REG(I2C_ADAP_HWNR & 0xf, i2c1.fld, val); \ if (I2C_ADAP_HWNR & 0x10) \
else \ FPGA_GET_REG(I2C_ADAP_HWNR & 0xf, i2c1.fld, val); \
FPGA_GET_REG(I2C_ADAP_HWNR, i2c0.fld, val); } else \
FPGA_GET_REG(I2C_ADAP_HWNR, i2c0.fld, val); \
} while (0)
#else #else
#define I2C_GET_REG(fld, val) \ #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 #endif
enum { enum {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment