* [PATCH v3 1/5] usb_kbd: remove unused fields
@ 2016-03-09 10:17 Aleksey Kuleshov
2016-03-09 10:17 ` [PATCH v3 2/5] usb_kbd: check for registering error Aleksey Kuleshov
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: Aleksey Kuleshov @ 2016-03-09 10:17 UTC (permalink / raw)
To: barebox; +Cc: Aleksey Kuleshov
Signed-off-by: Aleksey Kuleshov <rndfax@yandex.ru>
---
drivers/input/usb_kbd.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/drivers/input/usb_kbd.c b/drivers/input/usb_kbd.c
index 74bc11f..e41266c 100644
--- a/drivers/input/usb_kbd.c
+++ b/drivers/input/usb_kbd.c
@@ -46,10 +46,8 @@
struct usb_kbd_pdata;
struct usb_kbd_pdata {
- uint64_t last_report;
uint8_t *new;
uint8_t old[USB_KBD_BOOT_REPORT_SIZE];
- uint8_t flags;
struct poller_struct poller;
struct usb_device *usbdev;
int lock;
@@ -173,7 +171,6 @@ static int usb_kbd_probe(struct usb_device *usbdev,
data->new = dma_alloc(USB_KBD_BOOT_REPORT_SIZE);
data->usbdev = usbdev;
- data->last_report = get_time_ns();
data->ep = &iface->ep_desc[0];
data->intpipe = usb_rcvintpipe(usbdev, data->ep->bEndpointAddress);
--
2.6.2
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v3 2/5] usb_kbd: check for registering error
2016-03-09 10:17 [PATCH v3 1/5] usb_kbd: remove unused fields Aleksey Kuleshov
@ 2016-03-09 10:17 ` Aleksey Kuleshov
2016-03-09 10:17 ` [PATCH v3 3/5] usb_kbd: style fixes Aleksey Kuleshov
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Aleksey Kuleshov @ 2016-03-09 10:17 UTC (permalink / raw)
To: barebox; +Cc: Aleksey Kuleshov
Signed-off-by: Aleksey Kuleshov <rndfax@yandex.ru>
---
drivers/input/usb_kbd.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/input/usb_kbd.c b/drivers/input/usb_kbd.c
index e41266c..ff8e591 100644
--- a/drivers/input/usb_kbd.c
+++ b/drivers/input/usb_kbd.c
@@ -196,7 +196,11 @@ static int usb_kbd_probe(struct usb_device *usbdev,
} else
dev_dbg(&usbdev->dev, "poll keyboard via int ep\n");
- input_device_register(&data->input);
+ ret = input_device_register(&data->input);
+ if (ret) {
+ dev_err(&usbdev->dev, "can't register input\n");
+ return ret;
+ }
data->poller.func = usb_kbd_poll;
--
2.6.2
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v3 3/5] usb_kbd: style fixes
2016-03-09 10:17 [PATCH v3 1/5] usb_kbd: remove unused fields Aleksey Kuleshov
2016-03-09 10:17 ` [PATCH v3 2/5] usb_kbd: check for registering error Aleksey Kuleshov
@ 2016-03-09 10:17 ` Aleksey Kuleshov
2016-03-09 10:17 ` [PATCH v3 4/5] usb_kbd: use async polling instead of regular polling Aleksey Kuleshov
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Aleksey Kuleshov @ 2016-03-09 10:17 UTC (permalink / raw)
To: barebox; +Cc: Aleksey Kuleshov
Signed-off-by: Aleksey Kuleshov <rndfax@yandex.ru>
---
drivers/input/usb_kbd.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/input/usb_kbd.c b/drivers/input/usb_kbd.c
index ff8e591..6f7a081 100644
--- a/drivers/input/usb_kbd.c
+++ b/drivers/input/usb_kbd.c
@@ -123,7 +123,6 @@ static void usb_kbd_poll(struct poller_struct *poller)
input_report_key_event(&data->input, usb_kbd_keycode[i + 224], (data->new[0] >> i) & 1);
for (i = 2; i < 8; i++) {
-
if (data->old[i] > 3 && memscan(data->new + 2, data->old[i], 6) == data->new + 8) {
if (usb_kbd_keycode[data->old[i]])
input_report_key_event(&data->input, usb_kbd_keycode[data->old[i]], 0);
@@ -143,7 +142,7 @@ static void usb_kbd_poll(struct poller_struct *poller)
}
}
- memcpy(data->old, data->new, 8);
+ memcpy(data->old, data->new, USB_KBD_BOOT_REPORT_SIZE);
exit:
data->lock = 0;
--
2.6.2
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v3 4/5] usb_kbd: use async polling instead of regular polling
2016-03-09 10:17 [PATCH v3 1/5] usb_kbd: remove unused fields Aleksey Kuleshov
2016-03-09 10:17 ` [PATCH v3 2/5] usb_kbd: check for registering error Aleksey Kuleshov
2016-03-09 10:17 ` [PATCH v3 3/5] usb_kbd: style fixes Aleksey Kuleshov
@ 2016-03-09 10:17 ` Aleksey Kuleshov
2016-03-09 10:17 ` [PATCH v3 5/5] usb_kbd: lock is useless since pollers are atomic Aleksey Kuleshov
2016-03-10 9:01 ` [PATCH v3 1/5] usb_kbd: remove unused fields Sascha Hauer
4 siblings, 0 replies; 6+ messages in thread
From: Aleksey Kuleshov @ 2016-03-09 10:17 UTC (permalink / raw)
To: barebox; +Cc: Aleksey Kuleshov
This fixes the overpolling of USB keyboard which
causes slowdown of entier barebox by using periodic
polling occuting once per some milliseconds.
Signed-off-by: Aleksey Kuleshov <rndfax@yandex.ru>
---
drivers/input/usb_kbd.c | 20 +++++++++++++-------
1 file changed, 13 insertions(+), 7 deletions(-)
diff --git a/drivers/input/usb_kbd.c b/drivers/input/usb_kbd.c
index 6f7a081..bdaf305 100644
--- a/drivers/input/usb_kbd.c
+++ b/drivers/input/usb_kbd.c
@@ -48,7 +48,7 @@ struct usb_kbd_pdata;
struct usb_kbd_pdata {
uint8_t *new;
uint8_t old[USB_KBD_BOOT_REPORT_SIZE];
- struct poller_struct poller;
+ struct poller_async poller;
struct usb_device *usbdev;
int lock;
unsigned long intpipe;
@@ -92,10 +92,9 @@ static const unsigned char usb_kbd_keycode[256] = {
150,158,159,128,136,177,178,176,142,152,173,140
};
-static void usb_kbd_poll(struct poller_struct *poller)
+static void usb_kbd_poll(void *arg)
{
- struct usb_kbd_pdata *data = container_of(poller,
- struct usb_kbd_pdata, poller);
+ struct usb_kbd_pdata *data = arg;
struct usb_device *usbdev = data->usbdev;
int ret, i;
@@ -146,6 +145,7 @@ static void usb_kbd_poll(struct poller_struct *poller)
exit:
data->lock = 0;
+ poller_call_async(&data->poller, data->intinterval * MSECOND, usb_kbd_poll, data);
}
static int usb_kbd_probe(struct usb_device *usbdev,
@@ -201,16 +201,22 @@ static int usb_kbd_probe(struct usb_device *usbdev,
return ret;
}
- data->poller.func = usb_kbd_poll;
+ ret = poller_async_register(&data->poller);
+ if (ret) {
+ dev_err(&usbdev->dev, "can't setup poller\n");
+ return ret;
+ }
+
+ poller_call_async(&data->poller, data->intinterval * MSECOND, usb_kbd_poll, data);
- return poller_register(&data->poller);
+ return 0;
}
static void usb_kbd_disconnect(struct usb_device *usbdev)
{
struct usb_kbd_pdata *data = usbdev->drv_data;
- poller_unregister(&data->poller);
+ poller_async_unregister(&data->poller);
input_device_unregister(&data->input);
dma_free(data->new);
free(data);
--
2.6.2
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v3 5/5] usb_kbd: lock is useless since pollers are atomic
2016-03-09 10:17 [PATCH v3 1/5] usb_kbd: remove unused fields Aleksey Kuleshov
` (2 preceding siblings ...)
2016-03-09 10:17 ` [PATCH v3 4/5] usb_kbd: use async polling instead of regular polling Aleksey Kuleshov
@ 2016-03-09 10:17 ` Aleksey Kuleshov
2016-03-10 9:01 ` [PATCH v3 1/5] usb_kbd: remove unused fields Sascha Hauer
4 siblings, 0 replies; 6+ messages in thread
From: Aleksey Kuleshov @ 2016-03-09 10:17 UTC (permalink / raw)
To: barebox; +Cc: Aleksey Kuleshov
Signed-off-by: Aleksey Kuleshov <rndfax@yandex.ru>
---
drivers/input/usb_kbd.c | 9 +--------
1 file changed, 1 insertion(+), 8 deletions(-)
diff --git a/drivers/input/usb_kbd.c b/drivers/input/usb_kbd.c
index bdaf305..2acc95d 100644
--- a/drivers/input/usb_kbd.c
+++ b/drivers/input/usb_kbd.c
@@ -50,7 +50,6 @@ struct usb_kbd_pdata {
uint8_t old[USB_KBD_BOOT_REPORT_SIZE];
struct poller_async poller;
struct usb_device *usbdev;
- int lock;
unsigned long intpipe;
int intpktsize;
int intinterval;
@@ -98,16 +97,11 @@ static void usb_kbd_poll(void *arg)
struct usb_device *usbdev = data->usbdev;
int ret, i;
- if (data->lock)
- return;
-
- data->lock = 1;
-
ret = data->do_poll(data);
if (ret == -EAGAIN)
goto exit;
if (ret < 0) {
- /* exit and lock forever */
+ /* exit with noreturn */
dev_err(&usbdev->dev,
"usb_submit_int_msg() failed. Keyboard disconnect?\n");
return;
@@ -144,7 +138,6 @@ static void usb_kbd_poll(void *arg)
memcpy(data->old, data->new, USB_KBD_BOOT_REPORT_SIZE);
exit:
- data->lock = 0;
poller_call_async(&data->poller, data->intinterval * MSECOND, usb_kbd_poll, data);
}
--
2.6.2
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v3 1/5] usb_kbd: remove unused fields
2016-03-09 10:17 [PATCH v3 1/5] usb_kbd: remove unused fields Aleksey Kuleshov
` (3 preceding siblings ...)
2016-03-09 10:17 ` [PATCH v3 5/5] usb_kbd: lock is useless since pollers are atomic Aleksey Kuleshov
@ 2016-03-10 9:01 ` Sascha Hauer
4 siblings, 0 replies; 6+ messages in thread
From: Sascha Hauer @ 2016-03-10 9:01 UTC (permalink / raw)
To: Aleksey Kuleshov; +Cc: barebox
On Wed, Mar 09, 2016 at 01:17:48PM +0300, Aleksey Kuleshov wrote:
> Signed-off-by: Aleksey Kuleshov <rndfax@yandex.ru>
> ---
> drivers/input/usb_kbd.c | 3 ---
> 1 file changed, 3 deletions(-)
Applied all, thanks
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2016-03-10 9:01 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-09 10:17 [PATCH v3 1/5] usb_kbd: remove unused fields Aleksey Kuleshov
2016-03-09 10:17 ` [PATCH v3 2/5] usb_kbd: check for registering error Aleksey Kuleshov
2016-03-09 10:17 ` [PATCH v3 3/5] usb_kbd: style fixes Aleksey Kuleshov
2016-03-09 10:17 ` [PATCH v3 4/5] usb_kbd: use async polling instead of regular polling Aleksey Kuleshov
2016-03-09 10:17 ` [PATCH v3 5/5] usb_kbd: lock is useless since pollers are atomic Aleksey Kuleshov
2016-03-10 9:01 ` [PATCH v3 1/5] usb_kbd: remove unused fields Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox