hwmon: (core) Simplify sysfs attribute name allocation
authorGuenter Roeck <linux@roeck-us.net>
Sun, 16 Oct 2016 17:52:04 +0000 (10:52 -0700)
committerGuenter Roeck <linux@roeck-us.net>
Sat, 10 Dec 2016 05:54:24 +0000 (21:54 -0800)
commit3a412d5e4a1c831723d0aaf305f1cf9a78ad9c90
treeae1f9db72cf6eb4fd05de98c9ecc3f042da16001
parent848ba0a2f20dc121a3ef5272a24641d2bd963d8b
hwmon: (core) Simplify sysfs attribute name allocation

Allocating the sysfs attribute name only if needed and only with the
required minimum length looks optimal, but does not take the additional
overhead for both devm_ data structures and the allocation header itself
into account. This also results in unnecessary memory fragmentation.
Move the sysfs name string into struct hwmon_device_attribute and give it
a sufficient length to reduce this overhead.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
drivers/hwmon/hwmon.c