aboutsummaryrefslogtreecommitdiff
path: root/hw/core
diff options
context:
space:
mode:
authorPhilippe Mathieu-Daudé <f4bug@amsat.org>2020-08-28 10:02:44 +0100
committerPeter Maydell <peter.maydell@linaro.org>2020-08-28 10:02:44 +0100
commit15aa2876d9c7181c58305430f726461a2f24cb00 (patch)
treea8973f5844cc55b12ac08d46ea2017d616ad3f40 /hw/core
parentbb80ae077ebcc7e0cdc0f7e2ec663896b6103da1 (diff)
hw/clock: Let clock_set() return boolean value
Let clock_set() return a boolean value whether the clock has been updated or not. Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-id: 20200806123858.30058-3-f4bug@amsat.org Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw/core')
-rw-r--r--hw/core/clock.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/hw/core/clock.c b/hw/core/clock.c
index 3c0daf7d4c..7066282f7b 100644
--- a/hw/core/clock.c
+++ b/hw/core/clock.c
@@ -34,11 +34,16 @@ void clock_clear_callback(Clock *clk)
clock_set_callback(clk, NULL, NULL);
}
-void clock_set(Clock *clk, uint64_t period)
+bool clock_set(Clock *clk, uint64_t period)
{
+ if (clk->period == period) {
+ return false;
+ }
trace_clock_set(CLOCK_PATH(clk), CLOCK_PERIOD_TO_NS(clk->period),
CLOCK_PERIOD_TO_NS(period));
clk->period = period;
+
+ return true;
}
static void clock_propagate_period(Clock *clk, bool call_callbacks)