[PATCH] i2c-imx: Add missing preporcessor directives
andrew.smirnov at gmail.com
Sat Aug 15 08:48:54 PDT 2015
> This driver is only built for ARCH_IMX (which select COMMON_CLK)
> or two PowerPC variants.
> See following snip from Kconfig:
> config I2C_IMX
> bool "MPC85xx/MPC5200/i.MX I2C Master driver"
> depends on (ARCH_IMX && !ARCH_IMX1) || ARCH_MPC85XX || ARCH_MPC5200
> How did you hit this bug in the first place?
I didn't really hit that bug. I was reading the source code of
i2c-imx.c to see an example of I2C controller driver and I noticed
inconsistency in how conditional compilation was applied.
> If there is a valid reason to use this driver for non COMMON_CLK
> case and not PowerPC then consider following approach.
> Here the iffeddery is kept at the definition of the function.
I like your approach better. I'll update the patch.
> diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c
> index 714e83c..9e2c810 100644
> --- a/drivers/i2c/busses/i2c-imx.c
> +++ b/drivers/i2c/busses/i2c-imx.c
> @@ -337,7 +337,7 @@ static void i2c_fsl_set_clk(struct fsl_i2c_struct *i2c_fsl,
> i2c_fsl->ifdr = fdr;
> i2c_fsl->dfsrr = dfsr;
> +#elif defined (COMMON_CLK)
> static void i2c_fsl_set_clk(struct fsl_i2c_struct *i2c_fsl,
> unsigned int rate)
> @@ -374,6 +374,11 @@ static void i2c_fsl_set_clk(struct fsl_i2c_struct *i2c_fsl,
> dev_dbg(&i2c_fsl->adapter.dev, "<%s> IFDR[IC]=0x%x, REAL DIV=%d\n",
> __func__, i2c_clk_div[i], i2c_clk_div[i]);
> +static void i2c_fsl_set_clk(struct fsl_i2c_struct *i2c_fsl,
> + unsigned int rate)
> static int i2c_fsl_write(struct i2c_adapter *adapter, struct i2c_msg *msgs)
More information about the barebox