All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: KY Srinivasan <kys@microsoft.com>
Cc: "gregkh@suse.de" <gregkh@suse.de>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"devel@linuxdriverproject.org" <devel@linuxdriverproject.org>,
	"virtualization@lists.osdl.org" <virtualization@lists.osdl.org>,
	"linux-input@vger.kernel.org" <linux-input@vger.kernel.org>,
	Haiyang Zhang <haiyangz@microsoft.com>,
	Jiri Kosina <jkosina@suse.cz>
Subject: Re: [PATCH 1/1] Staging: hv: mousevsc: Move the mouse driver out of staging
Date: Wed, 26 Oct 2011 21:31:20 -0700	[thread overview]
Message-ID: <20111027043120.GA15725@core.coreip.homeip.net> (raw)
In-Reply-To: <6E21E5352C11B742B20C142EB499E0481AA51BAB@TK5EX14MBXC122.redmond.corp.microsoft.com>

On Thu, Oct 27, 2011 at 01:19:50AM +0000, KY Srinivasan wrote:
> 
> 
> > -----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; linux-kernel@vger.kernel.org;
> > 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:
> > > > > +
> > > > > +	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

      reply	other threads:[~2011-10-27  4:31 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-15  6:08 [PATCH 1/1] Staging: hv: mousevsc: Move the mouse driver out of staging K. Y. Srinivasan
2011-10-15  6:36 ` Joe Perches
2011-10-15 13:24   ` KY Srinivasan
2011-10-15 13:24     ` KY Srinivasan
2011-10-16 22:28   ` Dan Carpenter
2011-10-16 22:28     ` Dan Carpenter
2011-10-16 23:03     ` Joe Perches
2011-10-19 23:48 ` KY Srinivasan
2011-10-23  7:24 ` Dmitry Torokhov
2011-10-23 14:33   ` KY Srinivasan
2011-10-23 14:33     ` KY Srinivasan
2011-10-23 15:45   ` KY Srinivasan
2011-10-27  0:09     ` Dmitry Torokhov
2011-10-27  1:19       ` KY Srinivasan
2011-10-27  4:31         ` Dmitry Torokhov [this message]

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=20111027043120.GA15725@core.coreip.homeip.net \
    --to=dmitry.torokhov@gmail.com \
    --cc=devel@linuxdriverproject.org \
    --cc=gregkh@suse.de \
    --cc=haiyangz@microsoft.com \
    --cc=jkosina@suse.cz \
    --cc=kys@microsoft.com \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=virtualization@lists.osdl.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.