chan_kern.c 12.4 KB
Newer Older
1
/*
J
Jeff Dike 已提交
2
 * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{linux.intel,addtoit}.com)
L
Linus Torvalds 已提交
3 4 5 6 7 8
 * Licensed under the GPL
 */

#include <linux/slab.h>
#include <linux/tty.h>
#include <linux/tty_flip.h>
9
#include "chan.h"
10 11
#include <os.h>
#include <irq_kern.h>
L
Linus Torvalds 已提交
12

13
#ifdef CONFIG_NOCONFIG_CHAN
14 15
static void *not_configged_init(char *str, int device,
				const struct chan_opts *opts)
16
{
J
Jeff Dike 已提交
17
	printk(KERN_ERR "Using a channel type which is configured out of "
L
Linus Torvalds 已提交
18
	       "UML\n");
J
Jeff Dike 已提交
19
	return NULL;
L
Linus Torvalds 已提交
20 21 22 23 24
}

static int not_configged_open(int input, int output, int primary, void *data,
			      char **dev_out)
{
J
Jeff Dike 已提交
25
	printk(KERN_ERR "Using a channel type which is configured out of "
L
Linus Torvalds 已提交
26
	       "UML\n");
J
Jeff Dike 已提交
27
	return -ENODEV;
L
Linus Torvalds 已提交
28 29 30 31
}

static void not_configged_close(int fd, void *data)
{
J
Jeff Dike 已提交
32
	printk(KERN_ERR "Using a channel type which is configured out of "
L
Linus Torvalds 已提交
33 34 35 36 37
	       "UML\n");
}

static int not_configged_read(int fd, char *c_out, void *data)
{
J
Jeff Dike 已提交
38
	printk(KERN_ERR "Using a channel type which is configured out of "
L
Linus Torvalds 已提交
39
	       "UML\n");
J
Jeff Dike 已提交
40
	return -EIO;
L
Linus Torvalds 已提交
41 42 43 44
}

static int not_configged_write(int fd, const char *buf, int len, void *data)
{
J
Jeff Dike 已提交
45
	printk(KERN_ERR "Using a channel type which is configured out of "
L
Linus Torvalds 已提交
46
	       "UML\n");
J
Jeff Dike 已提交
47
	return -EIO;
L
Linus Torvalds 已提交
48 49
}

50
static int not_configged_console_write(int fd, const char *buf, int len)
L
Linus Torvalds 已提交
51
{
J
Jeff Dike 已提交
52
	printk(KERN_ERR "Using a channel type which is configured out of "
L
Linus Torvalds 已提交
53
	       "UML\n");
J
Jeff Dike 已提交
54
	return -EIO;
L
Linus Torvalds 已提交
55 56 57 58 59
}

static int not_configged_window_size(int fd, void *data, unsigned short *rows,
				     unsigned short *cols)
{
J
Jeff Dike 已提交
60
	printk(KERN_ERR "Using a channel type which is configured out of "
L
Linus Torvalds 已提交
61
	       "UML\n");
J
Jeff Dike 已提交
62
	return -ENODEV;
L
Linus Torvalds 已提交
63 64 65 66
}

static void not_configged_free(void *data)
{
J
Jeff Dike 已提交
67
	printk(KERN_ERR "Using a channel type which is configured out of "
L
Linus Torvalds 已提交
68 69 70
	       "UML\n");
}

J
Jeff Dike 已提交
71
static const struct chan_ops not_configged_ops = {
L
Linus Torvalds 已提交
72 73 74 75 76 77 78 79 80 81 82 83 84 85
	.init		= not_configged_init,
	.open		= not_configged_open,
	.close		= not_configged_close,
	.read		= not_configged_read,
	.write		= not_configged_write,
	.console_write	= not_configged_console_write,
	.window_size	= not_configged_window_size,
	.free		= not_configged_free,
	.winch		= 0,
};
#endif /* CONFIG_NOCONFIG_CHAN */

