linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Yicong Yang <yangyicong@hisilicon.com>
To: Jarkko Nikula <jarkko.nikula@linux.intel.com>, <wsa@kernel.org>,
	<andriy.shevchenko@linux.intel.com>, <linux-i2c@vger.kernel.org>,
	<Sergey.Semin@baikalelectronics.ru>,
	<linux-kernel@vger.kernel.org>
Cc: <digetx@gmail.com>, <treding@nvidia.com>,
	<rmk+kernel@armlinux.org.uk>, <song.bao.hua@hisilicon.com>,
	<john.garry@huawei.com>, <mika.westerberg@linux.intel.com>,
	<prime.zeng@huawei.com>, <linuxarm@huawei.com>
Subject: Re: [PATCH v6 3/5] i2c: add support for HiSilicon I2C controller
Date: Wed, 7 Apr 2021 18:16:37 +0800	[thread overview]
Message-ID: <19f33eff-e7b2-0e03-bbd4-f50b2ef050c5@hisilicon.com> (raw)
In-Reply-To: <f1d50200-93f5-2c35-933a-01a1e7622983@linux.intel.com>

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!


  reply	other threads:[~2021-04-07 10:16 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-31 13:36 [PATCH v6 0/5] Add support for HiSilicon I2C controller Yicong Yang
2021-03-31 13:36 ` [PATCH v6 1/5] i2c: core: add managed function for adding i2c adapters Yicong Yang
2021-04-06 20:16   ` Wolfram Sang
2021-03-31 13:36 ` [PATCH v6 2/5] i2c: core: add api to provide frequency mode strings Yicong Yang
2021-04-06 19:54   ` Wolfram Sang
2021-04-07  8:29     ` Yicong Yang
2021-04-07 10:08       ` Andy Shevchenko
2021-04-07 10:24         ` Yicong Yang
2021-04-07 22:56           ` Wolfram Sang
2021-03-31 13:36 ` [PATCH v6 3/5] i2c: add support for HiSilicon I2C controller Yicong Yang
2021-04-06 20:02   ` Wolfram Sang
2021-04-07  8:18     ` Yicong Yang
2021-04-07  8:32   ` Jarkko Nikula
2021-04-07 10:16     ` Yicong Yang [this message]
2021-04-07 23:04     ` Wolfram Sang
2021-04-08  7:17       ` Yicong Yang
2021-04-08  9:43         ` Andy Shevchenko
2021-03-31 13:36 ` [PATCH v6 4/5] MAINTAINERS: Add maintainer for HiSilicon I2C driver Yicong Yang
2021-03-31 13:36 ` [PATCH v6 5/5] i2c: designware: Switch over to i2c_freq_mode_string() Yicong Yang
2021-04-06 20:18 ` [PATCH v6 0/5] Add support for HiSilicon I2C controller Wolfram Sang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=19f33eff-e7b2-0e03-bbd4-f50b2ef050c5@hisilicon.com \
    --to=yangyicong@hisilicon.com \
    --cc=Sergey.Semin@baikalelectronics.ru \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=digetx@gmail.com \
    --cc=jarkko.nikula@linux.intel.com \
    --cc=john.garry@huawei.com \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxarm@huawei.com \
    --cc=mika.westerberg@linux.intel.com \
    --cc=prime.zeng@huawei.com \
    --cc=rmk+kernel@armlinux.org.uk \
    --cc=song.bao.hua@hisilicon.com \
    --cc=treding@nvidia.com \
    --cc=wsa@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).