From nobody Wed Apr 1 15:10:39 2026 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4fm7j11jg0z6XyDb for ; Wed, 01 Apr 2026 15:10:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R12" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4fm7j06hJ8z3dnP for ; Wed, 01 Apr 2026 15:10:44 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1775056244; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=gT3h1ZI2eoSga2rGbAVqUZHAd7BSjREupkZ2c9+Inx4=; b=nit/k37tO5cwA4+3VuPvjHuxhQRtUCDPxhjR3GTtkjCS1gpw5qsLOglbcL2FBYGwTmmQX7 bTFST0JG+nw5pPLQBuLRm/Co6UcnPEudOYn+qOWzYcOiN2knGuLztkMxcLZCwO/njypleB jrxmclcSUtH368v0T9ceIdwiEkHKqwfIU2ho0MolW1QO+4LZbKpO97tDTCM8bFkVUKC56q /hy5FGNECwStiVnM6q0bbM3wKjdguuffLem+ez+DTSyqPKsNLOxaz323RPMJchxATflY0Z NohviZk3Kf1iTB7lHTp43zQr1+eUwN0zhJwszTDJhB8ZMd1i4kYyAiyzXkzpZg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1775056244; a=rsa-sha256; cv=none; b=qsCwARw2UcJB+nVi5eF+jHdliOsXfkwTerL7UAxNp1alDIv8pKJlwo7ry6emFH89HISe+A spQvOsSeyfdyhU3CHTC3e7NK9WsY8StFbQ5CDXn9BTact6BjEY3TrBC+GXMxY3znKCEkz6 FCWu1Df+Skux6TkA1NpXuWDtLmG7GuYkt/J4Y7Kw6oSlBknGGaHJH+m29vZ5qSKKYJqUM7 0tttX5IhakkEgC8NTS9TOSAHM3X6g8n6kZ2ShYHnSKFG6TPszw/dcVu1vLUR5F8tKLmaBx YvdbJ4x5yMwVDJZtQzPua/tvZ+Z8RFryEI827sIflhGnOYU4vXAMclGZeMRrmQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1775056244; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=gT3h1ZI2eoSga2rGbAVqUZHAd7BSjREupkZ2c9+Inx4=; b=pST6tnhyzkAyaS/CTvlAO6/sgfFlHoSPemgWu3VUULSe3RsuEGxoNvU0TjnlfwdWvA9qua ll+UCN9Np6zGetF1R2LhSZFiMQmDNKLz0FFOjp2PufrL35khl7rbxMuDKo/nMpBSSk7vdC HkE4hGuCLtC8OP7SkmjuqjfwLaC1HsErz8I1b8byPPysTMnmljemPNHbNc7dB2wdpgnYU+ ANSi/oOvaQL+Is5Yfv+MQ8cKGHln91mEYugfDCHi0A3xOMjPCsVCVKPAHhfjgtS2OTQfpj R4tch4P8Y/AwcFEKVz7HYElLInByNvrzbj8zRo+gStYL1+PdyxLiWQDyCfVC1Q== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4fm7j05c3rz4qK for ; Wed, 01 Apr 2026 15:10:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 35c4a by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 01 Apr 2026 15:10:39 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Cc: Jean-=?utf-8?Q?S=C3=A9bast?==?utf-8?Q?ien P=C3=A9?=dron From: Ed Maste Subject: git: 5bb0f6302066 - main - linuxkpi: Handle bin attributes in sysfs attribute groups List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5bb0f63020669bd3675c651ba7745fc4356edc1a Auto-Submitted: auto-generated Date: Wed, 01 Apr 2026 15:10:39 +0000 Message-Id: <69cd356f.35c4a.3eb58a3a@gitrepo.freebsd.org> The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=5bb0f63020669bd3675c651ba7745fc4356edc1a commit 5bb0f63020669bd3675c651ba7745fc4356edc1a Author: Jean-Sébastien Pédron AuthorDate: 2026-02-08 10:11:39 +0000 Commit: Ed Maste CommitDate: 2026-04-01 15:10:12 +0000 linuxkpi: Handle bin attributes in sysfs attribute groups For instance, this is used by DRM drivers to declare the EDID property of an GPU output connector: sysctl -b sys.device.drmn1.card0.card0-DP-1.edid | edid-decode ... Block 0, Base EDID: EDID Structure Version & Revision: 1.4 Vendor & Product Identification: Manufacturer: SAM Model: 29814 Serial Number: 810635354 (0x3051505a) Made in: week 15 of 2025 ... Reviewed by: bz, emaste, wulf Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D55176 --- sys/compat/linuxkpi/common/include/linux/sysfs.h | 34 +++++++++++++++++------- 1 file changed, 25 insertions(+), 9 deletions(-) diff --git a/sys/compat/linuxkpi/common/include/linux/sysfs.h b/sys/compat/linuxkpi/common/include/linux/sysfs.h index 470c224a9778..7c8c4e2e32b9 100644 --- a/sys/compat/linuxkpi/common/include/linux/sysfs.h +++ b/sys/compat/linuxkpi/common/include/linux/sysfs.h @@ -43,13 +43,6 @@ struct sysfs_ops { size_t); }; -struct attribute_group { - const char *name; - mode_t (*is_visible)(struct kobject *, - struct attribute *, int); - struct attribute **attrs; -}; - struct bin_attribute { struct attribute attr; size_t size; @@ -59,6 +52,14 @@ struct bin_attribute { struct bin_attribute *, char *, loff_t, size_t); }; +struct attribute_group { + const char *name; + mode_t (*is_visible)(struct kobject *, + struct attribute *, int); + struct attribute **attrs; + struct bin_attribute **bin_attrs; +}; + #define __ATTR(_name, _mode, _show, _store) { \ .attr = { .name = __stringify(_name), .mode = _mode }, \ .show = _show, .store = _store, \ @@ -370,6 +371,7 @@ static inline int sysfs_create_group(struct kobject *kobj, const struct attribute_group *grp) { struct attribute **attr; + struct bin_attribute **bin_attr; struct sysctl_oid *oidp; /* Don't create the group node if grp->name is undefined. */ @@ -378,11 +380,19 @@ sysfs_create_group(struct kobject *kobj, const struct attribute_group *grp) OID_AUTO, grp->name, CTLFLAG_RD|CTLFLAG_MPSAFE, NULL, grp->name); else oidp = kobj->oidp; - for (attr = grp->attrs; *attr != NULL; attr++) { + for (attr = grp->attrs; attr != NULL && *attr != NULL; attr++) { SYSCTL_ADD_OID(NULL, SYSCTL_CHILDREN(oidp), OID_AUTO, (*attr)->name, CTLTYPE_STRING|CTLFLAG_RW|CTLFLAG_MPSAFE, kobj, (uintptr_t)*attr, sysctl_handle_attr, "A", ""); } + for (bin_attr = grp->bin_attrs; + bin_attr != NULL && *bin_attr != NULL; + bin_attr++) { + SYSCTL_ADD_OID(NULL, SYSCTL_CHILDREN(oidp), OID_AUTO, + (*bin_attr)->attr.name, + CTLTYPE_OPAQUE|CTLFLAG_RW|CTLFLAG_MPSAFE, + kobj, (uintptr_t)*bin_attr, sysctl_handle_bin_attr, "", ""); + } return (0); } @@ -434,14 +444,20 @@ static inline void sysfs_unmerge_group(struct kobject *kobj, const struct attribute_group *grp) { struct attribute **attr; + struct bin_attribute **bin_attr; struct sysctl_oid *oidp; SYSCTL_FOREACH(oidp, SYSCTL_CHILDREN(kobj->oidp)) { if (strcmp(oidp->oid_name, grp->name) != 0) continue; - for (attr = grp->attrs; *attr != NULL; attr++) { + for (attr = grp->attrs; attr != NULL && *attr != NULL; attr++) { sysctl_remove_name(oidp, (*attr)->name, 1, 1); } + for (bin_attr = grp->bin_attrs; + bin_attr != NULL && *bin_attr != NULL; + bin_attr++) { + sysctl_remove_name(oidp, (*bin_attr)->attr.name, 1, 1); + } } }