Lines Matching refs:line
22 struct line *line = chan->line; in line_interrupt() local
24 if (line) in line_interrupt()
25 chan_interrupt(line, irq); in line_interrupt()
35 static unsigned int write_room(struct line *line) in write_room() argument
39 if (line->buffer == NULL) in write_room()
43 n = line->head - line->tail; in write_room()
52 struct line *line = tty->driver_data; in line_write_room() local
56 spin_lock_irqsave(&line->lock, flags); in line_write_room()
57 room = write_room(line); in line_write_room()
58 spin_unlock_irqrestore(&line->lock, flags); in line_write_room()
65 struct line *line = tty->driver_data; in line_chars_in_buffer() local
69 spin_lock_irqsave(&line->lock, flags); in line_chars_in_buffer()
71 ret = LINE_BUFSIZE - (write_room(line) + 1); in line_chars_in_buffer()
72 spin_unlock_irqrestore(&line->lock, flags); in line_chars_in_buffer()
86 static int buffer_data(struct line *line, const char *buf, int len) in buffer_data() argument
90 if (line->buffer == NULL) { in buffer_data()
91 line->buffer = kmalloc(LINE_BUFSIZE, GFP_ATOMIC); in buffer_data()
92 if (line->buffer == NULL) { in buffer_data()
97 line->head = line->buffer; in buffer_data()
98 line->tail = line->buffer; in buffer_data()
101 room = write_room(line); in buffer_data()
104 end = line->buffer + LINE_BUFSIZE - line->tail; in buffer_data()
107 memcpy(line->tail, buf, len); in buffer_data()
108 line->tail += len; in buffer_data()
112 memcpy(line->tail, buf, end); in buffer_data()
114 memcpy(line->buffer, buf, len - end); in buffer_data()
115 line->tail = line->buffer + len - end; in buffer_data()
130 static int flush_buffer(struct line *line) in flush_buffer() argument
134 if ((line->buffer == NULL) || (line->head == line->tail)) in flush_buffer()
137 if (line->tail < line->head) { in flush_buffer()
139 count = line->buffer + LINE_BUFSIZE - line->head; in flush_buffer()
141 n = write_chan(line->chan_out, line->head, count, in flush_buffer()
142 line->write_irq); in flush_buffer()
150 line->head = line->buffer; in flush_buffer()
152 line->head += n; in flush_buffer()
157 count = line->tail - line->head; in flush_buffer()
158 n = write_chan(line->chan_out, line->head, count, in flush_buffer()
159 line->write_irq); in flush_buffer()
164 line->head += n; in flush_buffer()
165 return line->head == line->tail; in flush_buffer()
170 struct line *line = tty->driver_data; in line_flush_buffer() local
173 spin_lock_irqsave(&line->lock, flags); in line_flush_buffer()
174 flush_buffer(line); in line_flush_buffer()
175 spin_unlock_irqrestore(&line->lock, flags); in line_flush_buffer()
189 struct line *line = tty->driver_data; in line_write() local
193 spin_lock_irqsave(&line->lock, flags); in line_write()
194 if (line->head != line->tail) in line_write()
195 ret = buffer_data(line, buf, len); in line_write()
197 n = write_chan(line->chan_out, buf, len, in line_write()
198 line->write_irq); in line_write()
207 ret += buffer_data(line, buf + n, len); in line_write()
210 spin_unlock_irqrestore(&line->lock, flags); in line_write()
216 struct line *line = tty->driver_data; in line_throttle() local
218 deactivate_chan(line->chan_in, line->read_irq); in line_throttle()
219 line->throttled = 1; in line_throttle()
224 struct line *line = tty->driver_data; in line_unthrottle() local
226 line->throttled = 0; in line_unthrottle()
227 chan_interrupt(line, line->read_irq); in line_unthrottle()
233 struct line *line = chan->line; in line_write_interrupt() local
241 spin_lock(&line->lock); in line_write_interrupt()
242 err = flush_buffer(line); in line_write_interrupt()
244 spin_unlock(&line->lock); in line_write_interrupt()
247 line->head = line->buffer; in line_write_interrupt()
248 line->tail = line->buffer; in line_write_interrupt()
250 spin_unlock(&line->lock); in line_write_interrupt()
252 tty_port_tty_wakeup(&line->port); in line_write_interrupt()
257 int line_setup_irq(int fd, int input, int output, struct line *line, void *data) in line_setup_irq() argument
259 const struct line_driver *driver = line->driver; in line_setup_irq()
269 line->read_irq = err; in line_setup_irq()
279 line->write_irq = err; in line_setup_irq()
288 struct line *line = tty->driver_data; in line_activate() local
290 ret = enable_chan(line); in line_activate()
294 if (!line->sigio) { in line_activate()
295 chan_enable_winch(line->chan_out, port); in line_activate()
296 line->sigio = 1; in line_activate()
299 chan_window_size(line, &tty->winsize.ws_row, in line_activate()
310 struct line *line = tty->driver_data; in line_destruct() local
312 if (line->sigio) { in line_destruct()
314 line->sigio = 0; in line_destruct()
325 struct line *line = tty->driver_data; in line_open() local
327 return tty_port_open(&line->port, tty, filp); in line_open()
331 struct line *line) in line_install() argument
339 tty->driver_data = line; in line_install()
346 struct line *line = tty->driver_data; in line_close() local
348 tty_port_close(&line->port, tty, filp); in line_close()
353 struct line *line = tty->driver_data; in line_hangup() local
355 tty_port_hangup(&line->port); in line_hangup()
358 void close_lines(struct line *lines, int nlines) in close_lines()
366 int setup_one_line(struct line *lines, int n, char *init, in setup_one_line()
369 struct line *line = &lines[n]; in setup_one_line() local
370 struct tty_driver *driver = line->driver->driver; in setup_one_line()
373 if (line->port.count) { in setup_one_line()
379 if (line->valid) { in setup_one_line()
380 line->valid = 0; in setup_one_line()
381 kfree(line->init_str); in setup_one_line()
383 parse_chan_pair(NULL, line, n, opts, error_out); in setup_one_line()
392 if (line->valid) { in setup_one_line()
394 kfree(line->init_str); in setup_one_line()
396 line->init_str = new; in setup_one_line()
397 line->valid = 1; in setup_one_line()
398 err = parse_chan_pair(new, line, n, opts, error_out); in setup_one_line()
400 struct device *d = tty_port_register_device(&line->port, in setup_one_line()
405 parse_chan_pair(NULL, line, n, opts, error_out); in setup_one_line()
409 line->init_str = NULL; in setup_one_line()
410 line->valid = 0; in setup_one_line()
458 int line_config(struct line *lines, unsigned int num, char *str, in line_config()
482 int line_get_config(char *name, struct line *lines, unsigned int num, char *str, in line_get_config()
485 struct line *line; in line_get_config() local
500 line = &lines[dev]; in line_get_config()
502 if (!line->valid) in line_get_config()
505 struct tty_struct *tty = tty_port_tty_get(&line->port); in line_get_config()
507 CONFIG_CHUNK(str, size, n, line->init_str, 1); in line_get_config()
509 n = chan_config_string(line, str, size, error_out); in line_get_config()
532 int line_remove(struct line *lines, unsigned int num, int n, char **error_out) in line_remove()
543 struct line *lines, int nlines) in register_lines()
624 struct line *line; in winch_interrupt() local
650 line = tty->driver_data; in winch_interrupt()
651 if (line != NULL) { in winch_interrupt()
652 chan_window_size(line, &tty->winsize.ws_row, in winch_interrupt()