Sorry for slow response had long weekend away from all computers!
NAK. The right place to do this is in the call of the macro, not
in the macro itself. See the many examples in hwmon....
static IIO_DEVICE_ATTR(accel_x, .... etc
This makes it explicit in the drivers.
There were a few calls that were missing this in the mainline driver
set but I think they are all fixed in patches that have gone to Greg
for merging. (Michael Hennerich's patch - the second one in the thread
[PATCH] IIO:sysfs.h: Use static declaration.
The first was as per your patch).
iirc there are a few exceptions where the static is in the header
due to the macro defining a pair of static structures. Not sure if
there is a cleaner way to handle that.