qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH-for-9.0 v2 1/8] hw/clock: Have clock_set_mul_div() return early w


From: Philippe Mathieu-Daudé
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

Return early when clock_set_mul_div() is called with
same mul/div values the clock has.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 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;
-- 
2.41.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]