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

Configure Feed

Select the types of activity you want to include in your feed.

virtio_console: Constify some static variables

The id_table and feature_table pointers in struct virtio_driver are
pointers to const. Mark the corresponding static variables const to
allow the compiler to put them in read-only memory.

Before:
text data bss dec hex filename
25447 713 76 26236 667c drivers/char/virtio_console.o

After:
text data bss dec hex filename
25488 673 76 26237 667d drivers/char/virtio_console.o

Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Amit Shah <amit@kernel.org>
Link: https://lore.kernel.org/r/20200701200950.30314-6-rikard.falkeborn@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Rikard Falkeborn and committed by
Greg Kroah-Hartman
8b66c917 729082ed

+4 -4
+4 -4
drivers/char/virtio_console.c
··· 2112 2112 return err; 2113 2113 } 2114 2114 2115 - static struct virtio_device_id id_table[] = { 2115 + static const struct virtio_device_id id_table[] = { 2116 2116 { VIRTIO_ID_CONSOLE, VIRTIO_DEV_ANY_ID }, 2117 2117 { 0 }, 2118 2118 }; 2119 2119 2120 - static unsigned int features[] = { 2120 + static const unsigned int features[] = { 2121 2121 VIRTIO_CONSOLE_F_SIZE, 2122 2122 VIRTIO_CONSOLE_F_MULTIPORT, 2123 2123 }; 2124 2124 2125 - static struct virtio_device_id rproc_serial_id_table[] = { 2125 + static const struct virtio_device_id rproc_serial_id_table[] = { 2126 2126 #if IS_ENABLED(CONFIG_REMOTEPROC) 2127 2127 { VIRTIO_ID_RPROC_SERIAL, VIRTIO_DEV_ANY_ID }, 2128 2128 #endif 2129 2129 { 0 }, 2130 2130 }; 2131 2131 2132 - static unsigned int rproc_serial_features[] = { 2132 + static const unsigned int rproc_serial_features[] = { 2133 2133 }; 2134 2134 2135 2135 #ifdef CONFIG_PM_SLEEP