aboutsummaryrefslogtreecommitdiffstats
path: root/arch/xtensa/platforms/iss/console.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/xtensa/platforms/iss/console.c')
-rw-r--r--arch/xtensa/platforms/iss/console.c22
1 files changed, 8 insertions, 14 deletions
diff --git a/arch/xtensa/platforms/iss/console.c b/arch/xtensa/platforms/iss/console.c
index 2c723e8b30da..f9726f6afdf1 100644
--- a/arch/xtensa/platforms/iss/console.c
+++ b/arch/xtensa/platforms/iss/console.c
@@ -19,7 +19,6 @@
19#include <linux/param.h> 19#include <linux/param.h>
20#include <linux/seq_file.h> 20#include <linux/seq_file.h>
21#include <linux/serial.h> 21#include <linux/serial.h>
22#include <linux/serialP.h>
23 22
24#include <asm/uaccess.h> 23#include <asm/uaccess.h>
25#include <asm/irq.h> 24#include <asm/irq.h>
@@ -37,6 +36,7 @@
37#define SERIAL_TIMER_VALUE (20 * HZ) 36#define SERIAL_TIMER_VALUE (20 * HZ)
38 37
39static struct tty_driver *serial_driver; 38static struct tty_driver *serial_driver;
39static struct tty_port serial_port;
40static struct timer_list serial_timer; 40static struct timer_list serial_timer;
41 41
42static DEFINE_SPINLOCK(timer_lock); 42static DEFINE_SPINLOCK(timer_lock);
@@ -68,17 +68,10 @@ static void rs_poll(unsigned long);
68 68
69static int rs_open(struct tty_struct *tty, struct file * filp) 69static int rs_open(struct tty_struct *tty, struct file * filp)
70{ 70{
71 int line = tty->index; 71 tty->port = &serial_port;
72
73 if ((line < 0) || (line >= SERIAL_MAX_NUM_LINES))
74 return -ENODEV;
75
76 spin_lock(&timer_lock); 72 spin_lock(&timer_lock);
77
78 if (tty->count == 1) { 73 if (tty->count == 1) {
79 init_timer(&serial_timer); 74 setup_timer(&serial_timer, rs_poll, (unsigned long)tty);
80 serial_timer.data = (unsigned long) tty;
81 serial_timer.function = rs_poll;
82 mod_timer(&serial_timer, jiffies + SERIAL_TIMER_VALUE); 75 mod_timer(&serial_timer, jiffies + SERIAL_TIMER_VALUE);
83 } 76 }
84 spin_unlock(&timer_lock); 77 spin_unlock(&timer_lock);
@@ -99,10 +92,10 @@ static int rs_open(struct tty_struct *tty, struct file * filp)
99 */ 92 */
100static void rs_close(struct tty_struct *tty, struct file * filp) 93static void rs_close(struct tty_struct *tty, struct file * filp)
101{ 94{
102 spin_lock(&timer_lock); 95 spin_lock_bh(&timer_lock);
103 if (tty->count == 1) 96 if (tty->count == 1)
104 del_timer_sync(&serial_timer); 97 del_timer_sync(&serial_timer);
105 spin_unlock(&timer_lock); 98 spin_unlock_bh(&timer_lock);
106} 99}
107 100
108 101
@@ -210,13 +203,14 @@ static const struct tty_operations serial_ops = {
210 203
211int __init rs_init(void) 204int __init rs_init(void)
212{ 205{
213 serial_driver = alloc_tty_driver(1); 206 tty_port_init(&serial_port);
207
208 serial_driver = alloc_tty_driver(SERIAL_MAX_NUM_LINES);
214 209
215 printk ("%s %s\n", serial_name, serial_version); 210 printk ("%s %s\n", serial_name, serial_version);
216 211
217 /* Initialize the tty_driver structure */ 212 /* Initialize the tty_driver structure */
218 213
219 serial_driver->owner = THIS_MODULE;
220 serial_driver->driver_name = "iss_serial"; 214 serial_driver->driver_name = "iss_serial";
221 serial_driver->name = "ttyS"; 215 serial_driver->name = "ttyS";
222 serial_driver->major = TTY_MAJOR; 216 serial_driver->major = TTY_MAJOR;