git: b0094b5b7320 - main - Revert "linuxkpi: Add device under parent, not under class"

From: Bjoern A. Zeeb <bz_at_FreeBSD.org>
Date: Mon, 14 Sep 2026 19:48:17 UTC
The branch main has been updated by bz:

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

commit b0094b5b7320fc40ca581f9ac7c52514ddb5c2cb
Author:     Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2026-09-14 18:51:51 +0000
Commit:     Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2026-09-14 19:06:01 +0000

    Revert "linuxkpi: Add device under parent, not under class"
    
    This reverts commit fc0a5ae094308609927e9c355928d08923278325.
    
    This changed the sysctl node path and broke IB user space tools (ibv_*).
    
    PR:     298485
    Reported by:     Ariel Ehrenberg (aehrenberg nvidia.com)
---
 sys/compat/linuxkpi/common/include/linux/device.h | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/sys/compat/linuxkpi/common/include/linux/device.h b/sys/compat/linuxkpi/common/include/linux/device.h
index a26d07a1e7a3..0d06f4df59c6 100644
--- a/sys/compat/linuxkpi/common/include/linux/device.h
+++ b/sys/compat/linuxkpi/common/include/linux/device.h
@@ -458,10 +458,12 @@ device_add(struct device *dev)
 		if (dev->devt == 0)
 			dev->devt = makedev(0, device_get_unit(dev->bsddev));
 	}
-	if (dev->parent != NULL)
-		kobject_add(&dev->kobj, &dev->parent->kobj, dev_name(dev));
-	else
-		kobject_add(&dev->kobj, &dev->class->kobj, dev_name(dev));
+
+	/*
+	 * Do not change:
+	 * the specific location is used by IB user space tools (PR298485).
+	 */
+	kobject_add(&dev->kobj, &dev->class->kobj, dev_name(dev));
 
 	if (dev->groups)
 		return (sysfs_create_groups(&dev->kobj, dev->groups));