* [v2,5/5] usb: gadget: u_serial: diagnose missed console messages
@ 2019-02-27 9:36 Greg Kroah-Hartman
0 siblings, 0 replies; 2+ messages in thread
From: Greg Kroah-Hartman @ 2019-02-27 9:36 UTC (permalink / raw)
To: Michał Mirosław; +Cc: linux-usb, Felipe Balbi
On Wed, Feb 27, 2019 at 10:29:39AM +0100, Michał Mirosław wrote:
> Insert markers in console stream marking places where data
> is missing. This makes the hole in the data stand out clearly
> instead of glueing together unrelated messages.
>
> Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
> ---
> v2: commit message massage
Provide an example of that what "marker" looks like in the commit log
text? That would be nice to see...
thanks,
greg k-h
^ permalink raw reply [flat|nested] 2+ messages in thread
* [v2,5/5] usb: gadget: u_serial: diagnose missed console messages
@ 2019-02-27 9:29 Michał Mirosław
0 siblings, 0 replies; 2+ messages in thread
From: Michał Mirosław @ 2019-02-27 9:29 UTC (permalink / raw)
To: linux-usb; +Cc: Felipe Balbi, Greg Kroah-Hartman
Insert markers in console stream marking places where data
is missing. This makes the hole in the data stand out clearly
instead of glueing together unrelated messages.
Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
---
v2: commit message massage
---
drivers/usb/gadget/function/u_serial.c | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/drivers/usb/gadget/function/u_serial.c b/drivers/usb/gadget/function/u_serial.c
index 604e187fadb7..66518aba58c2 100644
--- a/drivers/usb/gadget/function/u_serial.c
+++ b/drivers/usb/gadget/function/u_serial.c
@@ -88,6 +88,7 @@ struct gs_console {
spinlock_t lock;
struct usb_request *req;
struct kfifo buf;
+ size_t missed;
};
/*
@@ -930,6 +931,15 @@ static void __gs_console_push(struct gs_console *cons)
if (!size)
return;
+ if (cons->missed && ep->maxpacket >= 64) {
+ char buf[64];
+ size_t len;
+
+ len = sprintf(buf, "\n[MISSED %zu bytes]\n", cons->missed);
+ kfifo_in(&cons->buf, buf, len);
+ cons->missed = 0;
+ }
+
req->length = size;
if (usb_ep_queue(ep, req, GFP_ATOMIC))
req->length = 0;
@@ -951,10 +961,13 @@ static void gs_console_write(struct console *co,
{
struct gs_console *cons = container_of(co, struct gs_console, console);
unsigned long flags;
+ size_t n;
spin_lock_irqsave(&cons->lock, flags);
- kfifo_in(&cons->buf, buf, count);
+ n = kfifo_in(&cons->buf, buf, count);
+ if (n < count)
+ cons->missed += count - n;
if (cons->req && !cons->req->length)
schedule_work(&cons->work);
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-02-27 9:36 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-02-27 9:36 [v2,5/5] usb: gadget: u_serial: diagnose missed console messages Greg Kroah-Hartman
-- strict thread matches above, loose matches on Subject: below --
2019-02-27 9:29 Michał Mirosław
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.