Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
5f3b8d39
Commit
5f3b8d39
authored
Dec 14, 2020
by
Petr Mladek
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'for-5.11-null-console' into for-linus
parents
b031a684
3cffa06a
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
38 additions
and
19 deletions
+38
-19
drivers/tty/Kconfig
drivers/tty/Kconfig
+0
-14
drivers/tty/Makefile
drivers/tty/Makefile
+1
-2
drivers/tty/ttynull.c
drivers/tty/ttynull.c
+18
-0
include/linux/console.h
include/linux/console.h
+3
-0
init/main.c
init/main.c
+8
-2
kernel/printk/printk.c
kernel/printk/printk.c
+8
-1
No files found.
drivers/tty/Kconfig
View file @
5f3b8d39
...
@@ -428,20 +428,6 @@ config MIPS_EJTAG_FDC_KGDB_CHAN
...
@@ -428,20 +428,6 @@ config MIPS_EJTAG_FDC_KGDB_CHAN
help
help
FDC channel number to use for KGDB.
FDC channel number to use for KGDB.
config NULL_TTY
tristate "NULL TTY driver"
help
Say Y here if you want a NULL TTY which simply discards messages.
This is useful to allow userspace applications which expect a console
device to work without modifications even when no console is
available or desired.
In order to use this driver, you should redirect the console to this
TTY, or boot the kernel with console=ttynull.
If unsure, say N.
config TRACE_ROUTER
config TRACE_ROUTER
tristate "Trace data router for MIPI P1149.7 cJTAG standard"
tristate "Trace data router for MIPI P1149.7 cJTAG standard"
depends on TRACE_SINK
depends on TRACE_SINK
...
...
drivers/tty/Makefile
View file @
5f3b8d39
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
obj-$(CONFIG_TTY)
+=
tty_io.o n_tty.o tty_ioctl.o tty_ldisc.o
\
obj-$(CONFIG_TTY)
+=
tty_io.o n_tty.o tty_ioctl.o tty_ldisc.o
\
tty_buffer.o tty_port.o tty_mutex.o
\
tty_buffer.o tty_port.o tty_mutex.o
\
tty_ldsem.o tty_baudrate.o tty_jobctrl.o
\
tty_ldsem.o tty_baudrate.o tty_jobctrl.o
\
n_null.o
n_null.o
ttynull.o
obj-$(CONFIG_LEGACY_PTYS)
+=
pty.o
obj-$(CONFIG_LEGACY_PTYS)
+=
pty.o
obj-$(CONFIG_UNIX98_PTYS)
+=
pty.o
obj-$(CONFIG_UNIX98_PTYS)
+=
pty.o
obj-$(CONFIG_AUDIT)
+=
tty_audit.o
obj-$(CONFIG_AUDIT)
+=
tty_audit.o
...
@@ -25,7 +25,6 @@ obj-$(CONFIG_ISI) += isicom.o
...
@@ -25,7 +25,6 @@ obj-$(CONFIG_ISI) += isicom.o
obj-$(CONFIG_MOXA_INTELLIO)
+=
moxa.o
obj-$(CONFIG_MOXA_INTELLIO)
+=
moxa.o
obj-$(CONFIG_MOXA_SMARTIO)
+=
mxser.o
obj-$(CONFIG_MOXA_SMARTIO)
+=
mxser.o
obj-$(CONFIG_NOZOMI)
+=
nozomi.o
obj-$(CONFIG_NOZOMI)
+=
nozomi.o
obj-$(CONFIG_NULL_TTY)
+=
ttynull.o
obj-$(CONFIG_ROCKETPORT)
+=
rocket.o
obj-$(CONFIG_ROCKETPORT)
+=
rocket.o
obj-$(CONFIG_SYNCLINK_GT)
+=
synclink_gt.o
obj-$(CONFIG_SYNCLINK_GT)
+=
synclink_gt.o
obj-$(CONFIG_SYNCLINKMP)
+=
synclinkmp.o
obj-$(CONFIG_SYNCLINKMP)
+=
synclinkmp.o
...
...
drivers/tty/ttynull.c
View file @
5f3b8d39
...
@@ -2,6 +2,13 @@
...
@@ -2,6 +2,13 @@
/*
/*
* Copyright (C) 2019 Axis Communications AB
* Copyright (C) 2019 Axis Communications AB
*
*
* The console is useful for userspace applications which expect a console
* device to work without modifications even when no console is available
* or desired.
*
* In order to use this driver, you should redirect the console to this
* TTY, or boot the kernel with console=ttynull.
*
* Based on ttyprintk.c:
* Based on ttyprintk.c:
* Copyright (C) 2010 Samo Pogacnik
* Copyright (C) 2010 Samo Pogacnik
*/
*/
...
@@ -59,6 +66,17 @@ static struct console ttynull_console = {
...
@@ -59,6 +66,17 @@ static struct console ttynull_console = {
.
device
=
ttynull_device
,
.
device
=
ttynull_device
,
};
};
void
__init
register_ttynull_console
(
void
)
{
if
(
!
ttynull_driver
)
return
;
if
(
add_preferred_console
(
ttynull_console
.
name
,
0
,
NULL
))
return
;
register_console
(
&
ttynull_console
);
}
static
int
__init
ttynull_init
(
void
)
static
int
__init
ttynull_init
(
void
)
{
{
struct
tty_driver
*
driver
;
struct
tty_driver
*
driver
;
...
...
include/linux/console.h
View file @
5f3b8d39
...
@@ -187,9 +187,12 @@ extern int braille_register_console(struct console *, int index,
...
@@ -187,9 +187,12 @@ extern int braille_register_console(struct console *, int index,
extern
int
braille_unregister_console
(
struct
console
*
);
extern
int
braille_unregister_console
(
struct
console
*
);
#ifdef CONFIG_TTY
#ifdef CONFIG_TTY
extern
void
console_sysfs_notify
(
void
);
extern
void
console_sysfs_notify
(
void
);
extern
void
register_ttynull_console
(
void
);
#else
#else
static
inline
void
console_sysfs_notify
(
void
)
static
inline
void
console_sysfs_notify
(
void
)
{
}
{
}
static
inline
void
register_ttynull_console
(
void
)
{
}
#endif
#endif
extern
bool
console_suspend_enabled
;
extern
bool
console_suspend_enabled
;
...
...
init/main.c
View file @
5f3b8d39
...
@@ -1480,8 +1480,14 @@ void __init console_on_rootfs(void)
...
@@ -1480,8 +1480,14 @@ void __init console_on_rootfs(void)
struct
file
*
file
=
filp_open
(
"/dev/console"
,
O_RDWR
,
0
);
struct
file
*
file
=
filp_open
(
"/dev/console"
,
O_RDWR
,
0
);
if
(
IS_ERR
(
file
))
{
if
(
IS_ERR
(
file
))
{
pr_err
(
"Warning: unable to open an initial console.
\n
"
);
pr_err
(
"Warning: unable to open an initial console. Fallback to ttynull.
\n
"
);
return
;
register_ttynull_console
();
file
=
filp_open
(
"/dev/console"
,
O_RDWR
,
0
);
if
(
IS_ERR
(
file
))
{
pr_err
(
"Warning: Failed to add ttynull console. No stdin, stdout, and stderr for the init process!
\n
"
);
return
;
}
}
}
init_dup
(
file
);
init_dup
(
file
);
init_dup
(
file
);
init_dup
(
file
);
...
...
kernel/printk/printk.c
View file @
5f3b8d39
...
@@ -2236,8 +2236,15 @@ static int __init console_setup(char *str)
...
@@ -2236,8 +2236,15 @@ static int __init console_setup(char *str)
char
*
s
,
*
options
,
*
brl_options
=
NULL
;
char
*
s
,
*
options
,
*
brl_options
=
NULL
;
int
idx
;
int
idx
;
if
(
str
[
0
]
==
0
)
/*
* console="" or console=null have been suggested as a way to
* disable console output. Use ttynull that has been created
* for exacly this purpose.
*/
if
(
str
[
0
]
==
0
||
strcmp
(
str
,
"null"
)
==
0
)
{
__add_preferred_console
(
"ttynull"
,
0
,
NULL
,
NULL
,
true
);
return
1
;
return
1
;
}
if
(
_braille_console_setup
(
&
str
,
&
brl_options
))
if
(
_braille_console_setup
(
&
str
,
&
brl_options
))
return
1
;
return
1
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment