Skip to contentSkip to conversation

Input: atkbd - constify static struct attribute_group

PATCH New Rikard Falkeborn 1 participant 1 message Jul 28, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Input: atkbd - constify static struct attribute_group

The struct atkbd_attribute_group is only used by passing its address to sysfs_create_group() and sysfs_remove_group(), both which takes pointers to const struct attribute_group. Make it const to allow the compiler to put it in read-only memory.

---
 drivers/input/keyboard/atkbd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/input/keyboard/atkbd.c +1 -1
index fbdef95291e9..c96e4dcb43d8 100644
@@ -335,7 +335,7 @@ static umode_t atkbd_attr_is_visible(struct kobject *kobj,
 	return attr->mode;
 }
 
-static struct attribute_group atkbd_attribute_group = {
+static const struct attribute_group atkbd_attribute_group = {
 	.attrs	= atkbd_attributes,
 	.is_visible = atkbd_attr_is_visible,
 };
Signature · 1 line
2.32.0