From 5b9ec5081492b461710cb82e7ecc93fd3af8ad34 Mon Sep 17 00:00:00 2001 From: Jae Hyun Yoo Date: Mon, 18 Mar 2019 14:06:36 -0700 Subject: [PATCH] Suppress excessive HID gadget error logs HID events can be sent even when the host disconnects the HID device according to the current graphic mode. For an example, if KVM mouse events are sent when the host is in text mode, queueing of end point messages will be dropped with this message: configfs-gadget gadget: usb_ep_queue error on int endpoint -108 This case is very usual case in BMC since BMC can control power status of the host, so this commit suppress the error printing outs with making HID gadget driver drop events quietly in the case. This should be a downstream only customization. Do not upstream it. Signed-off-by: Jae Hyun Yoo --- drivers/usb/gadget/function/f_hid.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/usb/gadget/function/f_hid.c b/drivers/usb/gadget/function/f_hid.c index f3816a5c861e..c96c0f6f1df0 100644 --- a/drivers/usb/gadget/function/f_hid.c +++ b/drivers/usb/gadget/function/f_hid.c @@ -320,7 +320,7 @@ static void f_hidg_req_complete(struct usb_ep *ep, struct usb_request *req) struct f_hidg *hidg = (struct f_hidg *)ep->driver_data; unsigned long flags; - if (req->status != 0) { + if (req->status != 0 && req->status != -ESHUTDOWN) { ERROR(hidg->func.config->cdev, "End Point Request ERROR: %d\n", req->status); } @@ -395,8 +395,10 @@ static ssize_t f_hidg_write(struct file *file, const char __user *buffer, status = usb_ep_queue(hidg->in_ep, req, GFP_ATOMIC); if (status < 0) { - ERROR(hidg->func.config->cdev, - "usb_ep_queue error on int endpoint %zd\n", status); + if (status != -ESHUTDOWN) + ERROR(hidg->func.config->cdev, + "usb_ep_queue error on int endpoint %zd\n", + status); goto release_write_pending; } else { status = count; -- 2.7.4