@@ -186,13 +186,9 @@ static inline bool clock_has_source(const Clock *clk)
*/
void clock_set(Clock *clk, uint64_t period, bool *changed);
-static inline bool clock_set_hz(Clock *clk, unsigned hz)
+static inline void clock_set_hz(Clock *clk, unsigned hz, bool *changed)
{
- bool changed = false;
-
- clock_set(clk, CLOCK_PERIOD_FROM_HZ(hz), &changed);
-
- return changed;
+ clock_set(clk, CLOCK_PERIOD_FROM_HZ(hz), changed);
}
static inline void clock_set_ns(Clock *clk, unsigned ns, bool *changed)
@@ -1521,7 +1521,7 @@ static void aspeed_minibmc_machine_init(MachineState *machine)
Clock *sysclk;
sysclk = clock_new(OBJECT(machine), "SYSCLK");
- clock_set_hz(sysclk, SYSCLK_FRQ);
+ clock_set_hz(sysclk, SYSCLK_FRQ, NULL);
bmc->soc = ASPEED_SOC(object_new(amc->soc_name));
object_property_add_child(OBJECT(machine), "soc", OBJECT(bmc->soc));
@@ -119,7 +119,7 @@ static void fby35_bic_init(Fby35State *s)
AspeedSoCState *soc;
s->bic_sysclk = clock_new(OBJECT(s), "SYSCLK");
- clock_set_hz(s->bic_sysclk, 200000000ULL);
+ clock_set_hz(s->bic_sysclk, 200000000ULL, NULL);
object_initialize_child(OBJECT(s), "bic", &s->bic, "ast1030-a1");
soc = ASPEED_SOC(&s->bic);
@@ -818,9 +818,9 @@ static void mps2tz_common_init(MachineState *machine)
/* These clocks don't need migration because they are fixed-frequency */
mms->sysclk = clock_new(OBJECT(machine), "SYSCLK");
- clock_set_hz(mms->sysclk, mmc->sysclk_frq);
+ clock_set_hz(mms->sysclk, mmc->sysclk_frq, NULL);
mms->s32kclk = clock_new(OBJECT(machine), "S32KCLK");
- clock_set_hz(mms->s32kclk, S32KCLK_FRQ);
+ clock_set_hz(mms->s32kclk, S32KCLK_FRQ, NULL);
object_initialize_child(OBJECT(machine), TYPE_IOTKIT, &mms->iotkit,
mmc->armsse_type);
@@ -151,10 +151,10 @@ static void mps2_common_init(MachineState *machine)
/* This clock doesn't need migration because it is fixed-frequency */
mms->sysclk = clock_new(OBJECT(machine), "SYSCLK");
- clock_set_hz(mms->sysclk, SYSCLK_FRQ);
+ clock_set_hz(mms->sysclk, SYSCLK_FRQ, NULL);
mms->refclk = clock_new(OBJECT(machine), "REFCLK");
- clock_set_hz(mms->refclk, REFCLK_FRQ);
+ clock_set_hz(mms->refclk, REFCLK_FRQ, NULL);
/* The FPGA images have an odd combination of different RAMs,
* because in hardware they are different implementations and
@@ -360,7 +360,7 @@ static void mps3r_common_init(MachineState *machine)
QList *oscclk;
mms->clk = clock_new(OBJECT(machine), "CLK");
- clock_set_hz(mms->clk, CLK_FRQ);
+ clock_set_hz(mms->clk, CLK_FRQ, NULL);
for (const RAMInfo *ri = mmc->raminfo; ri->name; ri++) {
MemoryRegion *mr = mr_for_raminfo(mms, ri);
@@ -71,7 +71,7 @@ static void emcraft_sf2_s2s010_init(MachineState *machine)
*/
/* This clock doesn't need migration because it is fixed-frequency */
m3clk = clock_new(OBJECT(machine), "m3clk");
- clock_set_hz(m3clk, 142 * 1000000);
+ clock_set_hz(m3clk, 142 * 1000000, NULL);
qdev_connect_clock_in(dev, "m3clk", m3clk);
qdev_prop_set_uint32(dev, "apb0div", 2);
qdev_prop_set_uint32(dev, "apb1div", 2);
@@ -366,9 +366,9 @@ static void musca_init(MachineState *machine)
assert(mmc->num_mpcs <= MUSCA_MPC_MAX);
mms->sysclk = clock_new(OBJECT(machine), "SYSCLK");
- clock_set_hz(mms->sysclk, SYSCLK_FRQ);
+ clock_set_hz(mms->sysclk, SYSCLK_FRQ, NULL);
mms->s32kclk = clock_new(OBJECT(machine), "S32KCLK");
- clock_set_hz(mms->s32kclk, S32KCLK_FRQ);
+ clock_set_hz(mms->s32kclk, S32KCLK_FRQ, NULL);
object_initialize_child(OBJECT(machine), "sse-200", &mms->sse,
TYPE_SSE200);
@@ -41,7 +41,7 @@ static void netduino2_init(MachineState *machine)
/* This clock doesn't need migration because it is fixed-frequency */
sysclk = clock_new(OBJECT(machine), "SYSCLK");
- clock_set_hz(sysclk, SYSCLK_FRQ);
+ clock_set_hz(sysclk, SYSCLK_FRQ, NULL);
dev = qdev_new(TYPE_STM32F205_SOC);
object_property_add_child(OBJECT(machine), "soc", OBJECT(dev));
@@ -41,7 +41,7 @@ static void netduinoplus2_init(MachineState *machine)
/* This clock doesn't need migration because it is fixed-frequency */
sysclk = clock_new(OBJECT(machine), "SYSCLK");
- clock_set_hz(sysclk, SYSCLK_FRQ);
+ clock_set_hz(sysclk, SYSCLK_FRQ, NULL);
dev = qdev_new(TYPE_STM32F405_SOC);
object_property_add_child(OBJECT(machine), "soc", OBJECT(dev));
@@ -75,7 +75,7 @@ static void nrf51_soc_realize(DeviceState *dev_soc, Error **errp)
return;
}
/* This clock doesn't need migration because it is fixed-frequency */
- clock_set_hz(s->sysclk, HCLK_FRQ);
+ clock_set_hz(s->sysclk, HCLK_FRQ, NULL);
qdev_connect_clock_in(DEVICE(&s->cpu), "cpuclk", s->sysclk);
/*
* This SoC has no systick device, so don't connect refclk.
@@ -44,7 +44,7 @@ static void olimex_stm32_h405_init(MachineState *machine)
/* This clock doesn't need migration because it is fixed-frequency */
sysclk = clock_new(OBJECT(machine), "SYSCLK");
- clock_set_hz(sysclk, SYSCLK_FRQ);
+ clock_set_hz(sysclk, SYSCLK_FRQ, NULL);
dev = qdev_new(TYPE_STM32F405_SOC);
object_property_add_child(OBJECT(machine), "soc", OBJECT(dev));
@@ -44,7 +44,7 @@ static void stm32vldiscovery_init(MachineState *machine)
/* This clock doesn't need migration because it is fixed-frequency */
sysclk = clock_new(OBJECT(machine), "SYSCLK");
- clock_set_hz(sysclk, SYSCLK_FRQ);
+ clock_set_hz(sysclk, SYSCLK_FRQ, NULL);
dev = qdev_new(TYPE_STM32F100_SOC);
object_property_add_child(OBJECT(machine), "soc", OBJECT(dev));
@@ -228,7 +228,7 @@ static void zynq_init(MachineState *machine)
object_property_add_child(OBJECT(zynq_machine), "ps_clk",
OBJECT(zynq_machine->ps_clk));
object_unref(OBJECT(zynq_machine->ps_clk));
- clock_set_hz(zynq_machine->ps_clk, PS_CLK_FREQUENCY);
+ clock_set_hz(zynq_machine->ps_clk, PS_CLK_FREQUENCY, NULL);
/* Create slcr, keep a pointer to connect clocks */
slcr = qdev_new("xilinx-zynq_slcr");
@@ -566,7 +566,7 @@ static void cadence_uart_init(Object *obj)
s->refclk = qdev_init_clock_in(DEVICE(obj), "refclk",
cadence_uart_refclk_update, s, ClockUpdate);
/* initialize the frequency in case the clock remains unconnected */
- clock_set_hz(s->refclk, UART_DEFAULT_REF_CLK);
+ clock_set_hz(s->refclk, UART_DEFAULT_REF_CLK, NULL);
s->char_tx_time = (NANOSECONDS_PER_SECOND / 9600) * 10;
}
@@ -576,7 +576,7 @@ static int cadence_uart_pre_load(void *opaque)
CadenceUARTState *s = opaque;
/* the frequency will be overridden if the refclk field is present */
- clock_set_hz(s->refclk, UART_DEFAULT_REF_CLK);
+ clock_set_hz(s->refclk, UART_DEFAULT_REF_CLK, NULL);
return 0;
}
Pass optional &bool argument to clock_set_ns(). Since all callers ignore the return value, have them use NULL. Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> --- include/hw/clock.h | 8 ++------ hw/arm/aspeed.c | 2 +- hw/arm/fby35.c | 2 +- hw/arm/mps2-tz.c | 4 ++-- hw/arm/mps2.c | 4 ++-- hw/arm/mps3r.c | 2 +- hw/arm/msf2-som.c | 2 +- hw/arm/musca.c | 4 ++-- hw/arm/netduino2.c | 2 +- hw/arm/netduinoplus2.c | 2 +- hw/arm/nrf51_soc.c | 2 +- hw/arm/olimex-stm32-h405.c | 2 +- hw/arm/stm32vldiscovery.c | 2 +- hw/arm/xilinx_zynq.c | 2 +- hw/char/cadence_uart.c | 4 ++-- 15 files changed, 20 insertions(+), 24 deletions(-)