static void tty_receive_char(struct tty_struct *tty, char ch)
{
J
Jeff Dike 已提交
86 87
	if (tty == NULL)
		return;
L
Linus Torvalds 已提交
88

J
Jeff Dike 已提交
89 90
	if (I_IXON(tty) && !I_IXOFF(tty) && !tty->raw) {
		if (ch == STOP_CHAR(tty)) {
L
Linus Torvalds 已提交
91 92 93
			stop_tty(tty);
			return;
		}
J
Jeff Dike 已提交
94
		else if (ch == START_CHAR(tty)) {
L
Linus Torvalds 已提交
95 96 97 98 99 100 101 102
			start_tty(tty);
			return;
		}
	}

	tty_insert_flip_char(tty, ch, TTY_NORMAL);
}

J
Jeff Dike 已提交
103
static int open_one_chan(struct chan *chan)
L
Linus Torvalds 已提交
104
{
105
	int fd, err;
L
Linus Torvalds 已提交
106

J
Jeff Dike 已提交
107
	if (chan->opened)
J
Jeff Dike 已提交
108 109
		return 0;

J
Jeff Dike 已提交
110
	if (chan->ops->open == NULL)
J
Jeff Dike 已提交
111 112 113
		fd = 0;
	else fd = (*chan->ops->open)(chan->input, chan->output, chan->primary,
				     chan->data, &chan->dev);
J
Jeff Dike 已提交
114
	if (fd < 0)
J
Jeff Dike 已提交
115
		return fd;
116 117 118 119 120 121 122

	err = os_set_fd_block(fd, 0);
	if (err) {
		(*chan->ops->close)(fd, chan->data);
		return err;
	}

L
Linus Torvalds 已提交
123 124 125
	chan->fd = fd;

	chan->opened = 1;
J
Jeff Dike 已提交
126
	return 0;
L
Linus Torvalds 已提交
127 128
}

W
WANG Cong 已提交
129
static int open_chan(struct list_head *chans)
L
Linus Torvalds 已提交
130 131 132 133 134
{
	struct list_head *ele;
	struct chan *chan;
	int ret, err = 0;

J
Jeff Dike 已提交
135
	list_for_each(ele, chans) {
L
Linus Torvalds 已提交
136
		chan = list_entry(ele, struct chan, list);
J
Jeff Dike 已提交
137
		ret = open_one_chan(chan);
J
Jeff Dike 已提交
138
		if (chan->primary)
J
Jeff Dike 已提交
139
			err = ret;
L
Linus Torvalds 已提交
140
	}
J
Jeff Dike 已提交
141
	return err;
L
Linus Torvalds 已提交
142 143
}

144
void chan_enable_winch(struct chan *chan, struct tty_struct *tty)
L
Linus Torvalds 已提交
145
{
146 147
	if (chan && chan->primary && chan->ops->winch)
		register_winch(chan->fd, tty);
L
Linus Torvalds 已提交
148 149
}

150 151 152
static void line_timer_cb(struct work_struct *work)
{
	struct line *line = container_of(work, struct line, task.work);
J
Jiri Slaby 已提交
153
	struct tty_struct *tty = tty_port_tty_get(&line->port);
154 155

	if (!line->throttled)
J
Jiri Slaby 已提交
156 157
		chan_interrupt(line, tty, line->driver->read_irq);
	tty_kref_put(tty);
158 159
}

160
int enable_chan(struct line *line)
L
Linus Torvalds 已提交
161 162 163
{
	struct list_head *ele;
	struct chan *chan;
164
	int err;
L
Linus Torvalds 已提交
165

166 167
	INIT_DELAYED_WORK(&line->task, line_timer_cb);

J
Jeff Dike 已提交
168
	list_for_each(ele, &line->chan_list) {
L
Linus Torvalds 已提交
169
		chan = list_entry(ele, struct chan, list);
170 171 172 173 174
		err = open_one_chan(chan);
		if (err) {
			if (chan->primary)
				goto out_close;

175
			continue;
176
		}
177

J
Jeff Dike 已提交
178
		if (chan->enabled)
179
			continue;
180 181 182 183 184
		err = line_setup_irq(chan->fd, chan->input, chan->output, line,
				     chan);
		if (err)
			goto out_close;

185 186
		chan->enabled = 1;
	}
187 188 189 190

	return 0;

 out_close:
A
Al Viro 已提交
191
	close_chan(line);
192
	return err;
193 194
}

195 196 197 198 199 200 201
/* Items are added in IRQ context, when free_irq can't be called, and
 * removed in process context, when it can.
 * This handles interrupt sources which disappear, and which need to
 * be permanently disabled.  This is discovered in IRQ context, but
 * the freeing of the IRQ must be done later.
 */
