* USB: serial: Avoid goto in bulk callbacks
@ 2017-12-11 11:16 Ladislav Michl
0 siblings, 0 replies; 4+ messages in thread
From: Ladislav Michl @ 2017-12-11 11:16 UTC (permalink / raw)
To: Oliver Neukum; +Cc: linux-usb, Johan Hovold
Hi Oliver, Johan,
On Mon, Dec 11, 2017 at 11:58:21AM +0100, Oliver Neukum wrote:
> Am Montag, den 11.12.2017, 00:11 +0100 schrieb Ladislav Michl:
> > Refactor bulk callback functions to make use of goto pointless.
> >
> >
>
> Hi,
>
> you seem to assume that this is a good thing by itself which
> needs no further justification. I disagree. You duplicated
> code.
Where did I duplicated code? Success code path is straightforward
now, so while I'm not pushing at all for this patch to be included
as it is side effect of looking into another drivers while debugging
something else, I really do not understand your comment.
On Mon, Dec 11, 2017 at 11:13:51AM +0100, Johan Hovold wrote:
> So as for the ti driver, I prefer keeping the success path out of the
> switch statement.
Undestood, as noted above, I have no strong preference either way.
Just did what seemed easier to read to me :)
Best regads,
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* USB: serial: Avoid goto in bulk callbacks
@ 2017-12-11 10:58 Oliver Neukum
0 siblings, 0 replies; 4+ messages in thread
From: Oliver Neukum @ 2017-12-11 10:58 UTC (permalink / raw)
To: Ladislav Michl, linux-usb; +Cc: Johan Hovold
Am Montag, den 11.12.2017, 00:11 +0100 schrieb Ladislav Michl:
> Refactor bulk callback functions to make use of goto pointless.
>
>
Hi,
you seem to assume that this is a good thing by itself which
needs no further justification. I disagree. You duplicated
code.
Regards
Oliver
---
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* USB: serial: Avoid goto in bulk callbacks
@ 2017-12-11 10:13 Johan Hovold
0 siblings, 0 replies; 4+ messages in thread
From: Johan Hovold @ 2017-12-11 10:13 UTC (permalink / raw)
To: Ladislav Michl; +Cc: linux-usb, Johan Hovold
On Mon, Dec 11, 2017 at 12:11:52AM +0100, Ladislav Michl wrote:
> Refactor bulk callback functions to make use of goto pointless.
>
> Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
> ---
> drivers/usb/serial/generic.c | 12 +++++-------
> 1 file changed, 5 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/usb/serial/generic.c b/drivers/usb/serial/generic.c
> index 2274d9625f63..d1a09ba10b6f 100644
> --- a/drivers/usb/serial/generic.c
> +++ b/drivers/usb/serial/generic.c
> @@ -389,6 +389,9 @@ void usb_serial_generic_read_bulk_callback(struct urb *urb)
> urb->actual_length);
> switch (status) {
> case 0:
> + usb_serial_debug_data(&port->dev, __func__,
> + urb->actual_length, data);
> + port->serial->type->process_read_urb(urb);
> break;
So as for the ti driver, I prefer keeping the success path out of the
switch statement.
Thanks,
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* USB: serial: Avoid goto in bulk callbacks
@ 2017-12-10 23:11 Ladislav Michl
0 siblings, 0 replies; 4+ messages in thread
From: Ladislav Michl @ 2017-12-10 23:11 UTC (permalink / raw)
To: linux-usb; +Cc: Johan Hovold
Refactor bulk callback functions to make use of goto pointless.
Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
---
drivers/usb/serial/generic.c | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/drivers/usb/serial/generic.c b/drivers/usb/serial/generic.c
index 2274d9625f63..d1a09ba10b6f 100644
--- a/drivers/usb/serial/generic.c
+++ b/drivers/usb/serial/generic.c
@@ -389,6 +389,9 @@ void usb_serial_generic_read_bulk_callback(struct urb *urb)
urb->actual_length);
switch (status) {
case 0:
+ usb_serial_debug_data(&port->dev, __func__,
+ urb->actual_length, data);
+ port->serial->type->process_read_urb(urb);
break;
case -ENOENT:
case -ECONNRESET:
@@ -403,13 +406,9 @@ void usb_serial_generic_read_bulk_callback(struct urb *urb)
default:
dev_dbg(&port->dev, "%s - nonzero urb status: %d\n",
__func__, status);
- goto resubmit;
+ break;
}
- usb_serial_debug_data(&port->dev, __func__, urb->actual_length, data);
- port->serial->type->process_read_urb(urb);
-
-resubmit:
/* Throttle the device if requested by tty */
spin_lock_irqsave(&port->lock, flags);
port->throttled = port->throttle_req;
@@ -454,10 +453,9 @@ void usb_serial_generic_write_bulk_callback(struct urb *urb)
default:
dev_err_console(port, "%s - nonzero urb status: %d\n",
__func__, status);
- goto resubmit;
+ break;
}
-resubmit:
usb_serial_generic_write_start(port, GFP_ATOMIC);
usb_serial_port_softint(port);
}
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-12-11 11:16 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-11 11:16 USB: serial: Avoid goto in bulk callbacks Ladislav Michl
-- strict thread matches above, loose matches on Subject: below --
2017-12-11 10:58 Oliver Neukum
2017-12-11 10:13 Johan Hovold
2017-12-10 23:11 Ladislav Michl
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.