Re: [PATCH v1 19/40] i2c: lpc2k: Use generic definitions for bus frequencies

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Andy!

On 2/24/20 5:15 PM, Andy Shevchenko wrote:
> Since we have generic definitions for bus frequencies, let's use them.
> 
> Cc: Vladimir Zapolskiy <vz@xxxxxxxxx>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
> ---
>  drivers/i2c/busses/i2c-lpc2k.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/i2c/busses/i2c-lpc2k.c b/drivers/i2c/busses/i2c-lpc2k.c
> index deea18b14add..159ebec5861c 100644
> --- a/drivers/i2c/busses/i2c-lpc2k.c
> +++ b/drivers/i2c/busses/i2c-lpc2k.c
> @@ -396,7 +396,7 @@ static int i2c_lpc2k_probe(struct platform_device *pdev)
>  	ret = of_property_read_u32(pdev->dev.of_node, "clock-frequency",
>  				   &bus_clk_rate);
>  	if (ret)
> -		bus_clk_rate = 100000; /* 100 kHz default clock rate */
> +		bus_clk_rate = I2C_STANDARD_MODE_FREQ; /* 100 kHz default clock rate */

The line above becomes longer than 80 symbols, please fix it by simply
removing the comment, note that it might be an issue through the series.

Could I2C_STD_MODE_FREQ be a shorter and still acceptable name?

>  
>  	clkrate = clk_get_rate(i2c->clk);
>  	if (clkrate == 0) {
> @@ -407,9 +407,9 @@ static int i2c_lpc2k_probe(struct platform_device *pdev)
>  
>  	/* Setup I2C dividers to generate clock with proper duty cycle */
>  	clkrate = clkrate / bus_clk_rate;
> -	if (bus_clk_rate <= 100000)
> +	if (bus_clk_rate <= I2C_STANDARD_MODE_FREQ)
>  		scl_high = (clkrate * I2C_STD_MODE_DUTY) / 100;
> -	else if (bus_clk_rate <= 400000)
> +	else if (bus_clk_rate <= I2C_FAST_MODE_FREQ)
>  		scl_high = (clkrate * I2C_FAST_MODE_DUTY) / 100;
>  	else
>  		scl_high = (clkrate * I2C_FAST_MODE_PLUS_DUTY) / 100;
> 

After the requested fix:

Acked-by: Vladimir Zapolskiy <vz@xxxxxxxxx>

--
Best wishes,
Vladimir



[Index of Archives]     [Linux GPIO]     [Linux SPI]     [Linux Hardward Monitoring]     [LM Sensors]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux