Re: [PATCH 1/1] Staging: hv: mousevsc: Move the mouse driver out of staging

From
Dmitry Torokhov <dmitry.torokhov@gmail.com>
Date
2011-10-27 04:31:28
Also in
linux-input, lkml
Reply to
KY Srinivasan, 2011-10-27
On Thu, Oct 27, 2011 at 01:19:50AM +0000, KY Srinivasan wrote:
quoted
-----Original Message-----
From: Dmitry Torokhov [mailto:dmitry.torokhov@gmail.com]
Sent: Wednesday, October 26, 2011 8:09 PM
To: KY Srinivasan
Cc: gregkh@suse.de; <redacted>;
devel@linuxdriverproject.org; virtualization@lists.osdl.org; linux-
input@vger.kernel.org; Haiyang Zhang; Jiri Kosina
Subject: Re: [PATCH 1/1] Staging: hv: mousevsc: Move the mouse driver out of
staging

On Sun, Oct 23, 2011 at 03:45:14PM +0000, KY Srinivasan wrote:
quoted
quoted
quoted
+
+	t = wait_for_completion_timeout(&input_dev->wait_event, 5*HZ);
+	if (t == 0) {
+		ret = -ETIMEDOUT;
+		goto cleanup;
+	}
+
+	response = &input_dev->protocol_resp;
+
+	if (!response->response.approved) {
+		pr_err("synthhid protocol request failed (version %d)",
+		       SYNTHHID_INPUT_VERSION);
+		ret = -ENODEV;
+		goto cleanup;
+	}
+
+	t = wait_for_completion_timeout(&input_dev->wait_event, 5*HZ);
We just completed the wait for this completion, why are we waiting on
the same completion again?
In response to our initial query, we expect the host to respond back with two
distinct pieces of information; we wait for both these responses.
I think you misunderstand how completion works in Linux. IIRC about
Windows events they are different ;) You can not signal completion
several times and then expect to wait corrsponding number of times. Once
you signal completion is it, well, complete.
Looking at the code for complete(), it looks like the "done" state is incremented
each time complete() is invoked and  the  code for do_wait_for_common() decrements the 
done state each time it is invoked (if the completion is properly signaled and we are not dealing
with a timeout. So, what am I missing here.
Hmm, you are right. I am not sure why I thought that completion has to
be re-initialized before it can be reused... I guess this is true only
if one uses complete_all().

-- 
Dmitry
Thread (11 messages) 11 messages, 4 authors, last reply 2011-10-27
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help