git: 6591a7f69192 - main - iflib: Create led(4) devices

Kevin Bowling <[email protected]>
Newsgroups gmane.os.freebsd.devel.cvs.src
Message-ID <6a7bd664.31a96.738857d8__11806.3946183369$1786500784$gmane$org@gitrepo.freebsd.org>
The branch main has been updated by kbowling:

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

commit 6591a7f6919295f2ec2b463d1ae9554a8bbf6104
Author:     Kevin Bowling <[email protected]>
AuthorDate: 2026-08-12 00:12:51 +0000
Commit:     Kevin Bowling <[email protected]>
CommitDate: 2026-08-12 02:09:01 +0000

    iflib: Create led(4) devices
    
    When a driver implements ifdi_led_func, have the framework create its
    led(4) device after attach completes and the ifnet and context locks are
    released.
    
    PR:             246885
    Reported by:    jlduran
    Reviewed by:    markj
    MFC after:      2 weeks
    Differential Revision:  https://reviews.freebsd.org/D32389
---
 sys/net/iflib.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/sys/net/iflib.c b/sys/net/iflib.c
index f490d7347341..ef2f96c268e5 100644
--- a/sys/net/iflib.c
+++ b/sys/net/iflib.c
@@ -5436,6 +5436,13 @@ iflib_device_register(device_t dev, void *sc, if_shared_ctx_t sctx, if_ctx_t *ct
 	CTX_UNLOCK(ctx);
 	IFNET_WUNLOCK();
 
+	/* Create led(4) devices if the driver defined the method */
+	kobj_desc = &ifdi_led_func_desc;
+	kobj_method = kobj_lookup_method(((kobj_t)ctx)->ops->cls, NULL,
+	    kobj_desc);
+	if (kobj_method != &kobj_desc->deflt)
+		iflib_led_create(ctx);
+
 	return (0);
 
 fail_detach:
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.