Received: by 2002:ab2:69cc:0:b0:1f4:be93:e15a with SMTP id n12csp1439577lqp; Mon, 15 Apr 2024 06:45:50 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUU//10md5IWhO2wPk5Z1L5ByrefhfN2/2AdZDCvcc0FQjiO2jm/Qa/jdgyz1FmGpVfxD3jD3yeWM9vqqK0ZaDAs2qFYq0ArmiqrzTfig== X-Google-Smtp-Source: AGHT+IF+Qr3LvdhnOCI/kyAdxiGvL/ZWYEIyQU+q27zuTDt9/PHjFgMCg/w4CJEVu8oyZsZUiIj8 X-Received: by 2002:a05:622a:1a8c:b0:434:fea0:656b with SMTP id s12-20020a05622a1a8c00b00434fea0656bmr11668847qtc.12.1713188750664; Mon, 15 Apr 2024 06:45:50 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713188750; cv=pass; d=google.com; s=arc-20160816; b=SbW8fht1INvrVpwDmculrvVLfZaEsQnSrdkJ2fW8NZe1BKGbhAeXbacrCIKZwlrXvH 7sHKgqa8o2CA3O819pmEsyacOusixoDCsRpX5cktNiVOwKyl2uS1oduVFaFf5KBtmHvn k0i9ZPCBrHfISH9xtb71pP+nScU6pHHA+Y9EK3CWyKb9tnULV6SR9rLzk3bsel34LFBx svJ68mQyATIKgQos5VL0zjSjs/WtlMRiDjQkJ7NIkk9ovTWfInAMXNggAUehS811ZanM WBD6uQcjp/hjLK9m9IVk1vMhoarc/+QVtoSPmyShcZ2M0yv3z1Ax6wZQMzqoxuH3mU5W 9eqA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=hmUprEvsFWrKsG1WrBro38Apmid6vO9GN9jPPRSfMts=; fh=xb3zaQO3pzkIf1GhJLUk4YTXFkfj7a1BmjUiznld4Y8=; b=CgzSht+9KPDPy3HRBb/4/a8i+cKvo3YHK3ET4H86UA1wS/CHHE6vokJx7dLH908dsz ZShGlNb8VMppNpmjsCMv3vIepdfe2KsDLnR6JjuK92PbhHDPdlUXnOoAGVmXP8NceJj6 j9RuF5tUhMZJRs0aMBvAlTD535mWuOSO5yOiXNhBgQbKyJagu8O2xzdCejGTCD+1l/ei 8bMVX9CHSOTEo6EfmRBRKlRpFaU3cRXOG/pojUWes4MICpr6w4YTI2gb4xh2VHUkKv4W QJP7uBSUSy0UcIaS4F6k17pnCG0HqiWW9B/JAqHDb/IrwCvLbkyKX0WJVn0hcAn/M2IO DkAw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=WaWGXug7; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-145287-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-145287-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id ef15-20020a05622a53cf00b00430f91682f3si9106129qtb.166.2024.04.15.06.45.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Apr 2024 06:45:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-145287-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=WaWGXug7; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-145287-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-145287-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 636D71C22A9B for ; Mon, 15 Apr 2024 13:45:50 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B999671B32; Mon, 15 Apr 2024 13:45:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="WaWGXug7" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D94A81E4B0; Mon, 15 Apr 2024 13:45:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713188737; cv=none; b=Tnn0G/0csk3xo5be4PsBkXxbj3pYGYuhD8M+0zWMOSmYLWv5H5PswuaGXVXHef4cXHZ62v8lhv43Z5xF18akWQeoX7VYZBiNoFgJ6jfJk4c8IbHrNejoSu3ZRx7rbkU8HlNBJQVok9SzMsae9vgpF03RAQQ+rpqhtZAuDqSsqVU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713188737; c=relaxed/simple; bh=WYM10ESJW8h7DBMF+Db5WIGDUBmBDs04mXycZHqmaEA=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=iMA3/aIagZxiloTSx91vWNkO5VDZ7NcEQssBBZDC1u/wYf6WJtF7Ok8OvbapGBfyv67e/t+sA75P6snaLPWtshaygGaVXxT/9fJxCsPxJv42pyDfLmX1UiozqFCDlGt7ZD2yFMFOCuyr6WrMTqeR9mjL9ZdDT4Qjw9Z3k5uvhLs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=WaWGXug7; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id B1AA2C113CC; Mon, 15 Apr 2024 13:45:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1713188737; bh=WYM10ESJW8h7DBMF+Db5WIGDUBmBDs04mXycZHqmaEA=; h=From:To:Cc:Subject:Date:From; b=WaWGXug7lg1qOdoEdpwCH8xdeoWLj0G7xLfF7yJgwLjJ2/AOfTJXFcy7li2lMCZyq sEV1wjEXO3qwZ5p/1VfVP7Mlqwa+O5g6cLQT6sjd2Ocrp1GJjNfO+ZgaXJ+uuqY0N8 CsI5N2ZhF20r05koJJSBuySXoIYtWcXGV8+sj8sDuZpUyRVGKNYu9FVGjv2aGYnf3a 1o7+oZP5qX6by9fq70kOy+b8V2gVIjs0+MNrrUcmDugklatp3LTibq2GqrpyjBwIB7 i/kcJgO5/1lV7Q5w0pgAcctQkM/v5LR8kO/Gb/rd+zcxkpKAg2eL+xp4zGL7BO6aya tiOBY2mNqmLWA== From: Arnd Bergmann To: Michael Turquette , Stephen Boyd , Chen Wang , Inochi Amaoto Cc: Arnd Bergmann , linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] clk: sophgo: avoid open-coded 64-bit division Date: Mon, 15 Apr 2024 15:45:20 +0200 Message-Id: <20240415134532.3467817-1-arnd@kernel.org> X-Mailer: git-send-email 2.39.2 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Arnd Bergmann On 32-bit architectures, the 64-bit division leads to a link failure: arm-linux-gnueabi-ld: drivers/clk/sophgo/clk-cv18xx-pll.o: in function `fpll_calc_rate': clk-cv18xx-pll.c:(.text.fpll_calc_rate+0x26): undefined reference to `__aeabi_uldivmod' This one is not called in a fast path, and there is already another div_u64() variant used in the same function, so convert it to div64_u64_rem(). Fixes: 80fd61ec4612 ("clk: sophgo: Add clock support for CV1800 SoC") Signed-off-by: Arnd Bergmann --- drivers/clk/sophgo/clk-cv18xx-pll.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/clk/sophgo/clk-cv18xx-pll.c b/drivers/clk/sophgo/clk-cv18xx-pll.c index c546dad1791c..29e24098bf5f 100644 --- a/drivers/clk/sophgo/clk-cv18xx-pll.c +++ b/drivers/clk/sophgo/clk-cv18xx-pll.c @@ -205,8 +205,7 @@ static unsigned long fpll_calc_rate(unsigned long parent_rate, unsigned long rate; dividend <<= PLL_SYN_FACTOR_DOT_POS - 1; - rate = dividend / factor; - dividend %= factor; + rate = div64_u64_rem(dividend, factor, ÷nd); if (is_full_parent) { dividend <<= 1; -- 2.39.2