From mboxrd@z Thu Jan 1 00:00:00 1970 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 77BE22E8E0D; Fri, 27 Jun 2025 14:59:15 +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=1751036355; cv=none; b=WU7M2TOEiq/BtOZdlzbBD4m3P1kBOQQbnqY7xTK0gkTherJGWD7lbiv2qvOH7hguIbImI6Tbja1eBv0E3P11ffLZM2hB7zo+H+n5xmy1EGWuaKtGX83APxwHybQaqG8eGEDv+n+D/GhpywkodgsuCtkToLIGQC5hUc4+0yQPfG0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751036355; c=relaxed/simple; bh=iNvB270qem/r9rmaw3HGvdR0SSzJxJVoWK0iTe66R78=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=anrCQgqWN4Tty0k6zIwZ9ASBQ4pnmb+PujQp01ZzbXpbUlo3PxEZnveZH6ApCwe1rO6Gkh0J6WK0Gt2T0abeWoBl+v8DNW3oCCdg6EF2n7W/2gVmS/TPCszWU8jHMZ46VAlUlPVSsRBl8rXKGdaUYnYIe8j9NcOqpA9YHL6IKtM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=bPboe0La; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="bPboe0La" Received: by smtp.kernel.org (Postfix) with ESMTPS id 0DB85C113D0; Fri, 27 Jun 2025 14:59:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1751036355; bh=iNvB270qem/r9rmaw3HGvdR0SSzJxJVoWK0iTe66R78=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=bPboe0LaDlYQnM5Ph8JsJQiX+ciOkKI+KM/+chhxu83dIH7Ohy3jmUXW0YSBbDfwj e92WEquYGJyfk7GTqboYgDCzR4N5mjX/9fTKQup7TMIU9GDsDzk6QwqztxLpFJ6cY6 EjIVDXRN9FowdcWYHzAaZI4Ge1fS1wD3ppJIYeoDqQE7sa0aChff8lJPjGSbVhozao vm7dTkR3yWlUH/UBAkzF+qxUBF4OBsTwSz7ZsDbEyhakciKcTMWQINh9KcE24t7D8t i1x0a6MGUMAR+yxEGn9Wmaa0mQ18I3NmG+HilD8QjSG3fhXLX/7mb0ahBTz6/g1Hdl YRAkTG3AgRR7Q== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 02FB5C77B7F; Fri, 27 Jun 2025 14:59:15 +0000 (UTC) From: =?utf-8?q?Nuno_S=C3=A1_via_B4_Relay?= Date: Fri, 27 Jun 2025 15:59:15 +0100 Subject: [PATCH RESEND v7 6/7] clk: clk-axi-clkgen move to min/max() Precedence: bulk X-Mailing-List: linux-fpga@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Message-Id: <20250627-dev-axi-clkgen-limits-v7-6-e4f3b1f76189@analog.com> References: <20250627-dev-axi-clkgen-limits-v7-0-e4f3b1f76189@analog.com> In-Reply-To: <20250627-dev-axi-clkgen-limits-v7-0-e4f3b1f76189@analog.com> To: linux-clk@vger.kernel.org, linux-fpga@vger.kernel.org, dmaengine@vger.kernel.org, linux-hwmon@vger.kernel.org, linux-iio@vger.kernel.org, linux-pwm@vger.kernel.org, linux-spi@vger.kernel.org Cc: Stephen Boyd , Michael Turquette , Moritz Fischer , Wu Hao , Xu Yilun , Tom Rix , Vinod Koul , Jean Delvare , Guenter Roeck , Michael Hennerich , Jonathan Cameron , Trevor Gamblin , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , David Lechner , Mark Brown , Mike Turquette X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1751036364; l=1547; i=nuno.sa@analog.com; s=20231116; h=from:subject:message-id; bh=piuSskdq8cMRdCP+4hCdaWdOTgdc2I6WLf29pd00o00=; b=6tDWeF54sQQdMG1mBQ9Uz/wS1c9cTnda4iIZwz78V/kJjQVgUQKJwduiGcdCtResEXuGClMsX YCisR4aj/hBCwlCb8DV0xFuIvbQNMNAT/WAvboZzPiEM0MZGQP6oowc X-Developer-Key: i=nuno.sa@analog.com; a=ed25519; pk=3NQwYA013OUYZsmDFBf8rmyyr5iQlxV/9H4/Df83o1E= X-Endpoint-Received: by B4 Relay for nuno.sa@analog.com/20231116 with auth_id=100 X-Original-From: =?utf-8?q?Nuno_S=C3=A1?= Reply-To: nuno.sa@analog.com From: Nuno Sá Instead of using the type versions of min/max(), use the plain ones as now they are perfectly capable of handling different types like unsigned and non negative integers that are compiletime constant. Reviewed-by: David Lechner Signed-off-by: Nuno Sá --- drivers/clk/clk-axi-clkgen.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/clk/clk-axi-clkgen.c b/drivers/clk/clk-axi-clkgen.c index f4e96394e9c25c817b09ee0c08751147083f19b7..63951209c460f26ed3940879da536e31ae530188 100644 --- a/drivers/clk/clk-axi-clkgen.c +++ b/drivers/clk/clk-axi-clkgen.c @@ -147,15 +147,15 @@ static void axi_clkgen_calc_params(const struct axi_clkgen_limits *limits, *best_m = 0; *best_dout = 0; - d_min = max_t(unsigned long, DIV_ROUND_UP(fin, limits->fpfd_max), 1); - d_max = min_t(unsigned long, fin / limits->fpfd_min, 80); + d_min = max(DIV_ROUND_UP(fin, limits->fpfd_max), 1); + d_max = min(fin / limits->fpfd_min, 80); again: fvco_min_fract = limits->fvco_min << fract_shift; fvco_max_fract = limits->fvco_max << fract_shift; - m_min = max_t(unsigned long, DIV_ROUND_UP(fvco_min_fract, fin) * d_min, 1); - m_max = min_t(unsigned long, fvco_max_fract * d_max / fin, 64 << fract_shift); + m_min = max(DIV_ROUND_UP(fvco_min_fract, fin) * d_min, 1); + m_max = min(fvco_max_fract * d_max / fin, 64 << fract_shift); for (m = m_min; m <= m_max; m++) { _d_min = max(d_min, DIV_ROUND_UP(fin * m, fvco_max_fract)); -- 2.49.0