Lines Matching refs:port
44 * @port: tty port owning the flip buffer
52 void tty_buffer_lock_exclusive(struct tty_port *port)
54 struct tty_bufhead *buf = &port->buf;
63 * @port: tty port owning the flip buffer
69 void tty_buffer_unlock_exclusive(struct tty_port *port)
71 struct tty_bufhead *buf = &port->buf;
85 * @port: tty port owning the flip buffer
94 unsigned int tty_buffer_space_avail(struct tty_port *port)
96 int space = port->buf.mem_limit - atomic_read(&port->buf.mem_used);
115 * @port: tty port to free from
120 void tty_buffer_free_all(struct tty_port *port)
122 struct tty_bufhead *buf = &port->buf;
149 * @port: tty port
159 static struct tty_buffer *tty_buffer_alloc(struct tty_port *port, size_t size)
168 free = llist_del_first(&port->buf.free);
178 if (atomic_read(&port->buf.mem_used) > port->buf.mem_limit)
186 atomic_add(size, &port->buf.mem_used);
192 * @port: tty port owning the buffer
198 static void tty_buffer_free(struct tty_port *port, struct tty_buffer *b)
200 struct tty_bufhead *buf = &port->buf;
223 struct tty_port *port = tty->port;
224 struct tty_bufhead *buf = &port->buf;
234 tty_buffer_free(port, buf->head);
249 * @port: tty port
261 static int __tty_buffer_request_room(struct tty_port *port, size_t size,
264 struct tty_bufhead *buf = &port->buf;
273 n = tty_buffer_alloc(port, size);
294 int tty_buffer_request_room(struct tty_port *port, size_t size)
296 return __tty_buffer_request_room(port, size, true);
300 size_t __tty_insert_flip_string_flags(struct tty_port *port, const u8 *chars,
309 size_t space = __tty_buffer_request_room(port, goal, need_flags);
310 struct tty_buffer *tb = port->buf.tail;
342 * @port: tty port
354 size_t tty_prepare_flip_string(struct tty_port *port, u8 **chars, size_t size)
356 size_t space = __tty_buffer_request_room(port, size, false);
359 struct tty_buffer *tb = port->buf.tail;
397 static void lookahead_bufs(struct tty_port *port, struct tty_buffer *head)
421 if (port->client_ops->lookahead_buf) {
428 port->client_ops->lookahead_buf(port, p, f, count);
436 receive_buf(struct tty_port *port, struct tty_buffer *head, size_t count)
445 n = port->client_ops->receive_buf(port, p, f, count);
464 struct tty_port *port = container_of(work, struct tty_port, buf.work);
465 struct tty_bufhead *buf = &port->buf;
491 tty_buffer_free(port, head);
495 rcvd = receive_buf(port, head, count);
498 lookahead_bufs(port, head);
521 * @port: tty port to push
529 void tty_flip_buffer_push(struct tty_port *port)
531 struct tty_bufhead *buf = &port->buf;
541 * @port: tty port
546 * with the exception of properly holding the @port->lock.
552 int tty_insert_flip_string_and_push_buffer(struct tty_port *port,
555 struct tty_bufhead *buf = &port->buf;
558 spin_lock_irqsave(&port->lock, flags);
559 size = tty_insert_flip_string(port, chars, size);
562 spin_unlock_irqrestore(&port->lock, flags);
571 * @port: tty port to initialise
576 void tty_buffer_init(struct tty_port *port)
578 struct tty_bufhead *buf = &port->buf;
593 * @port: tty port to change
600 int tty_buffer_set_limit(struct tty_port *port, int limit)
604 port->buf.mem_limit = limit;
610 void tty_buffer_set_lock_subclass(struct tty_port *port)
612 lockdep_set_subclass(&port->buf.lock, TTY_LOCK_SLAVE);
615 bool tty_buffer_restart_work(struct tty_port *port)
617 return queue_work(system_unbound_wq, &port->buf.work);
620 bool tty_buffer_cancel_work(struct tty_port *port)
622 return cancel_work_sync(&port->buf.work);
625 void tty_buffer_flush_work(struct tty_port *port)
627 flush_work(&port->buf.work);