Lines Matching full:cons
877 struct gs_console *cons = req->context; in gs_console_complete_out() local
886 spin_lock(&cons->lock); in gs_console_complete_out()
888 schedule_work(&cons->work); in gs_console_complete_out()
889 spin_unlock(&cons->lock); in gs_console_complete_out()
899 static void __gs_console_push(struct gs_console *cons) in __gs_console_push() argument
901 struct usb_request *req = cons->req; in __gs_console_push()
911 ep = cons->console.data; in __gs_console_push()
912 size = kfifo_out(&cons->buf, req->buf, ep->maxpacket); in __gs_console_push()
916 if (cons->missed && ep->maxpacket >= 64) { in __gs_console_push()
920 len = sprintf(buf, "\n[missed %zu bytes]\n", cons->missed); in __gs_console_push()
921 kfifo_in(&cons->buf, buf, len); in __gs_console_push()
922 cons->missed = 0; in __gs_console_push()
927 spin_unlock_irq(&cons->lock); in __gs_console_push()
930 spin_lock_irq(&cons->lock); in __gs_console_push()
935 struct gs_console *cons = container_of(work, struct gs_console, work); in gs_console_work() local
937 spin_lock_irq(&cons->lock); in gs_console_work()
939 __gs_console_push(cons); in gs_console_work()
941 spin_unlock_irq(&cons->lock); in gs_console_work()
947 struct gs_console *cons = container_of(co, struct gs_console, console); in gs_console_write() local
951 spin_lock_irqsave(&cons->lock, flags); in gs_console_write()
953 n = kfifo_in(&cons->buf, buf, count); in gs_console_write()
955 cons->missed += count - n; in gs_console_write()
957 if (cons->req && !cons->req->length) in gs_console_write()
958 schedule_work(&cons->work); in gs_console_write()
960 spin_unlock_irqrestore(&cons->lock, flags); in gs_console_write()
971 struct gs_console *cons = port->console; in gs_console_connect() local
975 if (!cons) in gs_console_connect()
983 req->context = cons; in gs_console_connect()
986 spin_lock(&cons->lock); in gs_console_connect()
987 cons->req = req; in gs_console_connect()
988 cons->console.data = ep; in gs_console_connect()
989 spin_unlock(&cons->lock); in gs_console_connect()
993 schedule_work(&cons->work); in gs_console_connect()
1000 struct gs_console *cons = port->console; in gs_console_disconnect() local
1004 if (!cons) in gs_console_disconnect()
1007 spin_lock(&cons->lock); in gs_console_disconnect()
1009 req = cons->req; in gs_console_disconnect()
1010 ep = cons->console.data; in gs_console_disconnect()
1011 cons->req = NULL; in gs_console_disconnect()
1013 spin_unlock(&cons->lock); in gs_console_disconnect()
1024 struct gs_console *cons; in gs_console_init() local
1030 cons = kzalloc(sizeof(*port->console), GFP_KERNEL); in gs_console_init()
1031 if (!cons) in gs_console_init()
1034 strcpy(cons->console.name, "ttyGS"); in gs_console_init()
1035 cons->console.write = gs_console_write; in gs_console_init()
1036 cons->console.device = gs_console_device; in gs_console_init()
1037 cons->console.flags = CON_PRINTBUFFER; in gs_console_init()
1038 cons->console.index = port->port_num; in gs_console_init()
1040 INIT_WORK(&cons->work, gs_console_work); in gs_console_init()
1041 spin_lock_init(&cons->lock); in gs_console_init()
1043 err = kfifo_alloc(&cons->buf, GS_CONSOLE_BUF_SIZE, GFP_KERNEL); in gs_console_init()
1046 kfree(cons); in gs_console_init()
1050 port->console = cons; in gs_console_init()
1051 register_console(&cons->console); in gs_console_init()
1063 struct gs_console *cons = port->console; in gs_console_exit() local
1065 if (!cons) in gs_console_exit()
1068 unregister_console(&cons->console); in gs_console_exit()
1071 if (cons->req) in gs_console_exit()
1075 cancel_work_sync(&cons->work); in gs_console_exit()
1076 kfifo_free(&cons->buf); in gs_console_exit()
1077 kfree(cons); in gs_console_exit()