Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp871211pxf; Wed, 7 Apr 2021 13:47:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwqhUzkMEnwd9KfXOZ+kV2QN9NCDJgFiJCmy4aDkC6x2jVbsIrzg9aVaYsFL8ztj2aANVDp X-Received: by 2002:a17:906:2419:: with SMTP id z25mr5914429eja.273.1617828477195; Wed, 07 Apr 2021 13:47:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617828477; cv=none; d=google.com; s=arc-20160816; b=haqpCM9uhsk8TLtqihCR8GtKDEEqDns0Q+cc3Qe0ciCas4WGmcOni1SQsjzaHfkdYU EZ27tnreGWUp2wTgwMImfc9rDsUBrNPebcaefst/Xsv16vpNG2MrzMD73wCavx2B2C80 dKSlRJ2sdC/qiOsJGr/Ko6TaFD7HIHkxiU0J4rUIxbOGfp2BmtWsI7AMgxAJzuNGNE7N iE9WWBWGmqMdpisVa+ni0slNRgjIrOdgg/xIMaiYb6NhxMs9GokCOgIs1tE9lYoxBqd9 uiImPFI4A2gAiYyqMAits7uQvEF7Fvc+Wa3fRIp2oXdBiXXgGJnAo5Lwkv/bzIjwy0Oq MlyA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:references:cc:to :subject; bh=KoOQwtnuiDWtLpG4i4Yf1gShlAghGsXyc3I8xKn6Ivs=; b=yKB2Lc4He2nQHSWfGDmCtJ0H0e5Azs0Pv+UNR8N9ZMkB//PPRaeaZRZDurnL6uYZc0 aEcrMoPFUFUw53DTi+I1qLsP1OBrnkiE+KkIFGKq2DWC6mKJc35wz/NYIxqQ0FUM/37U GIcqljdG6l4fe+gYTujY1ZcPmfS+17F2HrTtzTFmQ60vjGlyjuG9Ek76HV1RfmHn5FWf Z5E1Q/dTW0iSVTcpYPBVKuYkAH4Bh3bR9t4SPIBz/209S1DWGVJWZefqKIEIEiFIfnon wTwjADR9AM9sI2PaEDJe05B21ielzpp8eqo9ibtrquGiBZvtEabuEn6HXxQTK/TwlW0B +5fQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=hisilicon.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r2si6710794edm.605.2021.04.07.13.47.33; Wed, 07 Apr 2021 13:47:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=hisilicon.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350838AbhDGKQ5 (ORCPT + 99 others); Wed, 7 Apr 2021 06:16:57 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:15625 "EHLO szxga04-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350821AbhDGKQy (ORCPT ); Wed, 7 Apr 2021 06:16:54 -0400 Received: from DGGEMS406-HUB.china.huawei.com (unknown [172.30.72.59]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4FFgHF1d6lz19L6J; Wed, 7 Apr 2021 18:14:33 +0800 (CST) Received: from [127.0.0.1] (10.69.38.196) by DGGEMS406-HUB.china.huawei.com (10.3.19.206) with Microsoft SMTP Server id 14.3.498.0; Wed, 7 Apr 2021 18:16:37 +0800 Subject: Re: [PATCH v6 3/5] i2c: add support for HiSilicon I2C controller To: Jarkko Nikula , , , , , CC: , , , , , , , References: <1617197790-30627-1-git-send-email-yangyicong@hisilicon.com> <1617197790-30627-4-git-send-email-yangyicong@hisilicon.com> From: Yicong Yang Message-ID: <19f33eff-e7b2-0e03-bbd4-f50b2ef050c5@hisilicon.com> Date: Wed, 7 Apr 2021 18:16:37 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.5.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-Originating-IP: [10.69.38.196] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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!