In a linux device driver, creating sysfs attributes in probe
is way too racy--specifically, it experiences a race condition with userspace. The recommended workaround is to add your attributes to various default attribute groups so they can be automatically created before probe. For a device driver, struct device_driver
contains const struct attribute_group **groups
for this purpose.
However, struct attribute_group
only got a field for binary attributes in Linux 3.11. With older kernels (specifically, 3.4), how should a device driver create sysfs binary attributes before probe?