Lines Matching refs:line

22 	struct line *line = chan->line;
24 if (line)
25 chan_interrupt(line, irq);
31 * Returns the free space inside the ring buffer of this line.
33 * Should be called while holding line->lock (this does not modify data).
35 static int write_room(struct line *line)
39 if (line->buffer == NULL)
43 n = line->head - line->tail;
52 struct line *line = tty->driver_data;
56 spin_lock_irqsave(&line->lock, flags);
57 room = write_room(line);
58 spin_unlock_irqrestore(&line->lock, flags);
65 struct line *line = tty->driver_data;
69 spin_lock_irqsave(&line->lock, flags);
71 ret = LINE_BUFSIZE - (write_room(line) + 1);
72 spin_unlock_irqrestore(&line->lock, flags);
79 * this line.
84 * Must be called while holding line->lock!
86 static int buffer_data(struct line *line, const char *buf, int len)
90 if (line->buffer == NULL) {
91 line->buffer = kmalloc(LINE_BUFSIZE, GFP_ATOMIC);
92 if (line->buffer == NULL) {
97 line->head = line->buffer;
98 line->tail = line->buffer;
101 room = write_room(line);
104 end = line->buffer + LINE_BUFSIZE - line->tail;
107 memcpy(line->tail, buf, len);
108 line->tail += len;
112 memcpy(line->tail, buf, end);
114 memcpy(line->buffer, buf, len - end);
115 line->tail = line->buffer + len - end;
123 * called, passing it line->head as buffer, and an appropriate count.
129 * Must be called while holding line->lock!*/
130 static int flush_buffer(struct line *line)
134 if ((line->buffer == NULL) || (line->head == line->tail))
137 if (line->tail < line->head) {
138 /* line->buffer + LINE_BUFSIZE is the end of the buffer! */
139 count = line->buffer + LINE_BUFSIZE - line->head;
141 n = write_chan(line->chan_out, line->head, count,
142 line->driver->write_irq);
150 line->head = line->buffer;
152 line->head += n;
157 count = line->tail - line->head;
158 n = write_chan(line->chan_out, line->head, count,
159 line->driver->write_irq);
164 line->head += n;
165 return line->head == line->tail;
170 struct line *line = tty->driver_data;
173 spin_lock_irqsave(&line->lock, flags);
174 flush_buffer(line);
175 spin_unlock_irqrestore(&line->lock, flags);
189 struct line *line = tty->driver_data;
193 spin_lock_irqsave(&line->lock, flags);
194 if (line->head != line->tail)
195 ret = buffer_data(line, buf, len);
197 n = write_chan(line->chan_out, buf, len,
198 line->driver->write_irq);
207 ret += buffer_data(line, buf + n, len);
210 spin_unlock_irqrestore(&line->lock, flags);
221 struct line *line = tty->driver_data;
223 deactivate_chan(line->chan_in, line->driver->read_irq);
224 line->throttled = 1;
229 struct line *line = tty->driver_data;
231 line->throttled = 0;
232 chan_interrupt(line, line->driver->read_irq);
238 struct line *line = chan->line;
246 spin_lock(&line->lock);
247 err = flush_buffer(line);
249 spin_unlock(&line->lock);
252 line->head = line->buffer;
253 line->tail = line->buffer;
255 spin_unlock(&line->lock);
257 tty_port_tty_wakeup(&line->port);
262 int line_setup_irq(int fd, int input, int output, struct line *line, void *data)
264 const struct line_driver *driver = line->driver;
283 struct line *line = tty->driver_data;
285 ret = enable_chan(line);
289 if (!line->sigio) {
290 chan_enable_winch(line->chan_out, port);
291 line->sigio = 1;
294 chan_window_size(line, &tty->winsize.ws_row,
305 struct line *line = tty->driver_data;
307 if (line->sigio) {
309 line->sigio = 0;
320 struct line *line = tty->driver_data;
322 return tty_port_open(&line->port, tty, filp);
326 struct line *line)
334 tty->driver_data = line;
341 struct line *line = tty->driver_data;
343 tty_port_close(&line->port, tty, filp);
348 struct line *line = tty->driver_data;
350 tty_port_hangup(&line->port);
353 void close_lines(struct line *lines, int nlines)
361 int setup_one_line(struct line *lines, int n, char *init,
364 struct line *line = &lines[n];
365 struct tty_driver *driver = line->driver->driver;
368 if (line->port.count) {
374 if (line->valid) {
375 line->valid = 0;
376 kfree(line->init_str);
378 parse_chan_pair(NULL, line, n, opts, error_out);
387 if (line->valid) {
389 kfree(line->init_str);
391 line->init_str = new;
392 line->valid = 1;
393 err = parse_chan_pair(new, line, n, opts, error_out);
395 struct device *d = tty_port_register_device(&line->port,
400 parse_chan_pair(NULL, line, n, opts, error_out);
404 line->init_str = NULL;
405 line->valid = 0;
414 * Common setup code for both startup command line and mconsole initialization.
453 int line_config(struct line *lines, unsigned int num, char *str,
477 int line_get_config(char *name, struct line *lines, unsigned int num, char *str,
480 struct line *line;
495 line = &lines[dev];
497 if (!line->valid)
500 struct tty_struct *tty = tty_port_tty_get(&line->port);
502 CONFIG_CHUNK(str, size, n, line->init_str, 1);
504 n = chan_config_string(line, str, size, error_out);
527 int line_remove(struct line *lines, unsigned int num, int n, char **error_out)
538 struct line *lines, int nlines)
619 struct line *line;
645 line = tty->driver_data;
646 if (line != NULL) {
647 chan_window_size(line, &tty->winsize.ws_row,