From patchwork Mon Mar 25 13:32:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 782332 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e01:0:b0:33e:7753:30bd with SMTP id p1csp1175874wrt; Mon, 25 Mar 2024 06:33:46 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUbYtNuTuNB7uAusqZ26QYm2UTk2C1ysut1uO9VEwb9C9UQvhu9A41fR2d1bOizLghoyz0UOPsqMgCg6jSc39JZ X-Google-Smtp-Source: AGHT+IFVlX4nFNF/YnZGZhJhJaz1lKfJZZHBZK4vU1Zv1Kl9apfoKPQtPxbTHnxBr1d7bPQouKyI X-Received: by 2002:a37:f50e:0:b0:788:3101:b1f0 with SMTP id l14-20020a37f50e000000b007883101b1f0mr7541667qkk.64.1711373626059; Mon, 25 Mar 2024 06:33:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1711373626; cv=none; d=google.com; s=arc-20160816; b=Wr42PW0io24RHYE80OfK1Uf+ILNPZg1MQffNfBlY9zxc6+LTvn1IctpvIW1NgRowF8 m0IueGGsb+y4zSMWxE/WCsUjwgOKqa9jWdqdrjT9//9a+T/+8gKiLZQgafbOZx05wwjg 7Ru6NpZ6L05Akg2A2AvkGv30K9vjZTPD01GGRySv74hFoXnr/TakqW61bZw2RxGyhENO ZuV0HWI+RBQmlhn1GF5HLDxLaaRFRQwBkwJKsCESwVW7KbLAh4Uo/zEqdjdVLd+HlLlt 0J7zf7Hn6MrCJJlNvHEIew4MSz5FOBrjWlA82zqYBaGffHAhkt9jw0PL/ou/hWNDwnRv WgPA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=SzMbY9DE4/3HwqgfxhwLJUdxgeZIWP3uN9BqoNrhiWM=; fh=Z6ebApcLFJbaZHsWuXWH2AHWI2xWYXqDDJv2NwjBOYY=; b=L+CD2EvvNsxJ5NRMy2oDlQyqFki8sh8AcpJXoREqKame1R5436rDupOHNGojLB150A MioBiId5ObFGpqGjMFgaqGt6jZwSrcX/xqFudFaiMGABhLgSXaGnhKlfsC30rcJbEkeT fhUspKjKjsZpfdf0FSWUHz05l98dY/igxpfIiYhyFtn/HlSsj1b7OCPN4bSI4BUO3isL 1RhI6QHLisKaneUMFUeM9AVDmfCmNmpi1jOEn/pjXrlpPgWotY25CIIS2myXg4T08EvW FALuV5jJJyR+0ReZLTZ84yEe8UoSWQ8Td68LAJXHvuUCYxvSR3AAn4OMEeK21vww7w4s OtSA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Anc33Gab; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id t11-20020a05620a034b00b00788216c3e8esi5397645qkm.44.2024.03.25.06.33.45 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 25 Mar 2024 06:33:46 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Anc33Gab; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rokSD-0002by-Nr; Mon, 25 Mar 2024 09:33:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rokRr-0002Uv-So for qemu-devel@nongnu.org; Mon, 25 Mar 2024 09:33:13 -0400 Received: from mail-wr1-x42d.google.com ([2a00:1450:4864:20::42d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rokRq-0007KB-7y for qemu-devel@nongnu.org; Mon, 25 Mar 2024 09:33:11 -0400 Received: by mail-wr1-x42d.google.com with SMTP id ffacd0b85a97d-33ed5b6bf59so3181568f8f.0 for ; Mon, 25 Mar 2024 06:33:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711373588; x=1711978388; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=SzMbY9DE4/3HwqgfxhwLJUdxgeZIWP3uN9BqoNrhiWM=; b=Anc33GabkocihGnodBXTH1AjtqxD4Kbpvg2JZKbPNzCTWsBJzJvQlvr1a4raEfZDBj vpWYidbEpliZHOQA3XmLZhrQt/Y07nUTJP4EWjIGZa8R6seHOQs8WK9x90rWW4+Rvs5r W2AoJFs+F6ceAV6w/8+nWghKAZBMh2qHPG6hGvfWVDejxccajTtShnWkl91PNS3FnE6J 2cjq/RlXPW6Y+z2yKo2ESdaQCU3OxOTA2PmYNJePNGYSWdudoHMGYOLPcTAkHn0Rp4D6 vH7QvqoJbrbTQQgTIYPMjLr10yFYRMSLRZHMGgRUJkSAx8VXDJjdtzxZmqw7SDjW4MeK 2Fcw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711373588; x=1711978388; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=SzMbY9DE4/3HwqgfxhwLJUdxgeZIWP3uN9BqoNrhiWM=; b=ilteFsCiBYahAZJTK/C1H8VvhmQHVPL5YhbDoE+gBFx4NGp/aP+vZupnVZiyIY02fg 02B+soY/Y1RB84fy2hzVGlXTcJvznNsvC5Hn3Ziz5qWRKMs5w0AR/PHeCW1TLTMjUkC7 lCeXlgUZyxgz5ZX1ScojlVQyema9/ioW0fCXk9ukGq/cKtbOOLbG1OWsxU3uW4f8SgND ccUbNbIYMx+pwzy5XwKS6J/u1CqAgBtV2OtqVcFijcMZASsflSayD8icdi4o9LFze2OP gXNbxUfkn1RWisCrqpXbQrTsUuxbOtythoqo97APtqHW/83dCzO6s7ra3/jO21EgFbaO 7AYw== X-Gm-Message-State: AOJu0YzHbzgy56VAVJJkjqqmJ3ZnCC01NbYjb+HnRkPQb/eUSQGixNNd TbLLHKiHsUwZTOLqH2ZlbMby724aFvnnnBYD4VsK0mm4tqL25EplXflCxJEakGbWfeQG2Wr68KQ Q/hM= X-Received: by 2002:a5d:6507:0:b0:33d:6fd8:90d3 with SMTP id x7-20020a5d6507000000b0033d6fd890d3mr5158151wru.4.1711373587797; Mon, 25 Mar 2024 06:33:07 -0700 (PDT) Received: from m1x-phil.lan ([176.187.208.214]) by smtp.gmail.com with ESMTPSA id ez19-20020a056000251300b00341c88ab493sm4601353wrb.10.2024.03.25.06.33.06 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 25 Mar 2024 06:33:07 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?In=C3=A8s_Varhol?= , Arnaud Minier , Damien Hedde , qemu-arm@nongnu.org, Peter Maydell , Alistair Francis , Luc Michel , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH-for-9.0 v2 1/8] hw/clock: Have clock_set_mul_div() return early when nothing to change Date: Mon, 25 Mar 2024 14:32:51 +0100 Message-ID: <20240325133259.57235-2-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240325133259.57235-1-philmd@linaro.org> References: <20240325133259.57235-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42d; envelope-from=philmd@linaro.org; helo=mail-wr1-x42d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Return early when clock_set_mul_div() is called with same mul/div values the clock has. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Alistair Francis --- hw/core/clock.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hw/core/clock.c b/hw/core/clock.c index d82e44cd1a..c73f0c2f98 100644 --- a/hw/core/clock.c +++ b/hw/core/clock.c @@ -147,6 +147,10 @@ void clock_set_mul_div(Clock *clk, uint32_t multiplier, uint32_t divider) { assert(divider != 0); + if (clk->multiplier == multiplier && clk->divider == divider) { + return; + } + trace_clock_set_mul_div(CLOCK_PATH(clk), clk->multiplier, multiplier, clk->divider, divider); clk->multiplier = multiplier;