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

ACPI / power: constify attribute_group structures

attribute_groups are not supposed to change at runtime. All functions
working with attribute_groups provided by <linux/sysfs.h> work with const
attribute_group. So mark the non-const structs as const.

File size before:
text data bss dec hex filename
4622 304 8 4934 1346 drivers/acpi/power.o

File size After adding 'const':
text data bss dec hex filename
4846 80 8 4934 1346 drivers/acpi/power.o

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

authored by

Arvind Yadav and committed by
Rafael J. Wysocki
26408b24 b6aeab44

+5 -5
+5 -5
drivers/acpi/power.c
··· 352 352 NULL, 353 353 }; 354 354 355 - static struct attribute_group attr_groups[] = { 355 + static const struct attribute_group attr_groups[] = { 356 356 [ACPI_STATE_D0] = { 357 357 .name = "power_resources_D0", 358 358 .attrs = attrs, ··· 371 371 }, 372 372 }; 373 373 374 - static struct attribute_group wakeup_attr_group = { 374 + static const struct attribute_group wakeup_attr_group = { 375 375 .name = "power_resources_wakeup", 376 376 .attrs = attrs, 377 377 }; 378 378 379 379 static void acpi_power_hide_list(struct acpi_device *adev, 380 380 struct list_head *resources, 381 - struct attribute_group *attr_group) 381 + const struct attribute_group *attr_group) 382 382 { 383 383 struct acpi_power_resource_entry *entry; 384 384 ··· 397 397 398 398 static void acpi_power_expose_list(struct acpi_device *adev, 399 399 struct list_head *resources, 400 - struct attribute_group *attr_group) 400 + const struct attribute_group *attr_group) 401 401 { 402 402 struct acpi_power_resource_entry *entry; 403 403 int ret; ··· 425 425 426 426 static void acpi_power_expose_hide(struct acpi_device *adev, 427 427 struct list_head *resources, 428 - struct attribute_group *attr_group, 428 + const struct attribute_group *attr_group, 429 429 bool expose) 430 430 { 431 431 if (expose)