[PATCH 1/2] input: usb_kbd: skip poll on -EAGAIN error

Peter Mamonov pmamonov at gmail.com
Wed Oct 14 03:15:48 PDT 2015


Skip poll if either usb_submit_int_msg() or usb_get_report()
returned -EAGAIN.

Signed-off-by: Peter Mamonov <pmamonov at gmail.com>
---
 drivers/input/usb_kbd.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/input/usb_kbd.c b/drivers/input/usb_kbd.c
index 8c08aba..655d0c7 100644
--- a/drivers/input/usb_kbd.c
+++ b/drivers/input/usb_kbd.c
@@ -274,7 +274,7 @@ static void usb_kbd_poll(struct poller_struct *poller)
 	struct usb_kbd_pdata *data = container_of(poller,
 						  struct usb_kbd_pdata, poller);
 	struct usb_device *usbdev = data->usbdev;
-	int diff, tout;
+	int diff, tout, ret;
 
 	if (data->lock)
 		return;
@@ -284,7 +284,10 @@ static void usb_kbd_poll(struct poller_struct *poller)
 		goto exit;
 	data->last_poll = get_time_ns();
 
-	if (0 > data->do_poll(data)) {
+	ret = data->do_poll(data);
+	if (ret == -EAGAIN)
+		goto exit;
+	if (ret < 0) {
 		/* exit and lock forever */
 		dev_err(&usbdev->dev,
 			"usb_submit_int_msg() failed. Keyboard disconnect?\n");
-- 
2.1.4




More information about the barebox mailing list