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

staging: fieldbus: make fieldbus_class constant

Since commit 43a7206b0963 ("driver core: class: make class_register() take
a const *"), the driver core allows for struct class to be in read-only
memory, so move the fieldbus_class structure to be declared at build time
placing it into read-only memory, instead of having to be dynamically
allocated at boot time.

Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: "Ricardo B. Marliere" <ricardo@marliere.net>
Link: https://lore.kernel.org/r/20240301-class_cleanup-staging-v1-1-34db2a5b0eb0@marliere.net
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Ricardo B. Marliere and committed by
Greg Kroah-Hartman
1defb6b7 78152cba

+1 -1
+1 -1
drivers/staging/fieldbus/dev_core.c
··· 152 152 }; 153 153 __ATTRIBUTE_GROUPS(fieldbus); 154 154 155 - static struct class fieldbus_class = { 155 + static const struct class fieldbus_class = { 156 156 .name = "fieldbus_dev", 157 157 .dev_groups = fieldbus_groups, 158 158 };