From patchwork Thu Mar 23 21:03:02 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Pitre X-Patchwork-Id: 9641989 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 07EAC601E9 for ; Thu, 23 Mar 2017 21:04:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ED84528460 for ; Thu, 23 Mar 2017 21:04:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E16192848B; Thu, 23 Mar 2017 21:04:16 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 50A1728460 for ; Thu, 23 Mar 2017 21:04:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=x6HnoWlELB0vk7xOAUVSAzZ0+3BcC1JqWnF/+6yxJIA=; b=Z9C6RC+Hye841o36tjc68hwcsi Lh2H1T4rQHreulwz52nYqcpetlhg0H6r/EVdxVd2NY/NrldTHQx/s6Ug0Sg8NvjEZYp12y7a5LZQY iBcHsRXY4Ac0H+Jl52ba9a1g+rbe92BPq+p9cO+orLVOD9eUoj5+D4tntAInMKLWGmEEd8nvTUQXE jDizDbKZkqWjjZfNtWiNTuTQeB33/+ZVUrKT+5daqefC8tplp3l8IVUuM185T6CqB69QKUlOkZAVh WuHON1/HqPw/Rq5Jw6rujXInafFJwAJINVCKP9Wq65jUHUl1giqtpaMGrH6w3/z1mvfUTuxItaInc 8R6n0Dbg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cr9u3-0004N9-WE; Thu, 23 Mar 2017 21:04:16 +0000 Received: from alt22.smtp-out.videotron.ca ([70.80.0.73]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cr9tN-0003jW-CZ for linux-arm-kernel@lists.infradead.org; Thu, 23 Mar 2017 21:03:38 +0000 Received: from yoda.home ([96.23.157.65]) by Videotron with SMTP id r9sxcF56UzCgpr9sycTpi5; Thu, 23 Mar 2017 17:03:10 -0400 X-Authority-Analysis: v=2.1 cv=QfzGxpvv c=1 sm=1 tr=0 a=keA3yYpnlypCNW5BNWqu+w==:117 a=keA3yYpnlypCNW5BNWqu+w==:17 a=L9H7d07YOLsA:10 a=9cW_t1CCXrUA:10 a=s5jvgZ67dGcA:10 a=6Iz7jQTuP9IA:10 a=KKAkSRfTAAAA:8 a=Uzn0aNsXRxZ8utFiinYA:9 a=cvBusfyB2V15izCimMoJ:22 Received: from xanadu.home (xanadu.home [192.168.2.2]) by yoda.home (Postfix) with ESMTP id 10BB72DA0696; Thu, 23 Mar 2017 17:03:07 -0400 (EDT) From: Nicolas Pitre To: Greg Kroah-Hartman , Jiri Slaby Subject: [PATCH 1/3] console: move console_init() out of tty_io.c Date: Thu, 23 Mar 2017 17:03:02 -0400 Message-Id: <20170323210304.2181-2-nicolas.pitre@linaro.org> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170323210304.2181-1-nicolas.pitre@linaro.org> References: <20170323210304.2181-1-nicolas.pitre@linaro.org> X-CMAE-Envelope: MS4wfP2cKH/xxNP01IIaur1PiHs0KkCdVJt4mJOTZsp984H0SsnxOPlFMqE6qi/oQ67hDiglh1NY7UxzNsSnTP2sPs2RbikFfWRaWcrTJJkHEhZeR84XXcZW /tjNXRML6UYk2KW2cB2B1fjiI1ENjGgbrEr0pE9Ajqj4A3POYDot8wlTm98z/OMla1mylyvjMhtbffBfMzs9NBrDiP87FbbfwbVqezkwohtQ/shn2GE7Bmmd rDxbeoTgbvlaDisyPTGhbDeuLbXvUKWUuGmqQ4BeGR4RxziVIvITIqNQSVrtS30YdGXjDt5MvVa0dLA2Ok5N2z1GEqbPnzhi8McwD+Isu/0= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170323_140333_523565_4A61A6A1 X-CRM114-Status: GOOD ( 16.91 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Russell King , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP All the console driver handling code lives in printk.c. Move console_init() there as well so console support can still be used when the TTY code is configured out. Signed-off-by: Nicolas Pitre --- drivers/tty/tty_io.c | 24 ------------------------ include/linux/console.h | 2 ++ include/linux/tty.h | 7 ++++--- init/main.c | 2 +- kernel/printk/printk.c | 24 ++++++++++++++++++++++++ 5 files changed, 31 insertions(+), 28 deletions(-) diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c index e6d1a65108..2100295861 100644 --- a/drivers/tty/tty_io.c +++ b/drivers/tty/tty_io.c @@ -3578,30 +3578,6 @@ void tty_default_fops(struct file_operations *fops) *fops = tty_fops; } -/* - * Initialize the console device. This is called *early*, so - * we can't necessarily depend on lots of kernel help here. - * Just do some early initializations, and do the complex setup - * later. - */ -void __init console_init(void) -{ - initcall_t *call; - - /* Setup the default TTY line discipline. */ - n_tty_init(); - - /* - * set up the console device so that later boot sequences can - * inform about problems etc.. - */ - call = __con_initcall_start; - while (call < __con_initcall_end) { - (*call)(); - call++; - } -} - static char *tty_devnode(struct device *dev, umode_t *mode) { if (!mode) diff --git a/include/linux/console.h b/include/linux/console.h index 5949d18555..b8920a031a 100644 --- a/include/linux/console.h +++ b/include/linux/console.h @@ -212,4 +212,6 @@ extern bool vgacon_text_force(void); static inline bool vgacon_text_force(void) { return false; } #endif +extern void console_init(void); + #endif /* _LINUX_CONSOLE_H */ diff --git a/include/linux/tty.h b/include/linux/tty.h index 1017e904c0..f1106d7c73 100644 --- a/include/linux/tty.h +++ b/include/linux/tty.h @@ -390,7 +390,6 @@ static inline bool tty_throttled(struct tty_struct *tty) } #ifdef CONFIG_TTY -extern void console_init(void); extern void tty_kref_put(struct tty_struct *tty); extern struct pid *tty_get_pgrp(struct tty_struct *tty); extern void tty_vhangup_self(void); @@ -402,8 +401,6 @@ extern struct tty_struct *get_current_tty(void); extern int __init tty_init(void); extern const char *tty_name(const struct tty_struct *tty); #else -static inline void console_init(void) -{ } static inline void tty_kref_put(struct tty_struct *tty) { } static inline struct pid *tty_get_pgrp(struct tty_struct *tty) @@ -669,7 +666,11 @@ extern int tty_ldisc_receive_buf(struct tty_ldisc *ld, const unsigned char *p, /* n_tty.c */ extern void n_tty_inherit_ops(struct tty_ldisc_ops *ops); +#ifdef CONFIG_TTY extern void __init n_tty_init(void); +#else +static inline void n_tty_init(void) { } +#endif /* tty_audit.c */ #ifdef CONFIG_AUDIT diff --git a/init/main.c b/init/main.c index f9c9d99482..b9bd0edf21 100644 --- a/init/main.c +++ b/init/main.c @@ -27,7 +27,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c index 2984fb0f02..3a09406526 100644 --- a/kernel/printk/printk.c +++ b/kernel/printk/printk.c @@ -2611,6 +2611,30 @@ int unregister_console(struct console *console) EXPORT_SYMBOL(unregister_console); /* + * Initialize the console device. This is called *early*, so + * we can't necessarily depend on lots of kernel help here. + * Just do some early initializations, and do the complex setup + * later. + */ +void __init console_init(void) +{ + initcall_t *call; + + /* Setup the default TTY line discipline. */ + n_tty_init(); + + /* + * set up the console device so that later boot sequences can + * inform about problems etc.. + */ + call = __con_initcall_start; + while (call < __con_initcall_end) { + (*call)(); + call++; + } +} + +/* * Some boot consoles access data that is in the init section and which will * be discarded after the initcalls have been run. To make sure that no code * will access this data, unregister the boot consoles in a late initcall.