From patchwork Wed Oct 19 05:38:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kang Minchul X-Patchwork-Id: 4440 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp152585wrs; Tue, 18 Oct 2022 23:04:46 -0700 (PDT) X-Google-Smtp-Source: AMsMyM77/TtKsYaCK1IpyivVXtN9W6I/wMCSgMbqp8c21AHdrjIq6SvjUv7sCjLRZijMZV7SxUzv X-Received: by 2002:a17:902:f54f:b0:185:4ff6:fef4 with SMTP id h15-20020a170902f54f00b001854ff6fef4mr6954151plf.116.1666159485804; Tue, 18 Oct 2022 23:04:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666159485; cv=none; d=google.com; s=arc-20160816; b=SwzGAJHbtTsnOW/xQHzzlvt2pLKQLJpBfYSbW3S5XLpi1zx3/EYbt868iECe1F2sZt qDcc797JHqpN6hdh9wKJo5cA94G8WfsiDvBNtFk2gmPAiGkpnu7GFaQhVmeUCi3iih0F BGR2PojOy3jiwSUU4A5zo5YuawLEr3dEfqSSlY/iAifpuPlNIUYm7MbJvRiKTd6VGwhD 7/adYp7ZD2AYTU5eGsQlQe3lrc0d6MwMisGo0BLENKyYFAHGuw9gxQDQAuydIpl7wIb9 128JomutDNH9rVmqt8TkzkhrVzPtFdzYIcIYzP5NjkzkSCyQSCh6tdzZMTPXNNFJS50C Llow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=uagMMX7nbZs02+TkfE1zX/mQYp7hdyYKV8jbBteal5M=; b=A4GD0qrhHQDqIEz6BLHp4M65fm+UKOpOhoSr/h/rDLfqvmMK5A/9pl0bY7UCkvps3Z chlhgU9d40491OfQAzlWPFaErdRBtWhax7H0ecvMb+DUqO+MKCUDgsXZ4kMTV0a2M4PS VYNNA9T5/iSXoBpHNKG08RkX8kRKRX1T4yOzwRhrPLJNYZk+o5ZVZjpbg5ouFR0xqcKl TIN++K5ZOPwaopafLZuOSKZmlKztEVRLQ7sKyKLbgXCk0nr4JJbySbC1gqSP+KgpqWyx lVh29Zf8yeJETujqPIc5gWxYl6WUj3gtQKrZVF6F50RciHCCC1W6wOJCYtaPTBvt1yGE +MGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=FBBot3uH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t16-20020a170902e85000b00174de06d92csi19475093plg.74.2022.10.18.23.04.33; Tue, 18 Oct 2022 23:04:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=FBBot3uH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229882AbiJSFik (ORCPT + 99 others); Wed, 19 Oct 2022 01:38:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57294 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229834AbiJSFii (ORCPT ); Wed, 19 Oct 2022 01:38:38 -0400 Received: from mail-pf1-x42b.google.com (mail-pf1-x42b.google.com [IPv6:2607:f8b0:4864:20::42b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1874A537F1; Tue, 18 Oct 2022 22:38:36 -0700 (PDT) Received: by mail-pf1-x42b.google.com with SMTP id 204so16204878pfx.10; Tue, 18 Oct 2022 22:38:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=uagMMX7nbZs02+TkfE1zX/mQYp7hdyYKV8jbBteal5M=; b=FBBot3uHkHUr81e//MIjYaPs9o/zoRMyNY41LtbuQO++opJg/bW+OgGKJncVEAoBXf RAB0TJGBZaIVtLa60y9T3Sv8pX3rYtIhrDt/q7UxgZ5l4FH9CvfFoI2NdLIzc8oZ22wI YEuiYYh3VF/2hLC8Kzi5S+uJRGpe738FIX/hxXvm+jCNs07r14SZS/DDV5HNLCyIeAzd 42uG716oTFJpwdXNoYDRAPjKTIPTZ22ONoSA4DNeYZWskqZoCMXVypoXAonLntaPOJXP R9JB12yKqpO8tzzb3Pg4Z1LKBcRcIAaOV65tKTDqq2ihpA9T3MRJEREcSm2yZ/Qec/IY ARVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=uagMMX7nbZs02+TkfE1zX/mQYp7hdyYKV8jbBteal5M=; b=ay1ubjl6KkK5gNX2ptMW1Tw5S2mLrWWhWQGL9sVLeoqg+AyDNnr80NWU6QhG7kl8et dLZDxVh3WHWXMUDAkT3xx0PlWP2K/75pHYXVJZXxcYF+rFfbSCjLnA5mazCFo1rJAzZq lFJG9qbKpTjK1s+VKZJZYnLu9d2ZNWiHpBZ23oG078KIU6ElqReJLaIaQhYo9qETycFx hwWf235bsOnTCbDxYV6NH1i+l/qQY+YGOHACzr7ecF3wrzph0A4Srm2ITrQDMWPejPPW w++s83yfd6ttgY3sQNGQo4SfdjIALZv6ew43N44tI3w3SLay9QSCK2H1d680hoTnE6Vm g2Sw== X-Gm-Message-State: ACrzQf0BlNFzdi2eVvvWohwhubjZrVkbciGhycHCPfJga+PDCpqppWCj mSph1c/S2ksZCnkNmbY53tw= X-Received: by 2002:a05:6a00:847:b0:563:b593:b685 with SMTP id q7-20020a056a00084700b00563b593b685mr6832243pfk.75.1666157915367; Tue, 18 Oct 2022 22:38:35 -0700 (PDT) Received: from uftrace.. ([14.5.161.231]) by smtp.gmail.com with ESMTPSA id n15-20020a170902e54f00b0017b5e1f486asm9860818plf.211.2022.10.18.22.38.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Oct 2022 22:38:34 -0700 (PDT) From: Kang Minchul To: Lars-Peter Clausen , Michael Hennerich , Jonathan Cameron Cc: Greg Kroah-Hartman , linux-iio@vger.kernel.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, Kang Minchul Subject: [PATCH] staging: iio: Use div64_ul instead of do_div Date: Wed, 19 Oct 2022 14:38:29 +0900 Message-Id: <20221019053829.821918-1-tegongkang@gmail.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747094848761931894?= X-GMAIL-MSGID: =?utf-8?q?1747094848761931894?= Using div64_ul instead of do_div (64-by-32 division) is more recommended by coccicheck because this can avoid potential truncation. So this commit changes do_div to div64_ul and remove coccicheck warnings. Signed-off-by: Kang Minchul --- drivers/staging/iio/frequency/ad9832.c | 2 +- drivers/staging/iio/frequency/ad9834.c | 2 +- drivers/staging/iio/impedance-analyzer/ad5933.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/iio/frequency/ad9832.c b/drivers/staging/iio/frequency/ad9832.c index 6f9eebd6c7ee..cd038480f63c 100644 --- a/drivers/staging/iio/frequency/ad9832.c +++ b/drivers/staging/iio/frequency/ad9832.c @@ -122,7 +122,7 @@ static unsigned long ad9832_calc_freqreg(unsigned long mclk, unsigned long fout) { unsigned long long freqreg = (u64)fout * (u64)((u64)1L << AD9832_FREQ_BITS); - do_div(freqreg, mclk); + freqreg = div64_ul(freqreg, mclk); return freqreg; } diff --git a/drivers/staging/iio/frequency/ad9834.c b/drivers/staging/iio/frequency/ad9834.c index 2b4267a87e65..cfe933ef40d0 100644 --- a/drivers/staging/iio/frequency/ad9834.c +++ b/drivers/staging/iio/frequency/ad9834.c @@ -102,7 +102,7 @@ static unsigned int ad9834_calc_freqreg(unsigned long mclk, unsigned long fout) { unsigned long long freqreg = (u64)fout * (u64)BIT(AD9834_FREQ_BITS); - do_div(freqreg, mclk); + freqreg = div64_ul(freqreg, mclk); return freqreg; } diff --git a/drivers/staging/iio/impedance-analyzer/ad5933.c b/drivers/staging/iio/impedance-analyzer/ad5933.c index f177b20f0f2d..730bb31a20d8 100644 --- a/drivers/staging/iio/impedance-analyzer/ad5933.c +++ b/drivers/staging/iio/impedance-analyzer/ad5933.c @@ -196,7 +196,7 @@ static int ad5933_set_freq(struct ad5933_state *st, } dat; freqreg = (u64)freq * (u64)(1 << 27); - do_div(freqreg, st->mclk_hz / 4); + freqreg = div64_ul(freqreg, st->mclk_hz / 4); switch (reg) { case AD5933_REG_FREQ_START: