From patchwork Wed Apr 12 22:37:14 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Pitre X-Patchwork-Id: 97350 Delivered-To: patch@linaro.org Received: by 10.140.109.52 with SMTP id k49csp472106qgf; Wed, 12 Apr 2017 15:38:53 -0700 (PDT) X-Received: by 10.98.163.75 with SMTP id s72mr20309pfe.227.1492036733585; Wed, 12 Apr 2017 15:38:53 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d19si21796746plj.172.2017.04.12.15.38.53; Wed, 12 Apr 2017 15:38:53 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755597AbdDLWig (ORCPT + 16 others); Wed, 12 Apr 2017 18:38:36 -0400 Received: from alt22.smtp-out.videotron.ca ([70.80.0.73]:56588 "EHLO alt22.smtp-out.videotron.ca" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755401AbdDLWiP (ORCPT ); Wed, 12 Apr 2017 18:38:15 -0400 Received: from yoda.home ([96.23.157.65]) by Videotron with SMTP id yQtxcOV8aPTiyyQtycfifO; Wed, 12 Apr 2017 18:38:14 -0400 X-Authority-Analysis: v=2.1 cv=L469O7n8 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=AzvcPWV-tVgA: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 6DA8D2DA05AA; Wed, 12 Apr 2017 18:38:13 -0400 (EDT) From: Nicolas Pitre To: Greg Kroah-Hartman , Jiri Slaby Cc: linux-kernel@vger.kernel.org Subject: [PATCH 1/4] console: move console_init() out of tty_io.c Date: Wed, 12 Apr 2017 18:37:14 -0400 Message-Id: <20170412223717.20890-2-nicolas.pitre@linaro.org> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170412223717.20890-1-nicolas.pitre@linaro.org> References: <20170412223717.20890-1-nicolas.pitre@linaro.org> X-CMAE-Envelope: MS4wfMCkZh5vxePhzO6iYKMbraGHMgOBauwT/cUWuSP33ue8CJgpZB1uEsuhRCMEiV8TpuoSItw2ZcLQlBJeWT7MJLQArzY81sdN+Eq9QuuXo/d7YZV9x0zL lu/ZaL/5fQsh6AObUrd3mDw5I6TX7NvqwtK7NhGympWb6NvvlDH7BK5IVutQlbeQjTw12w7lBLCDUvwpMPzmumcTFAI4JIbR0tq1HsTBkJDLWevgzgKaJ1Yj 0wBWBmzJwx8TTerIi8O7lQ== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. No logical changes from this patch. 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(-) -- 2.9.3 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.