static DEFINE_SPINLOCK(irqs_to_free_lock);
202 203 204 205 206
static LIST_HEAD(irqs_to_free);

void free_irqs(void)
{
	struct chan *chan;
207 208
	LIST_HEAD(list);
	struct list_head *ele;
J
Jeff Dike 已提交
209
	unsigned long flags;
210

J
Jeff Dike 已提交
211
	spin_lock_irqsave(&irqs_to_free_lock, flags);
212
	list_splice_init(&irqs_to_free, &list);
J
Jeff Dike 已提交
213
	spin_unlock_irqrestore(&irqs_to_free_lock, flags);
214

J
Jeff Dike 已提交
215
	list_for_each(ele, &list) {
216
		chan = list_entry(ele, struct chan, free_list);
217

218
		if (chan->input && chan->enabled)
R
Richard Weinberger 已提交
219
			um_free_irq(chan->line->driver->read_irq, chan);
220
		if (chan->output && chan->enabled)
R
Richard Weinberger 已提交
221
			um_free_irq(chan->line->driver->write_irq, chan);
222 223 224 225 226 227
		chan->enabled = 0;
	}
}

static void close_one_chan(struct chan *chan, int delay_free_irq)
{
J
Jeff Dike 已提交
228 229
	unsigned long flags;

J
Jeff Dike 已提交
230
	if (!chan->opened)
231
		return;
L
Linus Torvalds 已提交
232

J
Jeff Dike 已提交
233
	if (delay_free_irq) {
J
Jeff Dike 已提交
234
		spin_lock_irqsave(&irqs_to_free_lock, flags);
235
		list_add(&chan->free_list, &irqs_to_free);
J
Jeff Dike 已提交
236
		spin_unlock_irqrestore(&irqs_to_free_lock, flags);
237 238
	}
	else {
239
		if (chan->input && chan->enabled)
R
Richard Weinberger 已提交
240
			um_free_irq(chan->line->driver->read_irq, chan);
241
		if (chan->output && chan->enabled)
R
Richard Weinberger 已提交
242
			um_free_irq(chan->line->driver->write_irq, chan);
243
		chan->enabled = 0;
L
Linus Torvalds 已提交
244
	}
J
Jeff Dike 已提交
245
	if (chan->ops->close != NULL)
246 247 248 249
		(*chan->ops->close)(chan->fd, chan->data);

	chan->opened = 0;
	chan->fd = -1;
L
Linus Torvalds 已提交
250 251
}

A
Al Viro 已提交
252
void close_chan(struct line *line)
L
Linus Torvalds 已提交
253 254 255 256 257 258 259 260
{
	struct chan *chan;

	/* Close in reverse order as open in case more than one of them
	 * refers to the same device and they save and restore that device's
	 * state.  Then, the first one opened will have the original state,
	 * so it must be the last closed.
	 */
A
Al Viro 已提交
261 262
	list_for_each_entry_reverse(chan, &line->chan_list, list) {
		close_one_chan(chan, 0);
L
Linus Torvalds 已提交
263 264 265
	}
}

266
void deactivate_chan(struct chan *chan, int irq)
267
{
268 269
	if (chan && chan->enabled)
		deactivate_fd(chan->fd, irq);
270 271
}

272
void reactivate_chan(struct chan *chan, int irq)
273
{
274 275
	if (chan && chan->enabled)
		reactivate_fd(chan->fd, irq);
276 277
}

278
int write_chan(struct chan *chan, const char *buf, int len,
L
Linus Torvalds 已提交
279 280 281 282
	       int write_irq)
{
	int n, ret = 0;

283
	if (len == 0 || !chan || !chan->ops->write)
J
Jeff Dike 已提交
284 285
		return 0;

286 287 288 289 290
	n = chan->ops->write(chan->fd, buf, len, chan->data);
	if (chan->primary) {
		ret = n;
		if ((ret == -EAGAIN) || ((ret >= 0) && (ret < len)))
			reactivate_fd(chan->fd, write_irq);
L
Linus Torvalds 已提交
291
	}
J
Jeff Dike 已提交
292
	return ret;
L
Linus Torvalds 已提交
293 294
}

