git: 42353d81e3a5 - main - Use DEFINE_CLASS_0 in the arm generic timer

From: Andrew Turner <andrew_at_FreeBSD.org>
Date: Wed, 21 Sep 2022 10:00:02 UTC
The branch main has been updated by andrew:

URL: https://cgit.FreeBSD.org/src/commit/?id=42353d81e3a580442a70404a4fcfcbc16c36ef3f

commit 42353d81e3a580442a70404a4fcfcbc16c36ef3f
Author:     Andrew Turner <andrew@FreeBSD.org>
AuthorDate: 2022-09-20 16:07:27 +0000
Commit:     Andrew Turner <andrew@FreeBSD.org>
CommitDate: 2022-09-21 09:59:14 +0000

    Use DEFINE_CLASS_0 in the arm generic timer
    
    Rather than defining the structure manually use the DEFINE_CLASS_0
    macro. As we have both an ACPI and FDT attachment we need to use the
    _0 variant of the macro as DEFINE_CLASS would create two structures
    with the same name.
    
    Sponsored by:   The FreeBSD Foundation
---
 sys/arm/arm/generic_timer.c | 14 ++++----------
 1 file changed, 4 insertions(+), 10 deletions(-)

diff --git a/sys/arm/arm/generic_timer.c b/sys/arm/arm/generic_timer.c
index aabcfd138012..2527af9b9068 100644
--- a/sys/arm/arm/generic_timer.c
+++ b/sys/arm/arm/generic_timer.c
@@ -553,11 +553,8 @@ static device_method_t arm_tmr_fdt_methods[] = {
 	{ 0, 0 }
 };
 
-static driver_t arm_tmr_fdt_driver = {
-	"generic_timer",
-	arm_tmr_fdt_methods,
-	sizeof(struct arm_tmr_softc),
-};
+static DEFINE_CLASS_0(generic_timer, arm_tmr_fdt_driver, arm_tmr_fdt_methods,
+    sizeof(struct arm_tmr_softc));
 
 EARLY_DRIVER_MODULE(timer, simplebus, arm_tmr_fdt_driver, 0, 0,
     BUS_PASS_TIMER + BUS_PASS_ORDER_MIDDLE);
@@ -573,11 +570,8 @@ static device_method_t arm_tmr_acpi_methods[] = {
 	{ 0, 0 }
 };
 
-static driver_t arm_tmr_acpi_driver = {
-	"generic_timer",
-	arm_tmr_acpi_methods,
-	sizeof(struct arm_tmr_softc),
-};
+static DEFINE_CLASS_0(generic_timer, arm_tmr_acpi_driver, arm_tmr_acpi_methods,
+    sizeof(struct arm_tmr_softc));
 
 EARLY_DRIVER_MODULE(timer, acpi, arm_tmr_acpi_driver, 0, 0,
     BUS_PASS_TIMER + BUS_PASS_ORDER_MIDDLE);