Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 27 Feb 2025 16:55:56 GMT
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: b67839d769dd - stable/14 - stand/kshim: Replace devclass_equal with calls to strcmp
Message-ID:  <202502271655.51RGtuxh017094@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/14 has been updated by jhb:

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

commit b67839d769dd01c854ef4d4b2a5474985d26f3b2
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2025-01-11 04:03:02 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2025-02-27 15:25:39 +0000

    stand/kshim: Replace devclass_equal with calls to strcmp
    
    Reviewed by:    imp, markj, emaste
    Differential Revision:  https://reviews.freebsd.org/D48412
    
    (cherry picked from commit 40d7ba08773751ff7d0df1a3f112b32d1d04e5ec)
---
 stand/kshim/bsd_kernel.c | 27 +++------------------------
 1 file changed, 3 insertions(+), 24 deletions(-)

diff --git a/stand/kshim/bsd_kernel.c b/stand/kshim/bsd_kernel.c
index abe81ccc6c1d..1e3b5d245ca7 100644
--- a/stand/kshim/bsd_kernel.c
+++ b/stand/kshim/bsd_kernel.c
@@ -559,27 +559,6 @@ static TAILQ_HEAD(, module_data) module_head =
 static TAILQ_HEAD(, devclass) devclasses =
     TAILQ_HEAD_INITIALIZER(devclasses);
 
-static uint8_t
-devclass_equal(const char *a, const char *b)
-{
-	char ta, tb;
-
-	if (a == b)
-		return (1);
-
-	while (1) {
-		ta = *a;
-		tb = *b;
-		if (ta != tb)
-			return (0);
-		if (ta == 0)
-			break;
-		a++;
-		b++;
-	}
-	return (1);
-}
-
 int
 bus_generic_resume(device_t dev)
 {
@@ -897,7 +876,7 @@ device_get_method(device_t dev, const char *what)
 
 	mtod = dev->dev_module->driver->methods;
 	while (mtod->func != NULL) {
-		if (devclass_equal(mtod->desc, what)) {
+		if (strcmp(mtod->desc, what) == 0) {
 			return (mtod->func);
 		}
 		mtod++;
@@ -950,7 +929,7 @@ device_probe_and_attach(device_t dev)
 	bus_name_parent = device_get_name(device_get_parent(dev));
 
 	TAILQ_FOREACH(mod, &module_head, entry) {
-		if (!devclass_equal(mod->bus_name, bus_name_parent))
+		if (strcmp(mod->bus_name, bus_name_parent) != 0)
 			continue;
 
 		dc = devclass_find(mod->mod_name);
@@ -1083,7 +1062,7 @@ devclass_find(const char *classname)
 	devclass_t dc;
 
 	TAILQ_FOREACH(dc, &devclasses, link) {
-		if (devclass_equal(dc->name, classname))
+		if (strcmp(dc->name, classname) == 0)
 			return (dc);
 	}
 	return (NULL);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202502271655.51RGtuxh017094>