Re: [PATCH v6 3/5] i2c: add support for HiSilicon I2C controller

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

 



On 2021/4/7 16:32, Jarkko Nikula wrote:
> Hi
> 
> On 3/31/21 4:36 PM, Yicong Yang wrote:
>> +    ret = device_property_read_u64(dev, "clk_rate", &ctlr->clk_rate_khz);
>> +    if (ret) {
>> +        dev_err(dev, "failed to get clock frequency, ret = %d\n", ret);
>> +        return ret;
>> +    }
>> +
>> +    ctlr->clk_rate_khz = DIV_ROUND_UP_ULL(ctlr->clk_rate_khz, HZ_PER_KHZ);
>> +
> 
> I'd use a temp variable here for reading the "clk_rate" property in Hertz and calculating the derived kHz value from it. As a bonus allow to use u32 for clk_rate_khz instead of u64. u32 will still provide plenty of headroom :-)
> 
> Reason for temp variable is for me it's confusing to see statement like "rate_khz = rate_khz / 1000".
> 

I can get this addressed in the updated version. Thanks for the suggestion!




[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