From: Aniroop Mathur <a.mathur@samsung.com>
To: dmitry.torokhov@gmail.com, linux-input@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, a.mathur@samsung.com,
aniroop.mathur@gmail.com
Subject: [PATCH] Input: evdev: avoid storing newest SYN_REPORT when dropping all events
Date: Fri, 25 Dec 2015 00:55:48 +0530 [thread overview]
Message-ID: <1450985148-804-1-git-send-email-a.mathur@samsung.com> (raw)
The newest event can be SYN_REPORT in case of dropping all old events when
buffer is full, but as now there is no device data available to read so
lets drop SYN_REPORT as well and store only SYN_DROPPED.
Signed-off-by: Aniroop Mathur <a.mathur@samsung.com>
---
drivers/input/evdev.c | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c
index e9ae3d5..e270219 100644
--- a/drivers/input/evdev.c
+++ b/drivers/input/evdev.c
@@ -228,7 +228,7 @@ static int evdev_set_clk_type(struct evdev_client *client, unsigned int clkid)
return 0;
}
-static void __pass_event(struct evdev_client *client,
+static int __pass_event(struct evdev_client *client,
const struct input_event *event)
{
client->buffer[client->head++] = *event;
@@ -247,12 +247,24 @@ static void __pass_event(struct evdev_client *client,
client->buffer[client->tail].value = 0;
client->packet_head = client->tail;
+
+ /*
+ * Do not store SYN_REPORT as there is no device data in buffer
+ * and return to avoid wakeup and changing packet_head.
+ */
+ if (event->type == EV_SYN && event->code == SYN_REPORT) {
+ client->head--;
+ client->head &= client->bufsize - 1;
+ return 1;
+ }
}
if (event->type == EV_SYN && event->code == SYN_REPORT) {
client->packet_head = client->head;
kill_fasync(&client->fasync, SIGIO, POLL_IN);
}
+
+ return 0;
}
static void evdev_pass_values(struct evdev_client *client,
@@ -287,7 +299,8 @@ static void evdev_pass_values(struct evdev_client *client,
event.type = v->type;
event.code = v->code;
event.value = v->value;
- __pass_event(client, &event);
+ if (__pass_event(client, &event))
+ wakeup = false;
}
spin_unlock(&client->buffer_lock);
--
2.6.2
next reply other threads:[~2015-12-24 19:24 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-24 19:25 Aniroop Mathur [this message]
2015-12-28 23:41 ` [PATCH] Input: evdev: avoid storing newest SYN_REPORT when dropping all events Dmitry Torokhov
2015-12-29 18:02 ` Aniroop Mathur
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1450985148-804-1-git-send-email-a.mathur@samsung.com \
--to=a.mathur@samsung.com \
--cc=aniroop.mathur@gmail.com \
--cc=dmitry.torokhov@gmail.com \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).