295
int console_write_chan(struct chan *chan, const char *buf, int len)
L
Linus Torvalds 已提交
296 297 298
{
	int n, ret = 0;

299 300
	if (!chan || !chan->ops->console_write)
		return 0;
J
Jeff Dike 已提交
301

302 303 304
	n = chan->ops->console_write(chan->fd, buf, len);
	if (chan->primary)
		ret = n;
J
Jeff Dike 已提交
305
	return ret;
L
Linus Torvalds 已提交
306 307
}

308
int console_open_chan(struct line *line, struct console *co)
L
Linus Torvalds 已提交
309
{
310 311 312
	int err;

	err = open_chan(&line->chan_list);
J
Jeff Dike 已提交
313
	if (err)
314
		return err;
L
Linus Torvalds 已提交
315

J
Jeff Dike 已提交
316 317
	printk(KERN_INFO "Console initialized on /dev/%s%d\n", co->name,
	       co->index);
L
Linus Torvalds 已提交
318 319 320
	return 0;
}

321
int chan_window_size(struct line *line, unsigned short *rows_out,
L
Linus Torvalds 已提交
322 323 324 325
		      unsigned short *cols_out)
{
	struct chan *chan;

326 327 328 329 330 331 332 333 334 335 336 337 338
	chan = line->chan_in;
	if (chan && chan->primary) {
		if (chan->ops->window_size == NULL)
			return 0;
		return chan->ops->window_size(chan->fd, chan->data,
					      rows_out, cols_out);
	}
	chan = line->chan_out;
	if (chan && chan->primary) {
		if (chan->ops->window_size == NULL)
			return 0;
		return chan->ops->window_size(chan->fd, chan->data,
					      rows_out, cols_out);
L
Linus Torvalds 已提交
339
	}
J
Jeff Dike 已提交
340
	return 0;
L
Linus Torvalds 已提交
341 342
}

343
static void free_one_chan(struct chan *chan)
L
Linus Torvalds 已提交
344 345
{
	list_del(&chan->list);
346

347
	close_one_chan(chan, 0);
348

J
Jeff Dike 已提交
349
	if (chan->ops->free != NULL)
L
Linus Torvalds 已提交
350
		(*chan->ops->free)(chan->data);
351

J
Jeff Dike 已提交
352 353
	if (chan->primary && chan->output)
		ignore_sigio_fd(chan->fd);
L
Linus Torvalds 已提交
354 355 356
	kfree(chan);
}

357
static void free_chan(struct list_head *chans)
L
Linus Torvalds 已提交
358 359 360 361
{
	struct list_head *ele, *next;
	struct chan *chan;

J
Jeff Dike 已提交
362
	list_for_each_safe(ele, next, chans) {
L
Linus Torvalds 已提交
363
		chan = list_entry(ele, struct chan, list);
364
		free_one_chan(chan);
L
Linus Torvalds 已提交
365 366 367 368 369 370 371 372
	}
}

static int one_chan_config_string(struct chan *chan, char *str, int size,
				  char **error_out)
{
	int n = 0;

J
Jeff Dike 已提交
373
	if (chan == NULL) {
L
Linus Torvalds 已提交
374
		CONFIG_CHUNK(str, size, n, "none", 1);
J
Jeff Dike 已提交
375
		return n;
L
Linus Torvalds 已提交
376 377 378 379
	}

	CONFIG_CHUNK(str, size, n, chan->ops->type, 0);

J
Jeff Dike 已提交
380
	if (chan->dev == NULL) {
L
Linus Torvalds 已提交
381
		CONFIG_CHUNK(str, size, n, "", 1);
J
Jeff Dike 已提交
382
		return n;
L
Linus Torvalds 已提交
383 384 385 386 387
	}

	CONFIG_CHUNK(str, size, n, ":", 0);
	CONFIG_CHUNK(str, size, n, chan->dev, 0);

J
Jeff Dike 已提交
388
	return n;
L
Linus Torvalds 已提交
389 390
}

