File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -537,7 +537,7 @@ static void i2c_imx_set_clk(struct imx_i2c_struct *i2c_imx,
537
537
538
538
i2c_imx -> cur_clk = i2c_clk_rate ;
539
539
540
- div = (i2c_clk_rate + i2c_imx -> bitrate - 1 ) / i2c_imx -> bitrate ;
540
+ div = DIV_ROUND_UP (i2c_clk_rate , i2c_imx -> bitrate ) ;
541
541
if (div < i2c_clk_div [0 ].div )
542
542
i = 0 ;
543
543
else if (div > i2c_clk_div [i2c_imx -> hwdata -> ndivs - 1 ].div )
@@ -555,8 +555,8 @@ static void i2c_imx_set_clk(struct imx_i2c_struct *i2c_imx,
555
555
* This delay is used in I2C bus disable function
556
556
* to fix chip hardware bug.
557
557
*/
558
- i2c_imx -> disable_delay = (500000U * i2c_clk_div [i ].div
559
- + ( i2c_clk_rate / 2 ) - 1 ) / ( i2c_clk_rate / 2 );
558
+ i2c_imx -> disable_delay = DIV_ROUND_UP (500000U * i2c_clk_div [i ].div ,
559
+ i2c_clk_rate / 2 );
560
560
561
561
#ifdef CONFIG_I2C_DEBUG_BUS
562
562
dev_dbg (& i2c_imx -> adapter .dev , "I2C_CLK=%d, REQ DIV=%d\n" ,
You can’t perform that action at this time.
0 commit comments