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

[S390] kvm: use console_initcall() to initialize s390 virtio console

Use a console_initcall() to initialize the s390 virtio console and
clean up s390 console initialization in setup.c.

Signed-off-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
Tested-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>

authored by

Hendrik Brueckner and committed by
Martin Schwidefsky
c4de0c1a 68d36bdb

+9 -19
-10
arch/s390/include/asm/kvm_virtio.h
··· 54 54 * This is pagesize for historical reasons. */ 55 55 #define KVM_S390_VIRTIO_RING_ALIGN 4096 56 56 57 - #ifdef __KERNEL__ 58 - /* early virtio console setup */ 59 - #ifdef CONFIG_S390_GUEST 60 - extern void s390_virtio_console_init(void); 61 - #else 62 - static inline void s390_virtio_console_init(void) 63 - { 64 - } 65 - #endif /* CONFIG_VIRTIO_CONSOLE */ 66 - #endif /* __KERNEL__ */ 67 57 #endif
+3 -7
arch/s390/kernel/setup.c
··· 156 156 157 157 static void __init set_preferred_console(void) 158 158 { 159 - if (MACHINE_IS_KVM) { 159 + if (MACHINE_IS_KVM) 160 160 add_preferred_console("hvc", 0, NULL); 161 - s390_virtio_console_init(); 162 - return; 163 - } 164 - 165 - if (CONSOLE_IS_3215 || CONSOLE_IS_SCLP) 161 + else if (CONSOLE_IS_3215 || CONSOLE_IS_SCLP) 166 162 add_preferred_console("ttyS", 0, NULL); 167 - if (CONSOLE_IS_3270) 163 + else if (CONSOLE_IS_3270) 168 164 add_preferred_console("tty3270", 0, NULL); 169 165 } 170 166
+6 -2
drivers/s390/kvm/kvm_virtio.c
··· 403 403 return len; 404 404 } 405 405 406 - void __init s390_virtio_console_init(void) 406 + static int __init s390_virtio_console_init(void) 407 407 { 408 - virtio_cons_early_init(early_put_chars); 408 + if (!MACHINE_IS_KVM) 409 + return -ENODEV; 410 + return virtio_cons_early_init(early_put_chars); 409 411 } 412 + console_initcall(s390_virtio_console_init); 413 + 410 414 411 415 /* 412 416 * We do this after core stuff, but before the drivers.