J
Jeff Dike 已提交
391
static int chan_pair_config_string(struct chan *in, struct chan *out,
L
Linus Torvalds 已提交
392 393 394 395 396 397 398 399
				   char *str, int size, char **error_out)
{
	int n;

	n = one_chan_config_string(in, str, size, error_out);
	str += n;
	size -= n;

J
Jeff Dike 已提交
400
	if (in == out) {
L
Linus Torvalds 已提交
401
		CONFIG_CHUNK(str, size, n, "", 1);
J
Jeff Dike 已提交
402
		return n;
L
Linus Torvalds 已提交
403 404 405 406 407 408 409 410
	}

	CONFIG_CHUNK(str, size, n, ",", 1);
	n = one_chan_config_string(out, str, size, error_out);
	str += n;
	size -= n;
	CONFIG_CHUNK(str, size, n, "", 1);

J
Jeff Dike 已提交
411
	return n;
L
Linus Torvalds 已提交
412 413
}

414
int chan_config_string(struct line *line, char *str, int size,
L
Linus Torvalds 已提交
415 416
		       char **error_out)
{
417
	struct chan *in = line->chan_in, *out = line->chan_out;
L
Linus Torvalds 已提交
418

419 420 421 422
	if (in && !in->primary)
		in = NULL;
	if (out && !out->primary)
		out = NULL;
L
Linus Torvalds 已提交
423

J
Jeff Dike 已提交
424
	return chan_pair_config_string(in, out, str, size, error_out);
L
Linus Torvalds 已提交
425 426 427 428
}

struct chan_type {
	char *key;
J
Jeff Dike 已提交
429
	const struct chan_ops *ops;
L
Linus Torvalds 已提交
430 431
};

J
Jeff Dike 已提交
432
static const struct chan_type chan_table[] = {
L
Linus Torvalds 已提交
433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467
	{ "fd", &fd_ops },

#ifdef CONFIG_NULL_CHAN
	{ "null", &null_ops },
#else
	{ "null", &not_configged_ops },
#endif

#ifdef CONFIG_PORT_CHAN
	{ "port", &port_ops },
#else
	{ "port", &not_configged_ops },
#endif

#ifdef CONFIG_PTY_CHAN
	{ "pty", &pty_ops },
	{ "pts", &pts_ops },
#else
	{ "pty", &not_configged_ops },
	{ "pts", &not_configged_ops },
#endif

#ifdef CONFIG_TTY_CHAN
	{ "tty", &tty_ops },
#else
	{ "tty", &not_configged_ops },
#endif

#ifdef CONFIG_XTERM_CHAN
	{ "xterm", &xterm_ops },
#else
	{ "xterm", &not_configged_ops },
#endif
};

468
static struct chan *parse_chan(struct line *line, char *str, int device,
469
			       const struct chan_opts *opts, char **error_out)
L
Linus Torvalds 已提交
470
{
J
Jeff Dike 已提交
471 472
	const struct chan_type *entry;
	const struct chan_ops *ops;
L
Linus Torvalds 已提交
473 474 475 476 477 478
	struct chan *chan;
	void *data;
	int i;

	ops = NULL;
	data = NULL;
J
Jeff Dike 已提交
479
	for(i = 0; i < ARRAY_SIZE(chan_table); i++) {
L
Linus Torvalds 已提交
480
		entry = &chan_table[i];
J
Jeff Dike 已提交
481
		if (!strncmp(str, entry->key, strlen(entry->key))) {
L
Linus Torvalds 已提交
482 483 484 485 486
			ops = entry->ops;
			str += strlen(entry->key);
			break;
		}
	}
J
Jeff Dike 已提交
487
	if (ops == NULL) {
488
		*error_out = "No match for configured backends";
J
Jeff Dike 已提交
489
		return NULL;
L
Linus Torvalds 已提交
490
	}
491

L
Linus Torvalds 已提交
492
	data = (*ops->init)(str, device, opts);
J
Jeff Dike 已提交
493
	if (data == NULL) {
494
		*error_out = "Configuration failed";
J
Jeff Dike 已提交
495
		return NULL;
496
	}
L
Linus Torvalds 已提交
497

498
	chan = kmalloc(sizeof(*chan), GFP_ATOMIC);
J
Jeff Dike 已提交
499
	if (chan == NULL) {
500
		*error_out = "Memory allocation failed";
J
Jeff Dike 已提交
501
		return NULL;
502
	}
L
Linus Torvalds 已提交
503
	*chan = ((struct chan) { .list	 	= LIST_HEAD_INIT(chan->list),
504 505 506
				 .free_list 	=
				 	LIST_HEAD_INIT(chan->free_list),
				 .line		= line,
L
Linus Torvalds 已提交
507 508 509 510
				 .primary	= 1,
				 .input		= 0,
				 .output 	= 0,
				 .opened  	= 0,
511
				 .enabled  	= 0,
L
Linus Torvalds 已提交
512 513 514
				 .fd 		= -1,
				 .ops 		= ops,
				 .data 		= data });
J
Jeff Dike 已提交
515
	return chan;
L
Linus Torvalds 已提交
516 517
}

