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

drivers/tty: make hvc/hvc_vio.c explicitly non-modular

The Kconfig currently controlling compilation of this code is:

drivers/tty/hvc/Kconfig:config HVC_CONSOLE
drivers/tty/hvc/Kconfig: bool "pSeries Hypervisor Virtual Console support"

...meaning that it currently is not being built as a module by anyone.

Lets remove the modular code that is essentially orphaned, so that
when reading the driver there is no doubt it is builtin-only.

Since module_init translates to device_initcall in the non-modular
case, the init ordering remains unchanged with this commit.

We explicitly disallow a driver unbind, since that doesn't have a
sensible use case anyway, and it allows us to drop the ".remove"
code for non-modular drivers.

We don't replace module.h with init.h since the file already has that.

Also note that MODULE_DEVICE_TABLE is a no-op for non-modular code.

Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Jiri Slaby <jslaby@suse.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Anton Blanchard <anton@samba.org>
Cc: linuxppc-dev@lists.ozlabs.org
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Paul Gortmaker and committed by
Greg Kroah-Hartman
e3c5fc4d b3bd6668

+4 -25
+4 -25
drivers/tty/hvc/hvc_vio.c
··· 41 41 #include <linux/delay.h> 42 42 #include <linux/slab.h> 43 43 #include <linux/console.h> 44 - #include <linux/module.h> 45 44 46 45 #include <asm/hvconsole.h> 47 46 #include <asm/vio.h> ··· 60 61 #endif 61 62 { "", "" } 62 63 }; 63 - MODULE_DEVICE_TABLE(vio, hvc_driver_table); 64 64 65 65 typedef enum hv_protocol { 66 66 HV_PROTOCOL_RAW, ··· 361 363 return 0; 362 364 } 363 365 364 - static int hvc_vio_remove(struct vio_dev *vdev) 365 - { 366 - struct hvc_struct *hp = dev_get_drvdata(&vdev->dev); 367 - int rc, termno; 368 - 369 - termno = hp->vtermno; 370 - rc = hvc_remove(hp); 371 - if (rc == 0) { 372 - if (hvterm_privs[termno] != &hvterm_priv0) 373 - kfree(hvterm_privs[termno]); 374 - hvterm_privs[termno] = NULL; 375 - } 376 - return rc; 377 - } 378 - 379 366 static struct vio_driver hvc_vio_driver = { 380 367 .id_table = hvc_driver_table, 381 368 .probe = hvc_vio_probe, 382 - .remove = hvc_vio_remove, 383 369 .name = hvc_driver_name, 370 + .driver = { 371 + .suppress_bind_attrs = true, 372 + }, 384 373 }; 385 374 386 375 static int __init hvc_vio_init(void) ··· 379 394 380 395 return rc; 381 396 } 382 - module_init(hvc_vio_init); /* after drivers/char/hvc_console.c */ 383 - 384 - static void __exit hvc_vio_exit(void) 385 - { 386 - vio_unregister_driver(&hvc_vio_driver); 387 - } 388 - module_exit(hvc_vio_exit); 397 + device_initcall(hvc_vio_init); /* after drivers/tty/hvc/hvc_console.c */ 389 398 390 399 void __init hvc_vio_init_early(void) 391 400 {