linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ladislav Michl <ladis@linux-mips.org>
To: Johan Hovold <johan@kernel.org>
Cc: linux-usb@vger.kernel.org
Subject: USB: serial: ti_usb_3410_5052: Avoid goto in bulk in callback
Date: Wed, 13 Dec 2017 12:32:47 +0100	[thread overview]
Message-ID: <20171213113247.GA20556@lenoch> (raw)

On Wed, Dec 13, 2017 at 12:16:05PM +0100, Johan Hovold wrote:
> On Mon, Dec 11, 2017 at 01:44:57PM +0100, Ladislav Michl wrote:
> > On Mon, Dec 11, 2017 at 12:52:46PM +0100, Johan Hovold wrote:
> > > On Mon, Dec 11, 2017 at 12:32:49PM +0100, Ladislav Michl wrote:
> > > > On Mon, Dec 11, 2017 at 11:10:35AM +0100, Johan Hovold wrote:
> > [snip]
> > > > > I'm afraid I don't consider this an improvement. I prefer using gotos
> > > > > for error paths, while keeping the success path out of the status
> > > > > switch.
> > > > > 
> > > > > Furthermore, this isn't functionally equivalent as we'd not longer log
> > > > > an error for -EPIPE.
> > > > 
> > > > Yes, you are right... Now, shouldn't we react somehow to stalled endpoint?
> > > > Tty side seems to be unaware of it.
> > > 
> > > Recovering from a stalled endpoint is a bit involved, so for now we
> > > typically just log an error an bail out (forcing the user to reopen the
> > > port). This seems to work well enough as this condition should be rare.
> > 
> > I just do not see this in code. I would expect pending tty I/O operation
> > would fail once USB device errors out with -EPIPE, so tty side consumer gets
> > notified about error. Either it is not there or I did not look hard enough :)
> 
> No, we do not provide any error notification besides logging an error
> when an endpoint has been stalled (i.e. in case of a read, you would not
> receive any more data before the halt condition has been cleared).

Hmm, could we make 1aba579f3cf5 a bit more generic then?

> Given that there's been no reports about this being an issue (for the
> past ten years and that I can recall), this crude handling appears to
> suffice.

Because embedded people tend to power cycle stuck device on timeout.
That involves project specific hacks in userspace, which could be
probably handled better.

Best regards,
	ladis
---
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

             reply	other threads:[~2017-12-13 11:32 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-13 11:32 Ladislav Michl [this message]
  -- strict thread matches above, loose matches on Subject: below --
2017-12-13 11:50 USB: serial: ti_usb_3410_5052: Avoid goto in bulk in callback Johan Hovold
2017-12-13 11:16 Johan Hovold
2017-12-11 12:44 Ladislav Michl
2017-12-11 11:52 Johan Hovold
2017-12-11 11:32 Ladislav Michl
2017-12-11 10:10 Johan Hovold
2017-12-10 23:09 Ladislav Michl

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=20171213113247.GA20556@lenoch \
    --to=ladis@linux-mips.org \
    --cc=johan@kernel.org \
    --cc=linux-usb@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).