lkml.org 
[lkml]   [2021]   [Apr]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    SubjectRe: [PATCH v6 3/5] i2c: add support for HiSilicon I2C controller
    From
    Date
    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!

    \
     
     \ /
      Last update: 2021-04-07 12:17    [W:3.831 / U:0.268 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site