title: My attributes are way too racy, what should I do?
body: <p>In a linux device driver, creating sysfs attributes in <code>probe</code> is way too racy--specifically, <a href="http://kroah.com/log/blog/2013/06/26/how-to-create-a-sysfs-file-correctly/" rel="noreferrer">it experiences a race condition with userspace</a>.  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, <a href="http://lxr.free-electrons.com/source/include/linux/device.h?v=3.4#L214" rel="noreferrer"><code>struct device_driver</code></a> contains <a href="http://lxr.free-electrons.com/source/include/linux/device.h?v=3.4#L230" rel="noreferrer"><code>const struct attribute_group **groups</code></a> for this purpose.</p>
  
  <p>However, <a href="http://lxr.free-electrons.com/source/include/linux/sysfs.h?v=3.4#L56" rel="noreferrer"><code>struct attribute_group</code></a> only got a field for binary attributes <a href="http://lxr.free-electrons.com/source/include/linux/sysfs.h?v=3.11#L59" rel="noreferrer">in Linux 3.11</a>.  With older kernels (specifically, 3.4), how should a device driver create sysfs binary attributes before probe?</p>