git: 651a887f4e66 - main - xen: Use devclass_find to lookup devclasses in identify.

From: John Baldwin <jhb_at_FreeBSD.org>
Date: Mon, 25 Apr 2022 18:56:50 UTC
The branch main has been updated by jhb:

URL: https://cgit.FreeBSD.org/src/commit/?id=651a887f4e66b15145508e74db72ebb73c22112b

commit 651a887f4e66b15145508e74db72ebb73c22112b
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2022-04-25 18:55:30 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2022-04-25 18:55:30 +0000

    xen: Use devclass_find to lookup devclasses in identify.
    
    While here, use driver->name instead of hardcoding the xenpv and
    xen_et strings both for devclass_find() and BUS_ADD_CHILD().
    
    Reviewed by:    Elliott Mitchell <ehem+freebsd@m5p.com>, imp, royger
    Differential Revision:  https://reviews.freebsd.org/D35001
---
 sys/dev/xen/bus/xenpv.c   | 4 ++--
 sys/dev/xen/timer/timer.c | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/sys/dev/xen/bus/xenpv.c b/sys/dev/xen/bus/xenpv.c
index 91004039a85e..7727c1caccee 100644
--- a/sys/dev/xen/bus/xenpv.c
+++ b/sys/dev/xen/bus/xenpv.c
@@ -77,14 +77,14 @@ xenpv_identify(driver_t *driver, device_t parent)
 		return;
 
 	/* Make sure there's only one xenpv device. */
-	if (devclass_get_device(xenpv_devclass, 0))
+	if (devclass_get_device(devclass_find(driver->name), 0))
 		return;
 
 	/*
 	 * The xenpv bus should be the last to attach in order
 	 * to properly detect if an ISA bus has already been added.
 	 */
-	if (BUS_ADD_CHILD(parent, UINT_MAX, "xenpv", 0) == NULL)
+	if (BUS_ADD_CHILD(parent, UINT_MAX, driver->name, 0) == NULL)
 		panic("Unable to attach xenpv bus.");
 }
 
diff --git a/sys/dev/xen/timer/timer.c b/sys/dev/xen/timer/timer.c
index fb646d8f0536..527259f6720f 100644
--- a/sys/dev/xen/timer/timer.c
+++ b/sys/dev/xen/timer/timer.c
@@ -109,10 +109,10 @@ xentimer_identify(driver_t *driver, device_t parent)
 		return;
 
 	/* Handle all Xen PV timers in one device instance. */
-	if (devclass_get_device(xentimer_devclass, 0))
+	if (devclass_get_device(devclass_find(driver->name), 0))
 		return;
 
-	BUS_ADD_CHILD(parent, 0, "xen_et", 0);
+	BUS_ADD_CHILD(parent, 0, driver->name, 0);
 }
 
 static int