From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.1 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5C9D2C433E1 for ; Wed, 20 May 2020 16:15:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 326E920671 for ; Wed, 20 May 2020 16:15:15 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="cTN8MLqD" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726727AbgETQPO (ORCPT ); Wed, 20 May 2020 12:15:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44506 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726436AbgETQPN (ORCPT ); Wed, 20 May 2020 12:15:13 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A2368C061A0E; Wed, 20 May 2020 09:15:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Content-Transfer-Encoding: Content-Type:In-Reply-To:MIME-Version:Date:Message-ID:From:References:Cc:To: Subject:Sender:Reply-To:Content-ID:Content-Description; bh=KUsG4feXigEdZ3QpYALXvpu/1zKdm/ox7vuSCPQehrI=; b=cTN8MLqDM8INSNrXIHuE2+fp09 UNc+u5wyrqEtriUMCkNXq63TjVhwN90f8CssOrLD37dfcPJkAW9o2Cgplh5Urq3dBC2NZJVXmUPE4 Pn1oQxZYoUQ8NzPVUuB/PB6r3wsG1pao7sGlEs2Z5oG4z4/yCaFGGzaOiRv2YC8u+YwUre+rCPPat DOAKg/QWoTChuBCw8tVTBhqJfhLVAXOGfmvTdJLPVSmjzL+O4fMpqU8EyvwB3kBWbCF3t4N6WUt6r 4uusMh5Bpe8D/t4OTl7ulP1uifl9IHKfAW6+3JuRA037ZRPEe84Z9uUZyjPmvLlEjavPow5eycrBO IcHZf5lw==; Received: from c-73-157-219-8.hsd1.or.comcast.net ([73.157.219.8] helo=[10.0.0.252]) by bombadil.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1jbRN6-00083y-Lu; Wed, 20 May 2020 16:15:09 +0000 Subject: Re: [next] i2c: mediatek: Use div_u64 for 64-bit division to fix 32-bit kernels To: qii.wang@mediatek.com, wsa@the-dreams.de Cc: linux-i2c@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org, srv_heupstream@mediatek.com, leilk.liu@mediatek.com References: <1589970713-19944-1-git-send-email-qii.wang@mediatek.com> From: Randy Dunlap Message-ID: Date: Wed, 20 May 2020 09:15:03 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 MIME-Version: 1.0 In-Reply-To: <1589970713-19944-1-git-send-email-qii.wang@mediatek.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 5/20/20 3:31 AM, qii.wang@mediatek.com wrote: > From: Qii Wang > > Use div_u64 for 64-bit division, and change sample_ns type to > unsigned int. Otherwise, the module will reference __udivdi3 > under 32-bit kernels, which is not allowed in kernel space. > > Signed-off-by: Qii Wang Acked-by: Randy Dunlap # build-tested thanks. > --- > drivers/i2c/busses/i2c-mt65xx.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/i2c/busses/i2c-mt65xx.c b/drivers/i2c/busses/i2c-mt65xx.c > index 7020618..deef69e 100644 > --- a/drivers/i2c/busses/i2c-mt65xx.c > +++ b/drivers/i2c/busses/i2c-mt65xx.c > @@ -551,7 +551,8 @@ static int mtk_i2c_check_ac_timing(struct mtk_i2c *i2c, > const struct i2c_spec_values *spec; > unsigned int su_sta_cnt, low_cnt, high_cnt, max_step_cnt; > unsigned int sda_max, sda_min, clk_ns, max_sta_cnt = 0x3f; > - long long sample_ns = (1000000000 * (sample_cnt + 1)) / clk_src; > + unsigned int sample_ns = div_u64(1000000000ULL * (sample_cnt + 1), > + clk_src); > > if (!i2c->dev_comp->timing_adjust) > return 0; > -- ~Randy From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.3 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7B6BFC433DF for ; Wed, 20 May 2020 16:15:19 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 51612207C4 for ; Wed, 20 May 2020 16:15:19 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="RA3jD/i2" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 51612207C4 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date: Message-ID:From:References:To:Subject:Reply-To:Content-ID:Content-Description :Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=hpFYeSj5nY+2pEOiddFT3FZBKumd9vWyApDty299Fmc=; b=RA3jD/i2WnRo7L qrxw2QudX6/OQA2txM0aduQMGZtKPFcDLgug48xYuxl5UfUphk1I1si5gcmBVB1NG4BYqwbtXlGDC iqHzQ4V3WLe5ym7iVyNckJZSQHiQJDbJkx1dh0UiuLrMHXzpZi67VF/M35t+qlyqNVbTVhlZCos+x c2uzXOhqB1PKSIJBFND42kyiBVW4rab2z2mYUD7SsEtR63Xz8py51auXcL+uNGgHoGnRLz4nqISsi PeZdr4P+sBu1KGzQvnp0V72USAYsoKZ7bA0oohJdIg/bUO8HeKqvCPrnJPZckb0Eao8zIUkvRluVz k0DfjCdQoFag2vBkZKUg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jbRN9-0000Gx-0b; Wed, 20 May 2020 16:15:11 +0000 Received: from c-73-157-219-8.hsd1.or.comcast.net ([73.157.219.8] helo=[10.0.0.252]) by bombadil.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1jbRN6-00083y-Lu; Wed, 20 May 2020 16:15:09 +0000 Subject: Re: [next] i2c: mediatek: Use div_u64 for 64-bit division to fix 32-bit kernels To: qii.wang@mediatek.com, wsa@the-dreams.de References: <1589970713-19944-1-git-send-email-qii.wang@mediatek.com> From: Randy Dunlap Message-ID: Date: Wed, 20 May 2020 09:15:03 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 MIME-Version: 1.0 In-Reply-To: <1589970713-19944-1-git-send-email-qii.wang@mediatek.com> Content-Language: en-US X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, srv_heupstream@mediatek.com, leilk.liu@mediatek.com, linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-i2c@vger.kernel.org, linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org On 5/20/20 3:31 AM, qii.wang@mediatek.com wrote: > From: Qii Wang > > Use div_u64 for 64-bit division, and change sample_ns type to > unsigned int. Otherwise, the module will reference __udivdi3 > under 32-bit kernels, which is not allowed in kernel space. > > Signed-off-by: Qii Wang Acked-by: Randy Dunlap # build-tested thanks. > --- > drivers/i2c/busses/i2c-mt65xx.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/i2c/busses/i2c-mt65xx.c b/drivers/i2c/busses/i2c-mt65xx.c > index 7020618..deef69e 100644 > --- a/drivers/i2c/busses/i2c-mt65xx.c > +++ b/drivers/i2c/busses/i2c-mt65xx.c > @@ -551,7 +551,8 @@ static int mtk_i2c_check_ac_timing(struct mtk_i2c *i2c, > const struct i2c_spec_values *spec; > unsigned int su_sta_cnt, low_cnt, high_cnt, max_step_cnt; > unsigned int sda_max, sda_min, clk_ns, max_sta_cnt = 0x3f; > - long long sample_ns = (1000000000 * (sample_cnt + 1)) / clk_src; > + unsigned int sample_ns = div_u64(1000000000ULL * (sample_cnt + 1), > + clk_src); > > if (!i2c->dev_comp->timing_adjust) > return 0; > -- ~Randy _______________________________________________ Linux-mediatek mailing list Linux-mediatek@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-mediatek From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.3 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 013A9C433DF for ; Wed, 20 May 2020 16:15:15 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id BF5152075F for ; Wed, 20 May 2020 16:15:14 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="PafLjBVP" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BF5152075F Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date: Message-ID:From:References:To:Subject:Reply-To:Content-ID:Content-Description :Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=MlWOfTDS+NUSSeXZUOJ5vfkiq4k4hw0ri0k5oUmGMDo=; b=PafLjBVP2fi4cZ vHq34KWhlfkpAJ5rEuLqLYh3fr0WN7OShgkJz/iSdEzreejcaIAUFinpJ1Yrk7+53hXVzc6QQhcT8 4Aiu66sOyjxbiDbezJKhzbiqcej7M3e4rs0GNFYLU4kYXTp9EhL9L1egWpsfBps+mXmmY+ByCCV2o 79IPbcYW7xumQA8NLz5+O/6Cxw+91KZR2XVdkDkJIbPBSpVWojX0JVtqBMRODczIBI/La0mLS33Wi a0lGLdZxWhYX1r9GZI32UDSXKLw9TX54Lw6cuiCtU3tUw5f1a2/3Lf1c2aoo7LDrZSMkoWfnLLMel NYj4+4LGHgQhSFgKEg/w==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jbRNB-0000Ze-4s; Wed, 20 May 2020 16:15:13 +0000 Received: from c-73-157-219-8.hsd1.or.comcast.net ([73.157.219.8] helo=[10.0.0.252]) by bombadil.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1jbRN6-00083y-Lu; Wed, 20 May 2020 16:15:09 +0000 Subject: Re: [next] i2c: mediatek: Use div_u64 for 64-bit division to fix 32-bit kernels To: qii.wang@mediatek.com, wsa@the-dreams.de References: <1589970713-19944-1-git-send-email-qii.wang@mediatek.com> From: Randy Dunlap Message-ID: Date: Wed, 20 May 2020 09:15:03 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 MIME-Version: 1.0 In-Reply-To: <1589970713-19944-1-git-send-email-qii.wang@mediatek.com> Content-Language: en-US X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, srv_heupstream@mediatek.com, leilk.liu@mediatek.com, linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-i2c@vger.kernel.org, linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 5/20/20 3:31 AM, qii.wang@mediatek.com wrote: > From: Qii Wang > > Use div_u64 for 64-bit division, and change sample_ns type to > unsigned int. Otherwise, the module will reference __udivdi3 > under 32-bit kernels, which is not allowed in kernel space. > > Signed-off-by: Qii Wang Acked-by: Randy Dunlap # build-tested thanks. > --- > drivers/i2c/busses/i2c-mt65xx.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/i2c/busses/i2c-mt65xx.c b/drivers/i2c/busses/i2c-mt65xx.c > index 7020618..deef69e 100644 > --- a/drivers/i2c/busses/i2c-mt65xx.c > +++ b/drivers/i2c/busses/i2c-mt65xx.c > @@ -551,7 +551,8 @@ static int mtk_i2c_check_ac_timing(struct mtk_i2c *i2c, > const struct i2c_spec_values *spec; > unsigned int su_sta_cnt, low_cnt, high_cnt, max_step_cnt; > unsigned int sda_max, sda_min, clk_ns, max_sta_cnt = 0x3f; > - long long sample_ns = (1000000000 * (sample_cnt + 1)) / clk_src; > + unsigned int sample_ns = div_u64(1000000000ULL * (sample_cnt + 1), > + clk_src); > > if (!i2c->dev_comp->timing_adjust) > return 0; > -- ~Randy _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel