Commit a3123fd0 authored by Peter Hurley's avatar Peter Hurley Committed by Greg Kroah-Hartman

tty: Fix tty_init_termios() declaration

tty_init_termios() never returns an error; re-declare as void. Remove
unnecessary error handling from callers. Remove extern declarations
of tty_free_termios() and free_tty_struct() and re-declare in file
scope.
Signed-off-by: default avatarPeter Hurley <peter@hurleysoftware.com>
Acked-by: default avatarJohan Hovold <johan@kernel.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent a99cc5d9
...@@ -406,13 +406,8 @@ static int pty_common_install(struct tty_driver *driver, struct tty_struct *tty, ...@@ -406,13 +406,8 @@ static int pty_common_install(struct tty_driver *driver, struct tty_struct *tty,
if (legacy) { if (legacy) {
/* We always use new tty termios data so we can do this /* We always use new tty termios data so we can do this
the easy way .. */ the easy way .. */
retval = tty_init_termios(tty); tty_init_termios(tty);
if (retval) tty_init_termios(o_tty);
goto err_free_tty;
retval = tty_init_termios(o_tty);
if (retval)
goto err_free_termios;
driver->other->ttys[idx] = o_tty; driver->other->ttys[idx] = o_tty;
driver->ttys[idx] = tty; driver->ttys[idx] = tty;
...@@ -444,11 +439,7 @@ static int pty_common_install(struct tty_driver *driver, struct tty_struct *tty, ...@@ -444,11 +439,7 @@ static int pty_common_install(struct tty_driver *driver, struct tty_struct *tty,
tty->count++; tty->count++;
o_tty->count++; o_tty->count++;
return 0; return 0;
err_free_termios:
if (legacy)
tty_free_termios(tty);
err_free_tty:
free_tty_struct(o_tty);
err_put_module: err_put_module:
module_put(driver->other->owner); module_put(driver->other->owner);
err: err:
......
...@@ -168,7 +168,7 @@ static void release_tty(struct tty_struct *tty, int idx); ...@@ -168,7 +168,7 @@ static void release_tty(struct tty_struct *tty, int idx);
* Locking: none. Must be called after tty is definitely unused * Locking: none. Must be called after tty is definitely unused
*/ */
void free_tty_struct(struct tty_struct *tty) static void free_tty_struct(struct tty_struct *tty)
{ {
tty_ldisc_deinit(tty); tty_ldisc_deinit(tty);
put_device(tty->dev); put_device(tty->dev);
...@@ -1377,7 +1377,7 @@ static struct tty_struct *tty_driver_lookup_tty(struct tty_driver *driver, ...@@ -1377,7 +1377,7 @@ static struct tty_struct *tty_driver_lookup_tty(struct tty_driver *driver,
* the tty_mutex currently so we can be relaxed about ordering. * the tty_mutex currently so we can be relaxed about ordering.
*/ */
int tty_init_termios(struct tty_struct *tty) void tty_init_termios(struct tty_struct *tty)
{ {
struct ktermios *tp; struct ktermios *tp;
int idx = tty->index; int idx = tty->index;
...@@ -1395,16 +1395,12 @@ int tty_init_termios(struct tty_struct *tty) ...@@ -1395,16 +1395,12 @@ int tty_init_termios(struct tty_struct *tty)
/* Compatibility until drivers always set this */ /* Compatibility until drivers always set this */
tty->termios.c_ispeed = tty_termios_input_baud_rate(&tty->termios); tty->termios.c_ispeed = tty_termios_input_baud_rate(&tty->termios);
tty->termios.c_ospeed = tty_termios_baud_rate(&tty->termios); tty->termios.c_ospeed = tty_termios_baud_rate(&tty->termios);
return 0;
} }
EXPORT_SYMBOL_GPL(tty_init_termios); EXPORT_SYMBOL_GPL(tty_init_termios);
int tty_standard_install(struct tty_driver *driver, struct tty_struct *tty) int tty_standard_install(struct tty_driver *driver, struct tty_struct *tty)
{ {
int ret = tty_init_termios(tty); tty_init_termios(tty);
if (ret)
return ret;
tty_driver_kref_get(driver); tty_driver_kref_get(driver);
tty->count++; tty->count++;
driver->ttys[tty->index] = tty; driver->ttys[tty->index] = tty;
...@@ -1566,7 +1562,7 @@ struct tty_struct *tty_init_dev(struct tty_driver *driver, int idx) ...@@ -1566,7 +1562,7 @@ struct tty_struct *tty_init_dev(struct tty_driver *driver, int idx)
return ERR_PTR(retval); return ERR_PTR(retval);
} }
void tty_free_termios(struct tty_struct *tty) static void tty_free_termios(struct tty_struct *tty)
{ {
struct ktermios *tp; struct ktermios *tp;
int idx = tty->index; int idx = tty->index;
...@@ -1585,7 +1581,6 @@ void tty_free_termios(struct tty_struct *tty) ...@@ -1585,7 +1581,6 @@ void tty_free_termios(struct tty_struct *tty)
} }
*tp = tty->termios; *tp = tty->termios;
} }
EXPORT_SYMBOL(tty_free_termios);
/** /**
* tty_flush_works - flush all works of a tty/pty pair * tty_flush_works - flush all works of a tty/pty pair
......
...@@ -147,10 +147,7 @@ static int usb_console_setup(struct console *co, char *options) ...@@ -147,10 +147,7 @@ static int usb_console_setup(struct console *co, char *options)
kref_get(&tty->driver->kref); kref_get(&tty->driver->kref);
__module_get(tty->driver->owner); __module_get(tty->driver->owner);
tty->ops = &usb_console_fake_tty_ops; tty->ops = &usb_console_fake_tty_ops;
if (tty_init_termios(tty)) { tty_init_termios(tty);
retval = -ENOMEM;
goto put_tty;
}
tty_port_tty_set(&port->port, tty); tty_port_tty_set(&port->port, tty);
} }
...@@ -185,7 +182,6 @@ static int usb_console_setup(struct console *co, char *options) ...@@ -185,7 +182,6 @@ static int usb_console_setup(struct console *co, char *options)
fail: fail:
tty_port_tty_set(&port->port, NULL); tty_port_tty_set(&port->port, NULL);
put_tty:
tty_kref_put(tty); tty_kref_put(tty);
reset_open_count: reset_open_count:
port->port.count = 0; port->port.count = 0;
......
...@@ -448,7 +448,6 @@ extern int tty_unthrottle_safe(struct tty_struct *tty); ...@@ -448,7 +448,6 @@ extern int tty_unthrottle_safe(struct tty_struct *tty);
extern int tty_do_resize(struct tty_struct *tty, struct winsize *ws); extern int tty_do_resize(struct tty_struct *tty, struct winsize *ws);
extern void tty_driver_remove_tty(struct tty_driver *driver, extern void tty_driver_remove_tty(struct tty_driver *driver,
struct tty_struct *tty); struct tty_struct *tty);
extern void tty_free_termios(struct tty_struct *tty);
extern int is_current_pgrp_orphaned(void); extern int is_current_pgrp_orphaned(void);
extern int is_ignored(int sig); extern int is_ignored(int sig);
extern int tty_signal(int sig, struct tty_struct *tty); extern int tty_signal(int sig, struct tty_struct *tty);
...@@ -508,10 +507,9 @@ extern struct tty_struct *alloc_tty_struct(struct tty_driver *driver, int idx); ...@@ -508,10 +507,9 @@ extern struct tty_struct *alloc_tty_struct(struct tty_driver *driver, int idx);
extern int tty_alloc_file(struct file *file); extern int tty_alloc_file(struct file *file);
extern void tty_add_file(struct tty_struct *tty, struct file *file); extern void tty_add_file(struct tty_struct *tty, struct file *file);
extern void tty_free_file(struct file *file); extern void tty_free_file(struct file *file);
extern void free_tty_struct(struct tty_struct *tty);
extern struct tty_struct *tty_init_dev(struct tty_driver *driver, int idx); extern struct tty_struct *tty_init_dev(struct tty_driver *driver, int idx);
extern int tty_release(struct inode *inode, struct file *filp); extern int tty_release(struct inode *inode, struct file *filp);
extern int tty_init_termios(struct tty_struct *tty); extern void tty_init_termios(struct tty_struct *tty);
extern int tty_standard_install(struct tty_driver *driver, extern int tty_standard_install(struct tty_driver *driver,
struct tty_struct *tty); struct tty_struct *tty);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment