All of lore.kernel.org
 help / color / mirror / Atom feed
From: Johan Hovold <johan@kernel.org>
To: Ladislav Michl <ladis@linux-mips.org>
Cc: Johan Hovold <johan@kernel.org>, linux-usb@vger.kernel.org
Subject: USB: serial: ti_usb_3410_5052: Avoid goto in bulk in callback
Date: Mon, 11 Dec 2017 12:52:46 +0100	[thread overview]
Message-ID: <20171211115246.GB15125@localhost> (raw)

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:
> > On Mon, Dec 11, 2017 at 12:09:19AM +0100, Ladislav Michl wrote:
> > > Make status handling in bulk in callback function more compact,
> > > which renders goto pointless.
> > > 
> > > Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
> > > ---
> > >  drivers/usb/serial/ti_usb_3410_5052.c | 36 ++++++++++++++---------------------
> > >  1 file changed, 14 insertions(+), 22 deletions(-)

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

> > In fact, that -EPIPE is already on my TODO list as we really should not
> > be resubmitting URBs for a stalled endpoint in the first place. That in
> > turn should allow for some clean up of this callback.
> 
> Out of curiosity, how would be stalled endpoint reported?

Simply logging that the urb has been stopped along with the URB status
(-EPIPE) should be enough.

Johan
---
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-11 11:52 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-11 11:52 Johan Hovold [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:32 Ladislav Michl
2017-12-13 11:16 Johan Hovold
2017-12-11 12:44 Ladislav Michl
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=20171211115246.GB15125@localhost \
    --to=johan@kernel.org \
    --cc=ladis@linux-mips.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 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.