diff options
author | Jiri Slaby <jslaby@suse.cz> | 2012-03-05 08:52:01 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-03-08 14:42:21 -0500 |
commit | 410235fd4d20b8feaf8930a0575d23acc088aa87 (patch) | |
tree | ad21d071a29ef0ad400393328ca4ab0588d5b2b7 /arch/xtensa/platforms | |
parent | 44a1bfd95d0a6c0096e79a883197596e1ce83cc3 (diff) |
TTY: remove unneeded tty->index checks
Checking if tty->index is in bounds is not needed. The tty has the
index set in the initial open. This is done in get_tty_driver. And it
can be only in interval <0,driver->num).
So remove the tests which check exactly this interval. Some are
left untouched as they check against the current backing device count.
(Leaving apart that the check is racy in most of the cases.)
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'arch/xtensa/platforms')
-rw-r--r-- | arch/xtensa/platforms/iss/console.c | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/arch/xtensa/platforms/iss/console.c b/arch/xtensa/platforms/iss/console.c index 247e9d40a52e..19a802a13096 100644 --- a/arch/xtensa/platforms/iss/console.c +++ b/arch/xtensa/platforms/iss/console.c | |||
@@ -68,11 +68,6 @@ static void rs_poll(unsigned long); | |||
68 | 68 | ||
69 | static int rs_open(struct tty_struct *tty, struct file * filp) | 69 | static int rs_open(struct tty_struct *tty, struct file * filp) |
70 | { | 70 | { |
71 | int line = tty->index; | ||
72 | |||
73 | if ((line < 0) || (line >= SERIAL_MAX_NUM_LINES)) | ||
74 | return -ENODEV; | ||
75 | |||
76 | spin_lock(&timer_lock); | 71 | spin_lock(&timer_lock); |
77 | 72 | ||
78 | if (tty->count == 1) { | 73 | if (tty->count == 1) { |
@@ -101,6 +96,7 @@ static void rs_close(struct tty_struct *tty, struct file * filp) | |||
101 | { | 96 | { |
102 | spin_lock(&timer_lock); | 97 | spin_lock(&timer_lock); |
103 | if (tty->count == 1) | 98 | if (tty->count == 1) |
99 | /* this will cause a deadlock if the timer ticks right now */ | ||
104 | del_timer_sync(&serial_timer); | 100 | del_timer_sync(&serial_timer); |
105 | spin_unlock(&timer_lock); | 101 | spin_unlock(&timer_lock); |
106 | } | 102 | } |
@@ -210,7 +206,7 @@ static const struct tty_operations serial_ops = { | |||
210 | 206 | ||
211 | int __init rs_init(void) | 207 | int __init rs_init(void) |
212 | { | 208 | { |
213 | serial_driver = alloc_tty_driver(1); | 209 | serial_driver = alloc_tty_driver(SERIAL_MAX_NUM_LINES); |
214 | 210 | ||
215 | printk ("%s %s\n", serial_name, serial_version); | 211 | printk ("%s %s\n", serial_name, serial_version); |
216 | 212 | ||