Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

soundwire: sysfs: Constify static struct attribute_group

The only place sdw_slave_dev_attr_group is used is when its address is
passed to devm_device_add_group() which takes a pointer to const struct
attribute_group. Make it const to allow the compiler to put it in
read-only memory. This makes all attribute_group structs in the file
const. Done with the help of Coccinelle.

Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
Link: https://lore.kernel.org/r/20210117221622.34315-1-rikard.falkeborn@gmail.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>

authored by

Rikard Falkeborn and committed by
Vinod Koul
565e3afa 0cff9911

+1 -1
+1 -1
drivers/soundwire/sysfs_slave.c
··· 130 130 * we don't use ATTRIBUTES_GROUP here since we want to add a subdirectory 131 131 * for device-level properties 132 132 */ 133 - static struct attribute_group sdw_slave_dev_attr_group = { 133 + static const struct attribute_group sdw_slave_dev_attr_group = { 134 134 .attrs = slave_dev_attrs, 135 135 .name = "dev-properties", 136 136 };