lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <19f33eff-e7b2-0e03-bbd4-f50b2ef050c5@hisilicon.com>
Date:   Wed, 7 Apr 2021 18:16:37 +0800
From:   Yicong Yang <yangyicong@...ilicon.com>
To:     Jarkko Nikula <jarkko.nikula@...ux.intel.com>, <wsa@...nel.org>,
        <andriy.shevchenko@...ux.intel.com>, <linux-i2c@...r.kernel.org>,
        <Sergey.Semin@...kalelectronics.ru>, <linux-kernel@...r.kernel.org>
CC:     <digetx@...il.com>, <treding@...dia.com>,
        <rmk+kernel@...linux.org.uk>, <song.bao.hua@...ilicon.com>,
        <john.garry@...wei.com>, <mika.westerberg@...ux.intel.com>,
        <prime.zeng@...wei.com>, <linuxarm@...wei.com>
Subject: Re: [PATCH v6 3/5] i2c: add support for HiSilicon I2C controller

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!

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