From patchwork Tue Aug 15 19:06:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nathan Chancellor X-Patchwork-Id: 13354174 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 5E8B3C0015E for ; Tue, 15 Aug 2023 19:07:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:Message-Id:MIME-Version:Subject: Date:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=FJT6ZG06ti5HEhRIWMBEyvH5DTi9Li/W+gajVhHl2Kk=; b=dQJtIj6XoM/Sun DCbRy+K/9M5F7I3aiArI/DN2Gjp/CY6Y23zw385W1TPeY8laXQ5WAuUdgVBWPowdXTI3AEw6pDAqC IfJgfNLU3fiS19YyJcpZiYGVU05vj2ccMcg/0qEt20qCFknoGOjcrwh7XBJkQL8JSJJK/9k08nZwL bTJhVcz3+LQ5vlgwYBrMhlPW21fE0ex3ACu+ynqxDdeB35f1yZblJ71pRUT6f8rnjVIVsBwzk/hE4 1WOTrsKy2B65m4sfl+wH/3ppHd7e5gFiYf4c6/ATcEgSxZGLgBwrIhx/Qew4Wdvz32yubA7NawU6T CLt4es6dQoqczdzwVExg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qVzNs-002Gjp-2Z; Tue, 15 Aug 2023 19:07:16 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qVzNm-002Gin-1i for linux-arm-kernel@lists.infradead.org; Tue, 15 Aug 2023 19:07:12 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5978861E43; Tue, 15 Aug 2023 19:07:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1F710C433C7; Tue, 15 Aug 2023 19:07:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1692126427; bh=MJRTsKjJrCqgZBHh3ucJktBplP659QkvtPqpYoiAoQY=; h=From:Date:Subject:To:Cc:From; b=e5wIKX0EVRDwQ8ztXhcobA5K0H7FetEp9rCkWJCAkGOuVzNaswxxaDMkJDz/5BLUY p3U2fSmikJ/+yYR6zf1Q6hSqg9Na159AiTm9D8+F4NfGfrNd/fjsWuAfUamHcAgdtD 040pJTC/tEnDHObPF0x37dC+WZgYZmbgstlFKPwIN/q7/aHumtMsf+/j8tSZ85dkCS +NDmXcKdcGPYoy51TznvaaItdBvpwDhBP8NWjDoRDZCugP3GKy1OUGc8dU4bGVv0DP gaI5fSECd5w3krOG+Uy6QDTpYLf8MbfR8f5RuopIr4q7asAcbHuBxAoViW2z1WJryr seDIlPdcvkBmg== From: Nathan Chancellor Date: Tue, 15 Aug 2023 12:06:50 -0700 Subject: [PATCH] watchdog: xilinx_wwdt: Use div_u64() in xilinx_wwdt_start() MIME-Version: 1.0 Message-Id: <20230815-watchdog-xilinx-div_u64-v1-1-20b0b5a65c2e@kernel.org> X-B4-Tracking: v=1; b=H4sIAMnM22QC/x3MywqAIBBA0V+JWTdglr1+JSJCpxoIC+0hRP+et DyLex/w5Jg8tMkDji72vNmILE1AL6OdCdlEgxQyF3Wm8B4PvZhtxsAr24CGr+EsC6yVlpUulSi aHGK9O5o4/Oeuf98PnGt1FGkAAAA= To: srinivas.neeli@amd.com, wim@linux-watchdog.org Cc: shubhrajyoti.datta@amd.com, michal.simek@amd.com, linux@roeck-us.net, ndesaulniers@google.com, trix@redhat.com, linux-watchdog@vger.kernel.org, linux-arm-kernel@lists.infradead.org, patches@lists.linux.dev, llvm@lists.linux.dev, Nathan Chancellor X-Mailer: b4 0.13-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=1840; i=nathan@kernel.org; h=from:subject:message-id; bh=MJRTsKjJrCqgZBHh3ucJktBplP659QkvtPqpYoiAoQY=; b=owGbwMvMwCEmm602sfCA1DTG02pJDCm3z9za46s+3+aG7cQa/fs105dt+eAvter+059nAv7Xp og5zpNt7ShlYRDjYJAVU2Spfqx63NBwzlnGG6cmwcxhZQIZwsDFKQAT2bmUkaHTbNGCHMVL139w r5namNxs7dgxv8peou6PmCW32LuiSy0M/+uEYhQn/lDSj7JOLxBh8zn4u3xJ2Y5qx4bjS/lvGTh PZQQA X-Developer-Key: i=nathan@kernel.org; a=openpgp; fpr=2437CB76E544CB6AB3D9DFD399739260CB6CB716 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230815_120710_736719_C441CE2E X-CRM114-Status: GOOD ( 14.89 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org After commit f1a43aadb5a6 ("watchdog: Enable COMPILE_TEST for more drivers"), it is possible to enable this driver on 32-bit architectures. When building for those architectures with clang, there is an error due to a 64-bit division in xilinx_wwdt_start(): ERROR: modpost: "__aeabi_uldivmod" [drivers/watchdog/xilinx_wwdt.ko] undefined! Use div_u64() to fix this, which takes a 64-bit dividend and 32-bit divisor. GCC likely avoids the same error due to optimizations it employs to transform division by a constant into other equivalent operations, which may be different than what is implemented in clang. Link: https://github.com/ClangBuiltLinux/linux/issues/1915 Signed-off-by: Nathan Chancellor Reviewed-by: Guenter Roeck Acked-by: Rob Herring --- drivers/watchdog/xilinx_wwdt.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- base-commit: 8a504bd61ec7b3ddd72680e15775f2c7c0f9e894 change-id: 20230815-watchdog-xilinx-div_u64-85c27c650493 Best regards, diff --git a/drivers/watchdog/xilinx_wwdt.c b/drivers/watchdog/xilinx_wwdt.c index 1d998db41533..d271e2e8d6e2 100644 --- a/drivers/watchdog/xilinx_wwdt.c +++ b/drivers/watchdog/xilinx_wwdt.c @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include @@ -71,7 +72,7 @@ static int xilinx_wwdt_start(struct watchdog_device *wdd) /* Calculate timeout count */ time_out = xdev->freq * wdd->timeout; - closed_timeout = (time_out * xdev->close_percent) / 100; + closed_timeout = div_u64(time_out * xdev->close_percent, 100); open_timeout = time_out - closed_timeout; wdd->min_hw_heartbeat_ms = xdev->close_percent * 10 * wdd->timeout;