Lines Matching defs: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 unsigned 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 u8 *buf, size_t 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->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->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->write_irq);
207 ret += buffer_data(line, buf + n, len);
210 spin_unlock_irqrestore(&line->lock, flags);
216 struct line *line = tty->driver_data;
218 deactivate_chan(line->chan_in, line->read_irq);
219 line->throttled = 1;
224 struct line *line = tty->driver_data;
226 line->throttled = 0;
227 chan_interrupt(line, line->read_irq);
233 struct line *line = chan->line;
241 spin_lock(&line->lock);
242 err = flush_buffer(line);
244 spin_unlock(&line->lock);
247 line->head = line->buffer;
248 line->tail = line->buffer;
250 spin_unlock(&line->lock);
252 tty_port_tty_wakeup(&line->port);
257 int line_setup_irq(int fd, int input, int output, struct line *line, void *data)
259 const struct line_driver *driver = line->driver;
269 line->read_irq = err;
279 line->write_irq = err;
288 struct line *line = tty->driver_data;
290 ret = enable_chan(line);
294 if (!line->sigio) {
295 chan_enable_winch(line->chan_out, port);
296 line->sigio = 1;
299 chan_window_size(line, &tty->winsize.ws_row,
310 struct line *line = tty->driver_data;
312 if (line->sigio) {
314 line->sigio = 0;
325 struct line *line = tty->driver_data;
327 return tty_port_open(&line->port, tty, filp);
331 struct line *line)
339 tty->driver_data = line;
346 struct line *line = tty->driver_data;
348 tty_port_close(&line->port, tty, filp);
353 struct line *line = tty->driver_data;
355 tty_port_hangup(&line->port);
358 void close_lines(struct line *lines, int nlines)
366 int setup_one_line(struct line *lines, int n, char *init,
369 struct line *line = &lines[n];
370 struct tty_driver *driver = line->driver->driver;
373 if (line->port.count) {
379 if (line->valid) {
380 line->valid = 0;
381 kfree(line->init_str);
383 parse_chan_pair(NULL, line, n, opts, error_out);
393 if (line->valid) {
395 kfree(line->init_str);
397 line->init_str = new;
398 line->valid = 1;
399 err = parse_chan_pair(new, line, n, opts, error_out);
401 struct device *d = tty_port_register_device(&line->port,
406 parse_chan_pair(NULL, line, n, opts, error_out);
411 line->init_str = NULL;
412 line->valid = 0;
421 * Common setup code for both startup command line and mconsole initialization.
460 int line_config(struct line *lines, unsigned int num, char *str,
484 int line_get_config(char *name, struct line *lines, unsigned int num, char *str,
487 struct line *line;
502 line = &lines[dev];
504 if (!line->valid)
507 struct tty_struct *tty = tty_port_tty_get(&line->port);
509 CONFIG_CHUNK(str, size, n, line->init_str, 1);
511 n = chan_config_string(line, str, size, error_out);
534 int line_remove(struct line *lines, unsigned int num, int n, char **error_out)
545 struct line *lines, int nlines)
626 struct line *line;
655 line = tty->driver_data;
656 if (line != NULL) {
657 chan_window_size(line, &tty->winsize.ws_row,