From patchwork Tue Oct 24 16:18:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Reichel X-Patchwork-Id: 13435099 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 16FC0C25B6E for ; Tue, 24 Oct 2023 16:19:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343587AbjJXQTm (ORCPT ); Tue, 24 Oct 2023 12:19:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39482 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234658AbjJXQTj (ORCPT ); Tue, 24 Oct 2023 12:19:39 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D5E7B83; Tue, 24 Oct 2023 09:19:36 -0700 (PDT) Received: from jupiter.universe (cola.collaboradmins.com [195.201.22.229]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: sre) by madras.collabora.co.uk (Postfix) with ESMTPSA id 3B62B6607328; Tue, 24 Oct 2023 17:19:35 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1698164375; bh=x58O7/yeMCAwTvVvYfypW/Y5RY/B1MgCHBqd2HZdSiM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=baHTv0Q9SNhDPpjT/nA2urEKIhWdb+u2YwV8EXqJfF8sbpAiX9q/0UlN7Wxo5LB36 d0WqNO17GD/3nVB9KNG+S1Nb3rfRJKUvrdOyEBd9MHOPCTsDuoCOv45Z2dNHcq1dCN sBmYuLFuAMgT/iVJlXpbIAST4i2ejJEuC2pbMXAEiYgMK9tkFQMa5Uky/LcDKEq8Xb Ln9e8eAOWvUyT4CA9/XpNxm0SPgXR5rlOrAu5TeIZGY3D8s6LEKJeG6LjxBxJRw6rp /WcSXWRJdTkmv6gx8tlVU9X49FCvAwhI+uvWy3t+//Op6qU8pc/6cevg8QtsKzdBX2 P2Jpfo3Md/0Dg== Received: by jupiter.universe (Postfix, from userid 1000) id 9FA15482ADD; Tue, 24 Oct 2023 18:19:32 +0200 (CEST) From: Sebastian Reichel To: Andy Shevchenko , Michael Turquette , Stephen Boyd , David Laight , linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Vasily Gorbik , Niklas Schnelle , Linus Torvalds , Sebastian Reichel , kernel@collabora.com, Andy Shevchenko Subject: [PATCH v4 3/3] clk: composite: replace open-coded abs_diff() Date: Tue, 24 Oct 2023 18:18:17 +0200 Message-ID: <20231024161931.78567-4-sebastian.reichel@collabora.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231024161931.78567-1-sebastian.reichel@collabora.com> References: <20231024161931.78567-1-sebastian.reichel@collabora.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org Replace the open coded abs_diff() with the existing helper function. Suggested-by: Andy Shevchenko Signed-off-by: Sebastian Reichel Reviewed-by: Andy Shevchenko --- drivers/clk/clk-composite.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/clk/clk-composite.c b/drivers/clk/clk-composite.c index 66759fe28fad..478a4e594336 100644 --- a/drivers/clk/clk-composite.c +++ b/drivers/clk/clk-composite.c @@ -6,6 +6,7 @@ #include #include #include +#include #include static u8 clk_composite_get_parent(struct clk_hw *hw) @@ -119,10 +120,7 @@ static int clk_composite_determine_rate(struct clk_hw *hw, if (ret) continue; - if (req->rate >= tmp_req.rate) - rate_diff = req->rate - tmp_req.rate; - else - rate_diff = tmp_req.rate - req->rate; + rate_diff = abs_diff(req->rate, tmp_req.rate); if (!rate_diff || !req->best_parent_hw || best_rate_diff > rate_diff) {