summaryrefslogtreecommitdiffstats
path: root/include/hw/clock.h
diff options
context:
space:
mode:
authorPhilippe Mathieu-Daudé2020-08-28 11:02:44 +0200
committerPeter Maydell2020-08-28 11:02:44 +0200
commit96250eab904261b31d9d1ac3abbdb36737635ffa (patch)
tree227bdc5607b938775ac69c92205affd1d7fe219d /include/hw/clock.h
parenthw/clock: Let clock_set() return boolean value (diff)
downloadqemu-96250eab904261b31d9d1ac3abbdb36737635ffa.tar.gz
qemu-96250eab904261b31d9d1ac3abbdb36737635ffa.tar.xz
qemu-96250eab904261b31d9d1ac3abbdb36737635ffa.zip
hw/clock: Only propagate clock changes if the clock is changed
Avoid propagating the clock change when the clock does not change. Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-id: 20200806123858.30058-4-f4bug@amsat.org Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'include/hw/clock.h')
-rw-r--r--include/hw/clock.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/include/hw/clock.h b/include/hw/clock.h
index d85af45c96..9ecd78b2c3 100644
--- a/include/hw/clock.h
+++ b/include/hw/clock.h
@@ -165,8 +165,9 @@ void clock_propagate(Clock *clk);
*/
static inline void clock_update(Clock *clk, uint64_t value)
{
- clock_set(clk, value);
- clock_propagate(clk);
+ if (clock_set(clk, value)) {
+ clock_propagate(clk);
+ }
}
static inline void clock_update_hz(Clock *clk, unsigned hz)