aboutsummaryrefslogtreecommitdiffstats
path: root/arch/parisc
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-03-20 14:24:39 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-03-20 14:24:39 -0400
commit843ec558f91b8e8fdb6efc908f2c0506407cc750 (patch)
tree1866dccbc298390fc8686875942324075fd83f9d /arch/parisc
parent71e7ff2578c3bc67fd893a9ba7f69fd563f271de (diff)
parentfb8ebec00b04f921ea1614a7303f1a8e5e9e47c5 (diff)
Merge tag 'tty-3.3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty
Pull TTY/serial patches from Greg KH: "tty and serial merge for 3.4-rc1 Here's the big serial and tty merge for the 3.4-rc1 tree. There's loads of fixes and reworks in here from Jiri for the tty layer, and a number of patches from Alan to help try to wrestle the vt layer into a sane model. Other than that, lots of driver updates and fixes, and other minor stuff, all detailed in the shortlog." * tag 'tty-3.3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty: (132 commits) serial: pxa: add clk_prepare/clk_unprepare calls TTY: Wrong unicode value copied in con_set_unimap() serial: PL011: clear pending interrupts serial: bfin-uart: Don't access tty circular buffer in TX DMA interrupt after it is reset. vt: NULL dereference in vt_do_kdsk_ioctl() tty: serial: vt8500: fix annotations for probe/remove serial: remove back and forth conversions in serial_out_sync serial: use serial_port_in/out vs serial_in/out in 8250 serial: introduce generic port in/out helpers serial: reduce number of indirections in 8250 code serial: delete useless void casts in 8250.c serial: make 8250's serial_in shareable to other drivers. serial: delete last unused traces of pausing I/O in 8250 pch_uart: Add module parameter descriptions pch_uart: Use existing default_baud in setup_console pch_uart: Add user_uartclk parameter pch_uart: Add Fish River Island II uart clock quirks pch_uart: Use uartclk instead of base_baud mpc5200b/uart: select more tolerant uart prescaler on low baudrates tty: moxa: fix bit test in moxa_start() ...
Diffstat (limited to 'arch/parisc')
-rw-r--r--arch/parisc/kernel/pdc_cons.c59
1 files changed, 29 insertions, 30 deletions
diff --git a/arch/parisc/kernel/pdc_cons.c b/arch/parisc/kernel/pdc_cons.c
index fc770be465ff..4f004596a6e7 100644
--- a/arch/parisc/kernel/pdc_cons.c
+++ b/arch/parisc/kernel/pdc_cons.c
@@ -90,11 +90,13 @@ static int pdc_console_setup(struct console *co, char *options)
90 90
91#define PDC_CONS_POLL_DELAY (30 * HZ / 1000) 91#define PDC_CONS_POLL_DELAY (30 * HZ / 1000)
92 92
93static struct timer_list pdc_console_timer; 93static void pdc_console_poll(unsigned long unused);
94static DEFINE_TIMER(pdc_console_timer, pdc_console_poll, 0, 0);
95static struct tty_port tty_port;
94 96
95static int pdc_console_tty_open(struct tty_struct *tty, struct file *filp) 97static int pdc_console_tty_open(struct tty_struct *tty, struct file *filp)
96{ 98{
97 99 tty_port_tty_set(&tty_port, tty);
98 mod_timer(&pdc_console_timer, jiffies + PDC_CONS_POLL_DELAY); 100 mod_timer(&pdc_console_timer, jiffies + PDC_CONS_POLL_DELAY);
99 101
100 return 0; 102 return 0;
@@ -102,8 +104,10 @@ static int pdc_console_tty_open(struct tty_struct *tty, struct file *filp)
102 104
103static void pdc_console_tty_close(struct tty_struct *tty, struct file *filp) 105static void pdc_console_tty_close(struct tty_struct *tty, struct file *filp)
104{ 106{
105 if (!tty->count) 107 if (!tty->count) {
106 del_timer(&pdc_console_timer); 108 del_timer_sync(&pdc_console_timer);
109 tty_port_tty_set(&tty_port, NULL);
110 }
107} 111}
108 112
109static int pdc_console_tty_write(struct tty_struct *tty, const unsigned char *buf, int count) 113static int pdc_console_tty_write(struct tty_struct *tty, const unsigned char *buf, int count)
@@ -122,8 +126,6 @@ static int pdc_console_tty_chars_in_buffer(struct tty_struct *tty)
122 return 0; /* no buffer */ 126 return 0; /* no buffer */
123} 127}
124 128
125static struct tty_driver *pdc_console_tty_driver;
126
127static const struct tty_operations pdc_console_tty_ops = { 129static const struct tty_operations pdc_console_tty_ops = {
128 .open = pdc_console_tty_open, 130 .open = pdc_console_tty_open,
129 .close = pdc_console_tty_close, 131 .close = pdc_console_tty_close,
@@ -134,10 +136,8 @@ static const struct tty_operations pdc_console_tty_ops = {
134 136
135static void pdc_console_poll(unsigned long unused) 137static void pdc_console_poll(unsigned long unused)
136{ 138{
137
138 int data, count = 0; 139 int data, count = 0;
139 140 struct tty_struct *tty = tty_port_tty_get(&tty_port);
140 struct tty_struct *tty = pdc_console_tty_driver->ttys[0];
141 141
142 if (!tty) 142 if (!tty)
143 return; 143 return;
@@ -153,15 +153,17 @@ static void pdc_console_poll(unsigned long unused)
153 if (count) 153 if (count)
154 tty_flip_buffer_push(tty); 154 tty_flip_buffer_push(tty);
155 155
156 if (tty->count && (pdc_cons.flags & CON_ENABLED)) 156 tty_kref_put(tty);
157
158 if (pdc_cons.flags & CON_ENABLED)
157 mod_timer(&pdc_console_timer, jiffies + PDC_CONS_POLL_DELAY); 159 mod_timer(&pdc_console_timer, jiffies + PDC_CONS_POLL_DELAY);
158} 160}
159 161
162static struct tty_driver *pdc_console_tty_driver;
163
160static int __init pdc_console_tty_driver_init(void) 164static int __init pdc_console_tty_driver_init(void)
161{ 165{
162
163 int err; 166 int err;
164 struct tty_driver *drv;
165 167
166 /* Check if the console driver is still registered. 168 /* Check if the console driver is still registered.
167 * It is unregistered if the pdc console was not selected as the 169 * It is unregistered if the pdc console was not selected as the
@@ -183,32 +185,29 @@ static int __init pdc_console_tty_driver_init(void)
183 printk(KERN_INFO "The PDC console driver is still registered, removing CON_BOOT flag\n"); 185 printk(KERN_INFO "The PDC console driver is still registered, removing CON_BOOT flag\n");
184 pdc_cons.flags &= ~CON_BOOT; 186 pdc_cons.flags &= ~CON_BOOT;
185 187
186 drv = alloc_tty_driver(1); 188 tty_port_init(&tty_port);
187 189
188 if (!drv) 190 pdc_console_tty_driver = alloc_tty_driver(1);
189 return -ENOMEM;
190 191
191 drv->driver_name = "pdc_cons"; 192 if (!pdc_console_tty_driver)
192 drv->name = "ttyB"; 193 return -ENOMEM;
193 drv->major = MUX_MAJOR;
194 drv->minor_start = 0;
195 drv->type = TTY_DRIVER_TYPE_SYSTEM;
196 drv->init_termios = tty_std_termios;
197 drv->flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_RESET_TERMIOS;
198 tty_set_operations(drv, &pdc_console_tty_ops);
199 194
200 err = tty_register_driver(drv); 195 pdc_console_tty_driver->driver_name = "pdc_cons";
196 pdc_console_tty_driver->name = "ttyB";
197 pdc_console_tty_driver->major = MUX_MAJOR;
198 pdc_console_tty_driver->minor_start = 0;
199 pdc_console_tty_driver->type = TTY_DRIVER_TYPE_SYSTEM;
200 pdc_console_tty_driver->init_termios = tty_std_termios;
201 pdc_console_tty_driver->flags = TTY_DRIVER_REAL_RAW |
202 TTY_DRIVER_RESET_TERMIOS;
203 tty_set_operations(pdc_console_tty_driver, &pdc_console_tty_ops);
204
205 err = tty_register_driver(pdc_console_tty_driver);
201 if (err) { 206 if (err) {
202 printk(KERN_ERR "Unable to register the PDC console TTY driver\n"); 207 printk(KERN_ERR "Unable to register the PDC console TTY driver\n");
203 return err; 208 return err;
204 } 209 }
205 210
206 pdc_console_tty_driver = drv;
207
208 /* No need to initialize the pdc_console_timer if tty isn't allocated */
209 init_timer(&pdc_console_timer);
210 pdc_console_timer.function = pdc_console_poll;
211
212 return 0; 211 return 0;
213} 212}
214 213