ALSA: Constify static attribute_group structs
cover ALSA: Constify static attribute_group structs
Constify two static attribute_group structs that are never modified. These two were the only static non-const ones in sound/.
Rikard Falkeborn (2):
ALSA: ac97: Constify static struct attribute_group
ALSA: hda: Constify static attribute_group
sound/ac97/bus.c | 2 +- sound/hda/hdac_sysfs.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
Signature · 1 line
2.30.0
PATCH 1/2 ALSA: ac97: Constify static struct attribute_group
The only usage of ac97_adapter_attr_group is to put its address in an array of pointers to const attribute_group structs. Make it const to allow the compiler to put it in read-only memory.
--- sound/ac97/bus.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/ac97/bus.c +1 -1
@@ -273,7 +273,7 @@ static struct attribute *ac97_controller_device_attrs[] = { NULL }; -static struct attribute_group ac97_adapter_attr_group = { +static const struct attribute_group ac97_adapter_attr_group = { .name ="ac97_operations" , .attrs = ac97_controller_device_attrs, };
Signature · 1 line
2.30.0
Takashi Iwai
AppliedRe: [PATCH 1/2] ALSA: ac97: Constify static struct attribute_group
Quoted 6 lines · Rikard Falkeborn
The only usage of
ac97_adapter_attr_groupis to put its address in an array of pointers to constattribute_groupstructs. Make it const to allow the compiler to put it in read-only memory.Signed-off-by Rikard Falkeborn <[email protected]>
Thanks, applied.
Takashi
PATCH 2/2 ALSA: hda: Constify static attribute_group
In reply to Rikard FalkebornThe only usage of hdac_dev_attr_group is to put its address in an array of pointers to const attribute_group structs. Make it const to allow the compiler to put it in read-only memory.
--- sound/hda/hdac_sysfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/hda/hdac_sysfs.c +1 -1
@@ -66,7 +66,7 @@ static struct attribute *hdac_dev_attrs[] = { NULL }; -static struct attribute_group hdac_dev_attr_group = { +static const struct attribute_group hdac_dev_attr_group = { .attrs = hdac_dev_attrs, };
Signature · 1 line
2.30.0
Takashi Iwai
AppliedRe: [PATCH 2/2] ALSA: hda: Constify static attribute_group
Quoted 6 lines · Rikard Falkeborn
The only usage of
hdac_dev_attr_groupis to put its address in an array of pointers to constattribute_groupstructs. Make it const to allow the compiler to put it in read-only memory.Signed-off-by Rikard Falkeborn <[email protected]>
Thanks, applied.
Takashi