LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Vitaliy Ivanov <vitalivanov@gmail.com>
To: Pete Zaitcev <zaitcev@redhat.com>, vitalivanov@gmail.com
Cc: Oliver Neukum <oliver@neukum.org>,
	linux-usb-devel@lists.sourceforge.net, greg@kroah.com,
	linux-kernel@vger.kernel.org, netwiz@crc.id.au
Subject: Re: USB: FIx locks and urb->status in adutux
Date: Tue, 30 Oct 2007 15:09:54 +0200	[thread overview]
Message-ID: <1193749794.27085.15.camel@dell1.softservecom.com> (raw)
In-Reply-To: <20071029212433.c9837c4b.zaitcev@redhat.com>

On Tue, 2007-10-30 at 06:24, Pete Zaitcev wrote:

> However, this looks wrong:
> 
> > +			 dev->interrupt_in_endpoint->bInterval);
> > +	dev->read_urb_finished = 0;
> > +	retval = usb_submit_urb(dev->interrupt_in_urb, GFP_KERNEL);
> > +	/* we ignore failure */
> > +	/* end of fixup for first read */
> > +
> > +	/* initialize out direction */
> > +	dev->out_urb_finished = 1;
> 
> The finished flag is only set when URB is not in use anymore. Did you
> observe an anomaly with my code? Any hangs? If so, I assure you this
> is not the fix. As it's written, even if we ignore the failure (e.g.
> do not pass it to userland), we sill have to maintain the correct
> flag state.

As about read_urb_finished probably it's OK. But we shouldn't decrease open_count in the case of error as then we return normal exit value.
Here is what we had before:

				 dev->interrupt_in_endpoint->bInterval);
		dev->read_urb_finished = 0;
		retval = usb_submit_urb(dev->interrupt_in_urb, GFP_KERNEL);
		if (retval) {
			dev->read_urb_finished = 1;
			--dev->open_count;
		}

So I can left it but w/o this line:
--dev->open_count;

What is more critical is that I added:

	/* initialize out direction */
	dev->out_urb_finished = 1;

Without this we'll always have write timeouts.

		Vitaliy


  reply	other threads:[~2007-10-30 13:13 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-23  3:34 Pete Zaitcev
2007-10-23  9:38 ` [linux-usb-devel] " Oliver Neukum
2007-10-23 21:38   ` Pete Zaitcev
2007-10-24 14:04     ` Oliver Neukum
2007-10-24  1:53   ` Pete Zaitcev
2007-10-24 14:09     ` Vitaliy Ivanov
2007-10-25  3:20       ` Pete Zaitcev
2007-10-25  3:25       ` Pete Zaitcev
     [not found]         ` <200710251403.48688.oliver@neukum.org>
2007-10-25 16:38           ` Pete Zaitcev
2007-10-29 18:04         ` Vitaliy Ivanov
2007-10-30  4:24           ` Pete Zaitcev
2007-10-30 13:09             ` Vitaliy Ivanov [this message]
2007-10-30 21:54               ` Pete Zaitcev
2007-10-31 11:54                 ` Vitaliy Ivanov
2007-10-31 22:01                   ` Pete Zaitcev
2007-11-01  9:06                     ` Vitaliy Ivanov
2007-11-01 17:28                       ` Pete Zaitcev
2007-10-24 14:49     ` Oliver Neukum
2007-10-24 21:25       ` Greg KH
2007-10-26  9:57         ` Vitaliy Ivanov

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=1193749794.27085.15.camel@dell1.softservecom.com \
    --to=vitalivanov@gmail.com \
    --cc=greg@kroah.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb-devel@lists.sourceforge.net \
    --cc=netwiz@crc.id.au \
    --cc=oliver@neukum.org \
    --cc=zaitcev@redhat.com \
    --subject='Re: USB: FIx locks and urb->status in adutux' \
    /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

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).