From: cheloha Date: Tue, 23 Feb 2021 04:44:30 +0000 (+0000) Subject: timecounting: use C99-style initialization for all timecounter structs X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=8611d3cdb295683ad47c33036b86b471b2d09741;p=openbsd timecounting: use C99-style initialization for all timecounter structs The timecounter struct is large and I think it may change in the future. Changing it later will be easier if we use C99-style initialization for all timecounter structs. It also makes reading the code a bit easier. For reasons I cannot explain, switching to C99-style initialization sometimes changes the hash of the resulting object file, even though the resulting struct should be the same. So there is a binary change here, but only sometimes. No behavior should change in either case. I can't compile-test this everywhere but I have been staring at the diff for days now and I'm relatively confident this will not break compilation. Fingers crossed. ok gnezdo@ --- diff --git a/sys/arch/alpha/alpha/clock.c b/sys/arch/alpha/alpha/clock.c index 78caeef059f..0ccf551565b 100644 --- a/sys/arch/alpha/alpha/clock.c +++ b/sys/arch/alpha/alpha/clock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: clock.c,v 1.24 2020/07/06 13:33:06 pirofti Exp $ */ +/* $OpenBSD: clock.c,v 1.25 2021/02/23 04:44:30 cheloha Exp $ */ /* $NetBSD: clock.c,v 1.29 2000/06/05 21:47:10 thorpej Exp $ */ /* @@ -64,7 +64,14 @@ int clk_irq = 0; u_int rpcc_get_timecount(struct timecounter *); struct timecounter rpcc_timecounter = { - rpcc_get_timecount, NULL, ~0u, 0, "rpcc", 0, NULL, 0 + .tc_get_timecount = rpcc_get_timecount, + .tc_poll_pps = NULL, + .tc_counter_mask = ~0u, + .tc_frequency = 0, + .tc_name = "rpcc", + .tc_quality = 0, + .tc_priv = NULL, + .tc_user = 0, }; extern todr_chip_handle_t todr_handle; diff --git a/sys/arch/amd64/amd64/tsc.c b/sys/arch/amd64/amd64/tsc.c index 93c9138d585..c9b5e555227 100644 --- a/sys/arch/amd64/amd64/tsc.c +++ b/sys/arch/amd64/amd64/tsc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tsc.c,v 1.22 2020/12/24 04:20:48 jsg Exp $ */ +/* $OpenBSD: tsc.c,v 1.23 2021/02/23 04:44:30 cheloha Exp $ */ /* * Copyright (c) 2008 The NetBSD Foundation, Inc. * Copyright (c) 2016,2017 Reyk Floeter @@ -52,7 +52,14 @@ extern u_int32_t lapic_per_second; #endif struct timecounter tsc_timecounter = { - tsc_get_timecount, NULL, ~0u, 0, "tsc", -1000, NULL, TC_TSC + .tc_get_timecount = tsc_get_timecount, + .tc_poll_pps = NULL, + .tc_counter_mask = ~0u, + .tc_frequency = 0, + .tc_name = "tsc", + .tc_quality = -1000, + .tc_priv = NULL, + .tc_user = TC_TSC, }; uint64_t diff --git a/sys/arch/amd64/isa/clock.c b/sys/arch/amd64/isa/clock.c index cc0b38b69c1..3025ad232a6 100644 --- a/sys/arch/amd64/isa/clock.c +++ b/sys/arch/amd64/isa/clock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: clock.c,v 1.34 2020/07/06 13:33:06 pirofti Exp $ */ +/* $OpenBSD: clock.c,v 1.35 2021/02/23 04:44:30 cheloha Exp $ */ /* $NetBSD: clock.c,v 1.1 2003/04/26 18:39:50 fvdl Exp $ */ /*- @@ -116,7 +116,14 @@ u_int i8254_get_timecount(struct timecounter *tc); u_int i8254_simple_get_timecount(struct timecounter *tc); static struct timecounter i8254_timecounter = { - i8254_get_timecount, NULL, ~0u, TIMER_FREQ, "i8254", 0, NULL, 0 + .tc_get_timecount = i8254_get_timecount, + .tc_poll_pps = NULL, + .tc_counter_mask = ~0u, + .tc_frequency = TIMER_FREQ, + .tc_name = "i8254", + .tc_quality = 0, + .tc_priv = NULL, + .tc_user = 0, }; int clockintr(void *); diff --git a/sys/arch/arm/cortex/agtimer.c b/sys/arch/arm/cortex/agtimer.c index a2bb0be956d..8d742f8d03c 100644 --- a/sys/arch/arm/cortex/agtimer.c +++ b/sys/arch/arm/cortex/agtimer.c @@ -1,4 +1,4 @@ -/* $OpenBSD: agtimer.c,v 1.11 2021/01/19 18:04:43 kettenis Exp $ */ +/* $OpenBSD: agtimer.c,v 1.12 2021/02/23 04:44:30 cheloha Exp $ */ /* * Copyright (c) 2011 Dale Rahn * Copyright (c) 2013 Patrick Wildt @@ -46,7 +46,13 @@ int32_t agtimer_frequency = TIMER_FREQUENCY; u_int agtimer_get_timecount(struct timecounter *); static struct timecounter agtimer_timecounter = { - agtimer_get_timecount, NULL, 0xffffffff, 0, "agtimer", 0, NULL + .tc_get_timecount = agtimer_get_timecount, + .tc_poll_pps = NULL, + .tc_counter_mask = 0xffffffff, + .tc_frequency = 0, + .tc_name = "agtimer", + .tc_quality = 0, + .tc_priv = NULL, }; struct agtimer_pcpu_softc { diff --git a/sys/arch/arm/cortex/amptimer.c b/sys/arch/arm/cortex/amptimer.c index 7f85f00b312..1a83f0b30ad 100644 --- a/sys/arch/arm/cortex/amptimer.c +++ b/sys/arch/arm/cortex/amptimer.c @@ -1,4 +1,4 @@ -/* $OpenBSD: amptimer.c,v 1.10 2021/01/19 18:04:43 kettenis Exp $ */ +/* $OpenBSD: amptimer.c,v 1.11 2021/02/23 04:44:30 cheloha Exp $ */ /* * Copyright (c) 2011 Dale Rahn * @@ -67,7 +67,14 @@ int32_t amptimer_frequency = TIMER_FREQUENCY; u_int amptimer_get_timecount(struct timecounter *); static struct timecounter amptimer_timecounter = { - amptimer_get_timecount, NULL, 0xffffffff, 0, "amptimer", 0, NULL, 0 + .tc_get_timecount = amptimer_get_timecount, + .tc_poll_pps = NULL, + .tc_counter_mask = 0xffffffff, + .tc_frequency = 0, + .tc_name = "amptimer", + .tc_quality = 0, + .tc_priv = NULL, + .tc_user = 0, }; #define MAX_ARM_CPUS 8 diff --git a/sys/arch/arm64/dev/agtimer.c b/sys/arch/arm64/dev/agtimer.c index 8a98e4c9960..f121e071c6f 100644 --- a/sys/arch/arm64/dev/agtimer.c +++ b/sys/arch/arm64/dev/agtimer.c @@ -1,4 +1,4 @@ -/* $OpenBSD: agtimer.c,v 1.16 2021/01/19 18:07:15 kettenis Exp $ */ +/* $OpenBSD: agtimer.c,v 1.17 2021/02/23 04:44:30 cheloha Exp $ */ /* * Copyright (c) 2011 Dale Rahn * Copyright (c) 2013 Patrick Wildt @@ -43,8 +43,14 @@ int32_t agtimer_frequency = TIMER_FREQUENCY; u_int agtimer_get_timecount(struct timecounter *); static struct timecounter agtimer_timecounter = { - agtimer_get_timecount, NULL, 0xffffffff, 0, "agtimer", 0, NULL, - TC_AGTIMER + .tc_get_timecount = agtimer_get_timecount, + .tc_poll_pps = NULL, + .tc_counter_mask = 0xffffffff, + .tc_frequency = 0, + .tc_name = "agtimer", + .tc_quality = 0, + .tc_priv = NULL, + .tc_user = TC_AGTIMER, }; struct agtimer_pcpu_softc { diff --git a/sys/arch/armv7/omap/dmtimer.c b/sys/arch/armv7/omap/dmtimer.c index ddb4c859d65..5f04432d502 100644 --- a/sys/arch/armv7/omap/dmtimer.c +++ b/sys/arch/armv7/omap/dmtimer.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dmtimer.c,v 1.9 2021/01/19 18:04:43 kettenis Exp $ */ +/* $OpenBSD: dmtimer.c,v 1.10 2021/02/23 04:44:30 cheloha Exp $ */ /* * Copyright (c) 2007,2009 Dale Rahn * Copyright (c) 2013 Raphael Graf @@ -111,7 +111,13 @@ void dmtimer_setstatclockrate(int newhz); u_int dmtimer_get_timecount(struct timecounter *); static struct timecounter dmtimer_timecounter = { - dmtimer_get_timecount, NULL, 0xffffffff, 0, "dmtimer", 0, NULL + .tc_get_timecount = dmtimer_get_timecount, + .tc_poll_pps = NULL, + .tc_counter_mask = 0xffffffff, + .tc_frequency = 0, + .tc_name = "dmtimer", + .tc_quality = 0, + .tc_priv = NULL, }; bus_space_handle_t dmtimer_ioh0; diff --git a/sys/arch/armv7/omap/gptimer.c b/sys/arch/armv7/omap/gptimer.c index 5dc8c185a58..bc1b7b199d0 100644 --- a/sys/arch/armv7/omap/gptimer.c +++ b/sys/arch/armv7/omap/gptimer.c @@ -1,4 +1,4 @@ -/* $OpenBSD: gptimer.c,v 1.11 2021/01/19 18:04:43 kettenis Exp $ */ +/* $OpenBSD: gptimer.c,v 1.12 2021/02/23 04:44:30 cheloha Exp $ */ /* * Copyright (c) 2007,2009 Dale Rahn * @@ -113,7 +113,14 @@ int gptimer_irq = 0; u_int gptimer_get_timecount(struct timecounter *); static struct timecounter gptimer_timecounter = { - gptimer_get_timecount, NULL, 0xffffffff, 0, "gptimer", 0, NULL, 0 + .tc_get_timecount = gptimer_get_timecount, + .tc_poll_pps = NULL, + .tc_counter_mask = 0xffffffff, + .tc_frequency = 0, + .tc_name = "gptimer", + .tc_quality = 0, + .tc_priv = NULL, + .tc_user = 0, }; volatile u_int32_t nexttickevent; diff --git a/sys/arch/armv7/sunxi/sxitimer.c b/sys/arch/armv7/sunxi/sxitimer.c index a1172f6043d..4ed2ee5701d 100644 --- a/sys/arch/armv7/sunxi/sxitimer.c +++ b/sys/arch/armv7/sunxi/sxitimer.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sxitimer.c,v 1.15 2021/01/19 18:04:43 kettenis Exp $ */ +/* $OpenBSD: sxitimer.c,v 1.16 2021/02/23 04:44:30 cheloha Exp $ */ /* * Copyright (c) 2007,2009 Dale Rahn * Copyright (c) 2013 Raphael Graf @@ -89,7 +89,14 @@ void sxitimer_delay(u_int); u_int sxitimer_get_timecount(struct timecounter *); static struct timecounter sxitimer_timecounter = { - sxitimer_get_timecount, NULL, 0xffffffff, 0, "sxitimer", 0, NULL, 0 + .tc_get_timecount = sxitimer_get_timecount, + .tc_poll_pps = NULL, + .tc_counter_mask = 0xffffffff, + .tc_frequency = 0, + .tc_name = "sxitimer", + .tc_quality = 0, + .tc_priv = NULL, + .tc_user = 0, }; bus_space_tag_t sxitimer_iot; diff --git a/sys/arch/hppa/dev/clock.c b/sys/arch/hppa/dev/clock.c index ac99711224e..b3ed1802f7b 100644 --- a/sys/arch/hppa/dev/clock.c +++ b/sys/arch/hppa/dev/clock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: clock.c,v 1.31 2020/07/06 13:33:07 pirofti Exp $ */ +/* $OpenBSD: clock.c,v 1.32 2021/02/23 04:44:30 cheloha Exp $ */ /* * Copyright (c) 1998-2003 Michael Shalayeff @@ -47,7 +47,14 @@ int cpu_hardclock(void *); u_int itmr_get_timecount(struct timecounter *); struct timecounter itmr_timecounter = { - itmr_get_timecount, NULL, 0xffffffff, 0, "itmr", 0, NULL, 0 + .tc_get_timecount = itmr_get_timecount, + .tc_poll_pps = NULL, + .tc_counter_mask = 0xffffffff, + .tc_frequency = 0, + .tc_name = "itmr", + .tc_quality = 0, + .tc_priv = NULL, + .tc_user = 0, }; extern todr_chip_handle_t todr_handle; diff --git a/sys/arch/i386/isa/clock.c b/sys/arch/i386/isa/clock.c index 3ff97aace48..566d2fe1dd2 100644 --- a/sys/arch/i386/isa/clock.c +++ b/sys/arch/i386/isa/clock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: clock.c,v 1.59 2020/07/06 13:33:07 pirofti Exp $ */ +/* $OpenBSD: clock.c,v 1.60 2021/02/23 04:44:30 cheloha Exp $ */ /* $NetBSD: clock.c,v 1.39 1996/05/12 23:11:54 mycroft Exp $ */ /*- @@ -129,7 +129,14 @@ u_int i8254_get_timecount(struct timecounter *tc); u_int i8254_simple_get_timecount(struct timecounter *tc); static struct timecounter i8254_timecounter = { - i8254_get_timecount, NULL, ~0u, TIMER_FREQ, "i8254", 0, NULL, 0 + .tc_get_timecount = i8254_get_timecount, + .tc_poll_pps = NULL, + .tc_counter_mask = ~0u, + .tc_frequency = TIMER_FREQ, + .tc_name = "i8254", + .tc_quality = 0, + .tc_priv = NULL, + .tc_user = 0, }; struct mutex timer_mutex = MUTEX_INITIALIZER(IPL_HIGH); u_long rtclock_tval; diff --git a/sys/arch/i386/pci/geodesc.c b/sys/arch/i386/pci/geodesc.c index 3e804e05a93..960a9d4beb7 100644 --- a/sys/arch/i386/pci/geodesc.c +++ b/sys/arch/i386/pci/geodesc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: geodesc.c,v 1.15 2020/07/06 13:33:07 pirofti Exp $ */ +/* $OpenBSD: geodesc.c,v 1.16 2021/02/23 04:44:30 cheloha Exp $ */ /* * Copyright (c) 2003 Markus Friedl @@ -60,14 +60,14 @@ struct cfdriver geodesc_cd = { u_int geodesc_get_timecount(struct timecounter *tc); struct timecounter geodesc_timecounter = { - geodesc_get_timecount, /* get_timecount */ - 0, /* no poll_pps */ - 0xffffffff, /* counter_mask */ - 27000000, /* frequency */ - "GEOTSC", /* name */ - 2000, /* quality */ - NULL, /* private bits */ - 0 /* expose to user */ + .tc_get_timecount = geodesc_get_timecount, + .tc_poll_pps = 0, + .tc_counter_mask = 0xffffffff, + .tc_frequency = 27000000, + .tc_name = "GEOTSC", + .tc_quality = 2000, + .tc_priv = NULL, + .tc_user = 0, }; int diff --git a/sys/arch/i386/pci/gscpm.c b/sys/arch/i386/pci/gscpm.c index 84c67c64764..c1bbacccdf5 100644 --- a/sys/arch/i386/pci/gscpm.c +++ b/sys/arch/i386/pci/gscpm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: gscpm.c,v 1.10 2020/07/06 13:33:07 pirofti Exp $ */ +/* $OpenBSD: gscpm.c,v 1.11 2021/02/23 04:44:30 cheloha Exp $ */ /* * Copyright (c) 2004 Alexander Yurchenko * @@ -50,14 +50,14 @@ void gscpm_setperf(int); u_int gscpm_get_timecount(struct timecounter *tc); struct timecounter gscpm_timecounter = { - gscpm_get_timecount, /* get_timecount */ - 0, /* no poll_pps */ - 0xffffff, /* counter_mask */ - 3579545, /* frequency */ - "GSCPM", /* name */ - 1000, /* quality */ - NULL, /* private bits */ - 0 /* expose to user */ + .tc_get_timecount = gscpm_get_timecount, + .tc_poll_pps = 0, + .tc_counter_mask = 0xffffff, + .tc_frequency = 3579545, + .tc_name = "GSCPM", + .tc_quality = 1000, + .tc_priv = NULL, + .tc_user = 0, }; struct cfattach gscpm_ca = { diff --git a/sys/arch/i386/pci/ichpcib.c b/sys/arch/i386/pci/ichpcib.c index 3ece43ecc56..479fc423744 100644 --- a/sys/arch/i386/pci/ichpcib.c +++ b/sys/arch/i386/pci/ichpcib.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ichpcib.c,v 1.29 2020/07/06 13:33:07 pirofti Exp $ */ +/* $OpenBSD: ichpcib.c,v 1.30 2021/02/23 04:44:30 cheloha Exp $ */ /* * Copyright (c) 2004 Alexander Yurchenko * @@ -58,14 +58,14 @@ void pcibattach(struct device *, struct device *, void *); u_int ichpcib_get_timecount(struct timecounter *tc); struct timecounter ichpcib_timecounter = { - ichpcib_get_timecount, /* get_timecount */ - 0, /* no poll_pps */ - 0xffffff, /* counter_mask */ - 3579545, /* frequency */ - "ICHPM", /* name */ - 1000, /* quality */ - NULL, /* private bits */ - 0 /* expose to user */ + .tc_get_timecount = ichpcib_get_timecount, + .tc_poll_pps = 0, + .tc_counter_mask = 0xffffff, + .tc_frequency = 3579545, + .tc_name = "ICHPM", + .tc_quality = 1000, + .tc_priv = NULL, + .tc_user = 0, }; struct cfattach ichpcib_ca = { diff --git a/sys/arch/macppc/macppc/clock.c b/sys/arch/macppc/macppc/clock.c index 7ff7ba2635b..a24e7f997f0 100644 --- a/sys/arch/macppc/macppc/clock.c +++ b/sys/arch/macppc/macppc/clock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: clock.c,v 1.47 2020/08/26 03:29:06 visa Exp $ */ +/* $OpenBSD: clock.c,v 1.48 2021/02/23 04:44:30 cheloha Exp $ */ /* $NetBSD: clock.c,v 1.1 1996/09/30 16:34:40 ws Exp $ */ /* @@ -57,7 +57,14 @@ u_int32_t ns_per_tick = 320; static int32_t ticks_per_intr; static struct timecounter tb_timecounter = { - tb_get_timecount, NULL, 0xffffffff, 0, "tb", 0, NULL, TC_TB + .tc_get_timecount = tb_get_timecount, + .tc_poll_pps = NULL, + .tc_counter_mask = 0xffffffff, + .tc_frequency = 0, + .tc_name = "tb", + .tc_quality = 0, + .tc_priv = NULL, + .tc_user = TC_TB, }; /* calibrate the timecounter frequency for the listed models */ diff --git a/sys/arch/mips64/mips64/mips64_machdep.c b/sys/arch/mips64/mips64/mips64_machdep.c index a8479191d89..9b286c4cbd4 100644 --- a/sys/arch/mips64/mips64/mips64_machdep.c +++ b/sys/arch/mips64/mips64/mips64_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mips64_machdep.c,v 1.34 2021/01/13 16:28:49 cheloha Exp $ */ +/* $OpenBSD: mips64_machdep.c,v 1.35 2021/02/23 04:44:30 cheloha Exp $ */ /* * Copyright (c) 2009, 2010, 2012 Miodrag Vallat. @@ -267,14 +267,14 @@ delay(int n) u_int cp0_get_timecount(struct timecounter *); struct timecounter cp0_timecounter = { - cp0_get_timecount, /* get_timecount */ - 0, /* no poll_pps */ - 0xffffffff, /* counter_mask */ - 0, /* frequency */ - "CP0", /* name */ - 0, /* quality */ - NULL, /* private bits */ - 0, /* expose to user */ + .tc_get_timecount = cp0_get_timecount, + .tc_poll_pps = 0, + .tc_counter_mask = 0xffffffff, + .tc_frequency = 0, + .tc_name = "CP0", + .tc_quality = 0, + .tc_priv = NULL, + .tc_user = 0, }; u_int diff --git a/sys/arch/powerpc64/powerpc64/clock.c b/sys/arch/powerpc64/powerpc64/clock.c index a2bb7124b60..204ce0fcac2 100644 --- a/sys/arch/powerpc64/powerpc64/clock.c +++ b/sys/arch/powerpc64/powerpc64/clock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: clock.c,v 1.2 2020/07/12 20:32:20 naddy Exp $ */ +/* $OpenBSD: clock.c,v 1.3 2021/02/23 04:44:31 cheloha Exp $ */ /* * Copyright (c) 2020 Mark Kettenis @@ -37,7 +37,13 @@ struct evcount stat_count; u_int tb_get_timecount(struct timecounter *); static struct timecounter tb_timecounter = { - tb_get_timecount, NULL, 0xffffffff, 0, "tb", 0, NULL + .tc_get_timecount = tb_get_timecount, + .tc_poll_pps = NULL, + .tc_counter_mask = 0xffffffff, + .tc_frequency = 0, + .tc_name = "tb", + .tc_quality = 0, + .tc_priv = NULL, }; void cpu_startclock(void); diff --git a/sys/arch/sparc64/dev/psycho.c b/sys/arch/sparc64/dev/psycho.c index ce8d9a7bb9f..0de8e00cc2e 100644 --- a/sys/arch/sparc64/dev/psycho.c +++ b/sys/arch/sparc64/dev/psycho.c @@ -1,4 +1,4 @@ -/* $OpenBSD: psycho.c,v 1.77 2020/07/06 13:33:08 pirofti Exp $ */ +/* $OpenBSD: psycho.c,v 1.78 2021/02/23 04:44:31 cheloha Exp $ */ /* $NetBSD: psycho.c,v 1.39 2001/10/07 20:30:41 eeh Exp $ */ /* @@ -127,7 +127,14 @@ extern struct sparc_pci_chipset _sparc_pci_chipset; u_int stick_get_timecount(struct timecounter *); struct timecounter stick_timecounter = { - stick_get_timecount, NULL, ~0u, 0, "stick", 1000, NULL, 0 + .tc_get_timecount = stick_get_timecount, + .tc_poll_pps = NULL, + .tc_counter_mask = ~0u, + .tc_frequency = 0, + .tc_name = "stick", + .tc_quality = 1000, + .tc_priv = NULL, + .tc_user = 0, }; /* diff --git a/sys/arch/sparc64/sparc64/clock.c b/sys/arch/sparc64/sparc64/clock.c index 9264f076bb9..f58a1ab49e2 100644 --- a/sys/arch/sparc64/sparc64/clock.c +++ b/sys/arch/sparc64/sparc64/clock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: clock.c,v 1.67 2020/10/20 15:59:17 cheloha Exp $ */ +/* $OpenBSD: clock.c,v 1.68 2021/02/23 04:44:31 cheloha Exp $ */ /* $NetBSD: clock.c,v 1.41 2001/07/24 19:29:25 eeh Exp $ */ /* @@ -109,15 +109,27 @@ struct cfdriver clock_cd = { u_int tick_get_timecount(struct timecounter *); struct timecounter tick_timecounter = { - tick_get_timecount, NULL, ~0u, 0, "tick", 0, - NULL, TC_TICK + .tc_get_timecount = tick_get_timecount, + .tc_poll_pps = NULL, + .tc_counter_mask = ~0u, + .tc_frequency = 0, + .tc_name = "tick", + .tc_quality = 0, + .tc_priv = NULL, + .tc_user = TC_TICK, }; u_int sys_tick_get_timecount(struct timecounter *); struct timecounter sys_tick_timecounter = { - sys_tick_get_timecount, NULL, ~0u, 0, "sys_tick", 1000, - NULL, TC_SYS_TICK + .tc_get_timecount = sys_tick_get_timecount, + .tc_poll_pps = NULL, + .tc_counter_mask = ~0u, + .tc_frequency = 0, + .tc_name = "sys_tick", + .tc_quality = 1000, + .tc_priv = NULL, + .tc_user = TC_SYS_TICK, }; /* diff --git a/sys/dev/acpi/acpihpet.c b/sys/dev/acpi/acpihpet.c index 9dc4908eaaf..06de15380ca 100644 --- a/sys/dev/acpi/acpihpet.c +++ b/sys/dev/acpi/acpihpet.c @@ -1,4 +1,4 @@ -/* $OpenBSD: acpihpet.c,v 1.24 2020/07/06 13:33:08 pirofti Exp $ */ +/* $OpenBSD: acpihpet.c,v 1.25 2021/02/23 04:44:31 cheloha Exp $ */ /* * Copyright (c) 2005 Thorsten Lockert * @@ -40,14 +40,14 @@ void acpihpet_w(bus_space_tag_t _iot, bus_space_handle_t _ioh, bus_size_t _ioa, uint64_t _val); static struct timecounter hpet_timecounter = { - acpihpet_gettime, /* get_timecount */ - 0, /* no poll_pps */ - 0xffffffff, /* counter_mask (32 bits) */ - 0, /* frequency */ - 0, /* name */ - 1000, /* quality */ - NULL, /* private bits */ - 0, /* expose to user */ + .tc_get_timecount = acpihpet_gettime, + .tc_poll_pps = 0, + .tc_counter_mask = 0xffffffff, + .tc_frequency = 0, + .tc_name = 0, + .tc_quality = 1000, + .tc_priv = NULL, + .tc_user = 0, }; #define HPET_TIMERS 3 diff --git a/sys/dev/acpi/acpitimer.c b/sys/dev/acpi/acpitimer.c index 8885ab43a71..36623636862 100644 --- a/sys/dev/acpi/acpitimer.c +++ b/sys/dev/acpi/acpitimer.c @@ -1,4 +1,4 @@ -/* $OpenBSD: acpitimer.c,v 1.13 2020/07/06 13:33:08 pirofti Exp $ */ +/* $OpenBSD: acpitimer.c,v 1.14 2021/02/23 04:44:31 cheloha Exp $ */ /* * Copyright (c) 2005 Thorsten Lockert * @@ -31,14 +31,14 @@ void acpitimerattach(struct device *, struct device *, void *); u_int acpi_get_timecount(struct timecounter *tc); static struct timecounter acpi_timecounter = { - acpi_get_timecount, /* get_timecount */ - 0, /* no poll_pps */ - 0x00ffffff, /* counter_mask (24 bits) */ - ACPI_FREQUENCY, /* frequency */ - 0, /* name */ - 1000, /* quality */ - NULL, /* private bits */ - 0, /* expose to user */ + .tc_get_timecount = acpi_get_timecount, + .tc_poll_pps = 0, + .tc_counter_mask = 0x00ffffff, /* 24 bits */ + .tc_frequency = ACPI_FREQUENCY, + .tc_name = 0, + .tc_quality = 1000, + .tc_priv = NULL, + .tc_user = 0, }; struct acpitimer_softc { diff --git a/sys/dev/pci/amdpm.c b/sys/dev/pci/amdpm.c index 73659d477d4..af4be9fdb86 100644 --- a/sys/dev/pci/amdpm.c +++ b/sys/dev/pci/amdpm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: amdpm.c,v 1.36 2020/07/06 13:33:09 pirofti Exp $ */ +/* $OpenBSD: amdpm.c,v 1.37 2021/02/23 04:44:31 cheloha Exp $ */ /* * Copyright (c) 2006 Alexander Yurchenko @@ -77,14 +77,14 @@ u_int amdpm_get_timecount(struct timecounter *tc); #endif static struct timecounter amdpm_timecounter = { - amdpm_get_timecount, /* get_timecount */ - 0, /* no poll_pps */ - 0xffffff, /* counter_mask */ - AMDPM_FREQUENCY, /* frequency */ - "AMDPM", /* name */ - 1000, /* quality */ - NULL, /* private bits */ - 0, /* expose to user */ + .tc_get_timecount = amdpm_get_timecount, + .tc_poll_pps = 0, + .tc_counter_mask = 0xffffff, + .tc_frequency = AMDPM_FREQUENCY, + .tc_name = "AMDPM", + .tc_quality = 1000, + .tc_priv = NULL, + .tc_user = 0, }; #define AMDPM_CONFREG 0x40 diff --git a/sys/dev/pci/viapm.c b/sys/dev/pci/viapm.c index ee7e93f9f05..14485edb1de 100644 --- a/sys/dev/pci/viapm.c +++ b/sys/dev/pci/viapm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: viapm.c,v 1.19 2020/07/06 13:33:09 pirofti Exp $ */ +/* $OpenBSD: viapm.c,v 1.20 2021/02/23 04:44:31 cheloha Exp $ */ /* * Copyright (c) 2005 Mark Kettenis @@ -172,14 +172,14 @@ u_int viapm_get_timecount(struct timecounter *tc); #endif static struct timecounter viapm_timecounter = { - viapm_get_timecount, /* get_timecount */ - 0, /* no poll_pps */ - 0xffffff, /* counter_mask */ - VIAPM_FREQUENCY, /* frequency */ - "VIAPM", /* name */ - 1000, /* quality */ - NULL, /* private bits */ - 0, /* expose to user */ + .tc_get_timecount = viapm_get_timecount, + .tc_poll_pps = 0, + .tc_counter_mask = 0xffffff, + .tc_frequency = VIAPM_FREQUENCY, + .tc_name = "VIAPM", + .tc_quality = 1000, + .tc_priv = NULL, + .tc_user = 0, }; struct timeout viapm_timeout; diff --git a/sys/dev/pv/hyperv.c b/sys/dev/pv/hyperv.c index 4a695cc4517..de753ccbfc9 100644 --- a/sys/dev/pv/hyperv.c +++ b/sys/dev/pv/hyperv.c @@ -141,7 +141,14 @@ struct { }; struct timecounter hv_timecounter = { - hv_gettime, 0, 0xffffffff, 10000000, "hyperv", 9001, NULL, 0 + .tc_get_timecount = hv_gettime, + .tc_poll_pps = 0, + .tc_counter_mask = 0xffffffff, + .tc_frequency = 10000000, + .tc_name = "hyperv", + .tc_quality = 9001, + .tc_priv = NULL, + .tc_user = 0, }; struct cfdriver hyperv_cd = { diff --git a/sys/dev/pv/pvclock.c b/sys/dev/pv/pvclock.c index cf72aecedcc..cf727b076d8 100644 --- a/sys/dev/pv/pvclock.c +++ b/sys/dev/pv/pvclock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pvclock.c,v 1.6 2020/07/06 13:33:09 pirofti Exp $ */ +/* $OpenBSD: pvclock.c,v 1.7 2021/02/23 04:44:31 cheloha Exp $ */ /* * Copyright (c) 2018 Reyk Floeter @@ -74,7 +74,14 @@ struct cfdriver pvclock_cd = { }; struct timecounter pvclock_timecounter = { - pvclock_get_timecount, NULL, ~0u, 0, NULL, -2000, NULL, 0 + .tc_get_timecount = pvclock_get_timecount, + .tc_poll_pps = NULL, + .tc_counter_mask = ~0u, + .tc_frequency = 0, + .tc_name = NULL, + .tc_quality = -2000, + .tc_priv = NULL, + .tc_user = 0, }; int diff --git a/sys/kern/kern_tc.c b/sys/kern/kern_tc.c index 3c4cfa1b093..c0eac3d4cdc 100644 --- a/sys/kern/kern_tc.c +++ b/sys/kern/kern_tc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_tc.c,v 1.70 2020/12/05 04:46:34 gnezdo Exp $ */ +/* $OpenBSD: kern_tc.c,v 1.71 2021/02/23 04:44:31 cheloha Exp $ */ /* * Copyright (c) 2000 Poul-Henning Kamp @@ -55,7 +55,14 @@ dummy_get_timecount(struct timecounter *tc) } static struct timecounter dummy_timecounter = { - dummy_get_timecount, 0, ~0u, 1000000, "dummy", -1000000, NULL, 0 + .tc_get_timecount = dummy_get_timecount, + .tc_poll_pps = 0, + .tc_counter_mask = ~0u, + .tc_frequency = 1000000, + .tc_name = "dummy", + .tc_quality = -1000000, + .tc_priv = NULL, + .tc_user = 0, }; /*