linux-input.vger.kernel.org archive mirror
 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 17:09:27 -0700	[thread overview]
Message-ID: <20111027000926.GB6804@core.coreip.homeip.net> (raw)
In-Reply-To: <6E21E5352C11B742B20C142EB499E0481AA3369B@TK5EX14MBXC126.redmond.corp.microsoft.com>

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.

>  
> > 
> > > +	if (t == 0) {
> > > +		ret = -ETIMEDOUT;
> > > +		goto cleanup;
> > > +	}
> > > +
> > > +	/*
> > > +	 * We should have gotten the device attr, hid desc and report
> > > +	 * desc at this point
> > > +	 */
> > > +	if (input_dev->dev_info_status)
> > > +		ret = -ENOMEM;
> > 
> > -ENOMEM seems wrong.
> > 
> There are many failures here and not being able to allocate memory is the 
> primary one; and so I chose to capture that.

Any chance that these failures have their own exit paths?

Thanks.

-- 
Dmitry

  reply	other threads:[~2011-10-27  0:09 UTC|newest]

Thread overview: 12+ 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-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 15:45   ` KY Srinivasan
2011-10-27  0:09     ` Dmitry Torokhov [this message]
2011-10-27  1:19       ` KY Srinivasan
2011-10-27  4:31         ` Dmitry Torokhov

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=20111027000926.GB6804@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 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).