518
int parse_chan_pair(char *str, struct line *line, int device,
519
		    const struct chan_opts *opts, char **error_out)
L
Linus Torvalds 已提交
520
{
521
	struct list_head *chans = &line->chan_list;
R
Richard Weinberger 已提交
522
	struct chan *new;
L
Linus Torvalds 已提交
523 524
	char *in, *out;

J
Jeff Dike 已提交
525
	if (!list_empty(chans)) {
A
Al Viro 已提交
526
		line->chan_in = line->chan_out = NULL;
527
		free_chan(chans);
L
Linus Torvalds 已提交
528 529 530
		INIT_LIST_HEAD(chans);
	}

531 532 533
	if (!str)
		return 0;

L
Linus Torvalds 已提交
534
	out = strchr(str, ',');
J
Jeff Dike 已提交
535
	if (out != NULL) {
L
Linus Torvalds 已提交
536 537 538
		in = str;
		*out = '\0';
		out++;
539
		new = parse_chan(line, in, device, opts, error_out);
J
Jeff Dike 已提交
540
		if (new == NULL)
J
Jeff Dike 已提交
541 542
			return -1;

L
Linus Torvalds 已提交
543 544
		new->input = 1;
		list_add(&new->list, chans);
A
Al Viro 已提交
545
		line->chan_in = new;
L
Linus Torvalds 已提交
546

547
		new = parse_chan(line, out, device, opts, error_out);
J
Jeff Dike 已提交
548
		if (new == NULL)
J
Jeff Dike 已提交
549 550
			return -1;

L
Linus Torvalds 已提交
551 552
		list_add(&new->list, chans);
		new->output = 1;
A
Al Viro 已提交
553
		line->chan_out = new;
L
Linus Torvalds 已提交
554 555
	}
	else {
556
		new = parse_chan(line, str, device, opts, error_out);
J
Jeff Dike 已提交
557
		if (new == NULL)
J
Jeff Dike 已提交
558 559
			return -1;

L
Linus Torvalds 已提交
560 561 562
		list_add(&new->list, chans);
		new->input = 1;
		new->output = 1;
A
Al Viro 已提交
563
		line->chan_in = line->chan_out = new;
L
Linus Torvalds 已提交
564
	}
J
Jeff Dike 已提交
565
	return 0;
L
Linus Torvalds 已提交
566 567
}

568
void chan_interrupt(struct line *line, struct tty_struct *tty, int irq)
L
Linus Torvalds 已提交
569
{
570
	struct chan *chan = line->chan_in;
L
Linus Torvalds 已提交
571 572 573
	int err;
	char c;

574 575 576 577 578
	if (!chan || !chan->ops->read)
		goto out;

	do {
		if (tty && !tty_buffer_request_room(tty, 1)) {
579
			schedule_delayed_work(&line->task, 1);
580 581 582 583 584 585 586 587 588 589 590 591 592
			goto out;
		}
		err = chan->ops->read(chan->fd, &c, chan->data);
		if (err > 0)
			tty_receive_char(tty, c);
	} while (err > 0);

	if (err == 0)
		reactivate_fd(chan->fd, irq);
	if (err == -EIO) {
		if (chan->primary) {
			if (tty != NULL)
				tty_hangup(tty);
A
Al Viro 已提交
593 594
			if (line->chan_out != chan)
				close_one_chan(line->chan_out, 1);
L
Linus Torvalds 已提交
595
		}
A
Al Viro 已提交
596 597 598
		close_one_chan(chan, 1);
		if (chan->primary)
			return;
L
Linus Torvalds 已提交
599 600
	}
 out:
J
Jeff Dike 已提交
601 602
	if (tty)
		tty_flip_buffer_push(tty);
L
Linus Torvalds 已提交
603
}