aboutsummaryrefslogtreecommitdiffstats
path: root/arch/um/drivers
diff options
context:
space:
mode:
authorJeff Dike <jdike@addtoit.com>2006-01-06 03:18:58 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-01-06 11:33:46 -0500
commite4dcee8099802c71437a15b940f66106d9f88b2f (patch)
treeb4831639d38369fce2e20fd40730425ca702102c /arch/um/drivers
parent9159c9dfffe1746d58b015ceaa3b7b8e99ee9d5c (diff)
[PATCH] uml: Add throttling to console driver
This patch adds support for throttling and unthrottling input when the tty driver can't handle it. Signed-off-by: Jeff Dike <jdike@addtoit.com> Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch/um/drivers')
-rw-r--r--arch/um/drivers/chan_kern.c26
-rw-r--r--arch/um/drivers/line.c29
-rw-r--r--arch/um/drivers/ssl.c14
-rw-r--r--arch/um/drivers/stdio_console.c2
4 files changed, 57 insertions, 14 deletions
diff --git a/arch/um/drivers/chan_kern.c b/arch/um/drivers/chan_kern.c
index 36df55ad64c2..cd13b91b9ff6 100644
--- a/arch/um/drivers/chan_kern.c
+++ b/arch/um/drivers/chan_kern.c
@@ -312,6 +312,32 @@ void close_chan(struct list_head *chans, int delay_free_irq)
312 } 312 }
313} 313}
314 314
315void deactivate_chan(struct list_head *chans, int irq)
316{
317 struct list_head *ele;
318
319 struct chan *chan;
320 list_for_each(ele, chans) {
321 chan = list_entry(ele, struct chan, list);
322
323 if(chan->enabled && chan->input)
324 deactivate_fd(chan->fd, irq);
325 }
326}
327
328void reactivate_chan(struct list_head *chans, int irq)
329{
330 struct list_head *ele;
331 struct chan *chan;
332
333 list_for_each(ele, chans) {
334 chan = list_entry(ele, struct chan, list);
335
336 if(chan->enabled && chan->input)
337 reactivate_fd(chan->fd, irq);
338 }
339}
340
315int write_chan(struct list_head *chans, const char *buf, int len, 341int write_chan(struct list_head *chans, const char *buf, int len,
316 int write_irq) 342 int write_irq)
317{ 343{
diff --git a/arch/um/drivers/line.c b/arch/um/drivers/line.c
index 851a7c8caae5..b8e3e800ee41 100644
--- a/arch/um/drivers/line.c
+++ b/arch/um/drivers/line.c
@@ -36,8 +36,9 @@ static void line_timer_cb(void *arg)
36{ 36{
37 struct line *line = arg; 37 struct line *line = arg;
38 38
39 chan_interrupt(&line->chan_list, &line->task, line->tty, 39 if(!line->throttled)
40 line->driver->read_irq); 40 chan_interrupt(&line->chan_list, &line->task, line->tty,
41 line->driver->read_irq);
41} 42}
42 43
43/* Returns the free space inside the ring buffer of this line. 44/* Returns the free space inside the ring buffer of this line.
@@ -340,6 +341,30 @@ int line_ioctl(struct tty_struct *tty, struct file * file,
340 return ret; 341 return ret;
341} 342}
342 343
344void line_throttle(struct tty_struct *tty)
345{
346 struct line *line = tty->driver_data;
347
348 deactivate_chan(&line->chan_list, line->driver->read_irq);
349 line->throttled = 1;
350}
351
352void line_unthrottle(struct tty_struct *tty)
353{
354 struct line *line = tty->driver_data;
355
356 line->throttled = 0;
357 chan_interrupt(&line->chan_list, &line->task, tty,
358 line->driver->read_irq);
359
360 /* Maybe there is enough stuff pending that calling the interrupt
361 * throttles us again. In this case, line->throttled will be 1
362 * again and we shouldn't turn the interrupt back on.
363 */
364 if(!line->throttled)
365 reactivate_chan(&line->chan_list, line->driver->read_irq);
366}
367
343static irqreturn_t line_write_interrupt(int irq, void *data, 368static irqreturn_t line_write_interrupt(int irq, void *data,
344 struct pt_regs *unused) 369 struct pt_regs *unused)
345{ 370{
diff --git a/arch/um/drivers/ssl.c b/arch/um/drivers/ssl.c
index 6823dc5d665c..a32ef55cb244 100644
--- a/arch/um/drivers/ssl.c
+++ b/arch/um/drivers/ssl.c
@@ -109,16 +109,6 @@ static void ssl_flush_buffer(struct tty_struct *tty)
109 return; 109 return;
110} 110}
111 111
112static void ssl_throttle(struct tty_struct * tty)
113{
114 printk(KERN_ERR "Someone should implement ssl_throttle\n");
115}
116
117static void ssl_unthrottle(struct tty_struct * tty)
118{
119 printk(KERN_ERR "Someone should implement ssl_unthrottle\n");
120}
121
122static void ssl_stop(struct tty_struct *tty) 112static void ssl_stop(struct tty_struct *tty)
123{ 113{
124 printk(KERN_ERR "Someone should implement ssl_stop\n"); 114 printk(KERN_ERR "Someone should implement ssl_stop\n");
@@ -145,9 +135,9 @@ static struct tty_operations ssl_ops = {
145 .flush_chars = line_flush_chars, 135 .flush_chars = line_flush_chars,
146 .set_termios = line_set_termios, 136 .set_termios = line_set_termios,
147 .ioctl = line_ioctl, 137 .ioctl = line_ioctl,
138 .throttle = line_throttle,
139 .unthrottle = line_unthrottle,
148#if 0 140#if 0
149 .throttle = ssl_throttle,
150 .unthrottle = ssl_unthrottle,
151 .stop = ssl_stop, 141 .stop = ssl_stop,
152 .start = ssl_start, 142 .start = ssl_start,
153 .hangup = ssl_hangup, 143 .hangup = ssl_hangup,
diff --git a/arch/um/drivers/stdio_console.c b/arch/um/drivers/stdio_console.c
index 6d4edda9b510..61db8b2fc83f 100644
--- a/arch/um/drivers/stdio_console.c
+++ b/arch/um/drivers/stdio_console.c
@@ -122,6 +122,8 @@ static struct tty_operations console_ops = {
122 .flush_chars = line_flush_chars, 122 .flush_chars = line_flush_chars,
123 .set_termios = line_set_termios, 123 .set_termios = line_set_termios,
124 .ioctl = line_ioctl, 124 .ioctl = line_ioctl,
125 .throttle = line_throttle,
126 .unthrottle = line_unthrottle,
125}; 127};
126 128
127static void uml_console_write(struct console *console, const char *string, 129static void uml_console_write(struct console *console, const char *string,