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.

tty: vt: make vtconsole_class constant

Now that the driver core allows for struct class to be in read-only
memory, making all 'class' structures to be declared at build time
placing them into read-only memory, instead of having to be dynamically
allocated at load time.

Cc: Jiri Slaby <jirislaby@kernel.org>
Link: https://lore.kernel.org/r/2023100546-humbly-prologue-e58c@gregkh
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

+9 -10
+9 -10
drivers/tty/vt/vt.c
··· 3571 3571 return 0; 3572 3572 } 3573 3573 3574 - static struct class *vtconsole_class; 3574 + static const struct class vtconsole_class = { 3575 + .name = "vtconsole", 3576 + }; 3575 3577 3576 3578 static int do_bind_con_driver(const struct consw *csw, int first, int last, 3577 3579 int deflt) ··· 4100 4098 goto err; 4101 4099 4102 4100 con_driver->dev = 4103 - device_create_with_groups(vtconsole_class, NULL, 4101 + device_create_with_groups(&vtconsole_class, NULL, 4104 4102 MKDEV(0, con_driver->node), 4105 4103 con_driver, con_dev_groups, 4106 4104 "vtcon%i", con_driver->node); ··· 4181 4179 console_unlock(); 4182 4180 4183 4181 vtconsole_deinit_device(con_driver); 4184 - device_destroy(vtconsole_class, MKDEV(0, con_driver->node)); 4182 + device_destroy(&vtconsole_class, MKDEV(0, con_driver->node)); 4185 4183 4186 4184 console_lock(); 4187 4185 ··· 4242 4240 { 4243 4241 int i; 4244 4242 4245 - vtconsole_class = class_create("vtconsole"); 4246 - if (IS_ERR(vtconsole_class)) { 4247 - pr_warn("Unable to create vt console class; errno = %ld\n", 4248 - PTR_ERR(vtconsole_class)); 4249 - vtconsole_class = NULL; 4250 - } 4243 + i = class_register(&vtconsole_class); 4244 + if (i) 4245 + pr_warn("Unable to create vt console class; errno = %d\n", i); 4251 4246 4252 4247 /* Add system drivers to sysfs */ 4253 4248 for (i = 0; i < MAX_NR_CON_DRIVER; i++) { ··· 4252 4253 4253 4254 if (con->con && !con->dev) { 4254 4255 con->dev = 4255 - device_create_with_groups(vtconsole_class, NULL, 4256 + device_create_with_groups(&vtconsole_class, NULL, 4256 4257 MKDEV(0, con->node), 4257 4258 con, con_dev_groups, 4258 4259 "vtcon%i", con->node);