Page MenuHomeFreeBSD

linuxkpi: Handle bin attributes in sysfs attribute groups
Needs ReviewPublic

Authored by dumbbell on Sun, Feb 8, 10:56 AM.
Tags
None
Referenced Files
F145901070: D55176.diff
Wed, Feb 25, 10:43 PM
Unknown Object (File)
Tue, Feb 24, 6:20 AM
Unknown Object (File)
Fri, Feb 20, 7:19 PM
Unknown Object (File)
Fri, Feb 20, 11:38 AM
Unknown Object (File)
Tue, Feb 17, 4:33 PM
Unknown Object (File)
Tue, Feb 17, 3:08 AM
Unknown Object (File)
Mon, Feb 16, 6:18 PM
Unknown Object (File)
Sun, Feb 15, 11:59 PM
Subscribers

Details

Reviewers
None
Group Reviewers
linuxkpi
Summary

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
...

Sponsored by: The FreeBSD Foundation

Diff Detail

Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

Thanks for adding this. I updated my laptop over the weekend, and drm-kmod failed to build with

/home/jrm/scm/freebsd/drm-kmod/drivers/gpu/drm/drm_sysfs.c:300:3: error: field designator 'bin_attrs' does not refer to any field in type 'const struct attribute_group'
  300 |         .bin_attrs = connector_bin_attrs,
      |         ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.

This patch fixes the build error.

I foolishly tried to come up with a patch to fix the build before checking here first. There were a few differences, but I don't really know what I'm doing here.

  1. To match the layout of Linux struct attribute_group, I also added is_bin_visible. It's clearly not required to fix the build, but is that helpful for anything that may initialize is_bin_visible in the future?
  2. Do we need anything in sysfs_remove_group()?

I think this is a minimal, sufficient change. is_bin_visible could be added later if it becomes necessary. I don't think sysfs_remove_group needs anything, in that it doesn't do anything with grp->attrs now, but probably sysfs_unmerge_group does.

sys/compat/linuxkpi/common/include/linux/sysfs.h
449

We're iterating over grp->attrs here, so grp->bin_attrs seems missing.