On Sun, 30 Jun 2024 21:48:00 +0200 Lukas Wunner <lukas@xxxxxxxxx> wrote: > Commit dfa87c824a9a ("sysfs: allow attributes to be added to groups") > introduced dynamic addition of sysfs attributes to groups. > > Allow the same for bin_attributes, in support of a subsequent commit > which adds various bin_attributes every time a PCI device is > authenticated. > > Addition of bin_attributes to groups differs from regular attributes in > that different kernfs_ops are selected by sysfs_add_bin_file_mode_ns() > vis-à-vis sysfs_add_file_mode_ns(). > > So call either of those two functions from sysfs_add_file_to_group() > based on an additional boolean parameter and add two wrapper functions, > one for bin_attributes and another for regular attributes. > > Removal of bin_attributes from groups does not require a differentiation > for bin_attributes and can use the same code path as regular attributes. > > Signed-off-by: Lukas Wunner <lukas@xxxxxxxxx> > Cc: Alan Stern <stern@xxxxxxxxxxxxxxxxxxx> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@xxxxxxxxxx>