On 5/11/22 09:53, Guenter Roeck wrote:
[ ... ]
If this could happen in real life, we cannot rely on a fixed
hwmon_chip_info and attribute_groups at driver registration phase.
You have a point. However, if anything, that means that we might have
to improve/extend the hwmon API to make attributes visible or invisible
dynamically (ie add an API call such as hwmon_update_visibility()
and have it call sysfs_update_groups()).
Actually, adding a new API function isn't even necessary. A call to
sysfs_update_groups(hwdev->groups) (where hwdev is the device pointer
returned by the hwmon registration function) should do.
We could still add an api function for clarity, but all it would do
would be to execute that call. That would be cleaner, but it isn't
technically necessary.
Thanks,
Guenter