* [PATCH] can: etas_es58x: remove useless calls to usb_fill_bulk_urb()
@ 2022-07-29 8:09 Vincent Mailhol
2022-07-29 8:15 ` Marc Kleine-Budde
0 siblings, 1 reply; 2+ messages in thread
From: Vincent Mailhol @ 2022-07-29 8:09 UTC (permalink / raw)
To: linux-can, Marc Kleine-Budde; +Cc: Vincent Mailhol
Aside of urb->transfer_buffer_length and urb->context which might
change in the TX path, all the other URB parameters remains constant
during runtime. So, there is no reasons to call usb_fill_bulk_urb()
each time before submitting an URB.
Make sure to initialize all the fields of the URB at allocation
time. For the TX branch, replace the call usb_fill_bulk_urb() by an
assignment of urb->context. urb->urb->transfer_buffer_length is
already set by the caller functions, no need to set it again. For the
RX branch, because all parameters are unchanged, simply remove the
call to usb_fill_bulk_urb().
Signed-off-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr>
---
drivers/net/can/usb/etas_es58x/es58x_core.c | 11 +++--------
1 file changed, 3 insertions(+), 8 deletions(-)
diff --git a/drivers/net/can/usb/etas_es58x/es58x_core.c b/drivers/net/can/usb/etas_es58x/es58x_core.c
index 3b949e979583..51294b717040 100644
--- a/drivers/net/can/usb/etas_es58x/es58x_core.c
+++ b/drivers/net/can/usb/etas_es58x/es58x_core.c
@@ -1460,10 +1460,6 @@ static void es58x_read_bulk_callback(struct urb *urb)
}
resubmit_urb:
- usb_fill_bulk_urb(urb, es58x_dev->udev, es58x_dev->rx_pipe,
- urb->transfer_buffer, urb->transfer_buffer_length,
- es58x_read_bulk_callback, es58x_dev);
-
ret = usb_submit_urb(urb, GFP_ATOMIC);
if (ret == -ENODEV) {
for (i = 0; i < es58x_dev->num_can_ch; i++)
@@ -1597,7 +1593,8 @@ static struct urb *es58x_get_tx_urb(struct es58x_device *es58x_dev)
return NULL;
usb_fill_bulk_urb(urb, es58x_dev->udev, es58x_dev->tx_pipe,
- buf, tx_buf_len, NULL, NULL);
+ buf, tx_buf_len, es58x_write_bulk_callback,
+ NULL);
return urb;
}
@@ -1630,9 +1627,7 @@ static int es58x_submit_urb(struct es58x_device *es58x_dev, struct urb *urb,
int ret;
es58x_set_crc(urb->transfer_buffer, urb->transfer_buffer_length);
- usb_fill_bulk_urb(urb, es58x_dev->udev, es58x_dev->tx_pipe,
- urb->transfer_buffer, urb->transfer_buffer_length,
- es58x_write_bulk_callback, netdev);
+ urb->context = netdev;
usb_anchor_urb(urb, &es58x_dev->tx_urbs_busy);
ret = usb_submit_urb(urb, GFP_ATOMIC);
if (ret) {
--
2.35.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] can: etas_es58x: remove useless calls to usb_fill_bulk_urb()
2022-07-29 8:09 [PATCH] can: etas_es58x: remove useless calls to usb_fill_bulk_urb() Vincent Mailhol
@ 2022-07-29 8:15 ` Marc Kleine-Budde
0 siblings, 0 replies; 2+ messages in thread
From: Marc Kleine-Budde @ 2022-07-29 8:15 UTC (permalink / raw)
To: Vincent Mailhol; +Cc: linux-can
[-- Attachment #1: Type: text/plain, Size: 1075 bytes --]
On 29.07.2022 17:09:02, Vincent Mailhol wrote:
> Aside of urb->transfer_buffer_length and urb->context which might
> change in the TX path, all the other URB parameters remains constant
> during runtime. So, there is no reasons to call usb_fill_bulk_urb()
> each time before submitting an URB.
>
> Make sure to initialize all the fields of the URB at allocation
> time. For the TX branch, replace the call usb_fill_bulk_urb() by an
> assignment of urb->context. urb->urb->transfer_buffer_length is
> already set by the caller functions, no need to set it again. For the
> RX branch, because all parameters are unchanged, simply remove the
> call to usb_fill_bulk_urb().
>
> Signed-off-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr>
Applied to linux-can-next/master
regards,
Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Embedded Linux | https://www.pengutronix.de |
Vertretung West/Dortmund | Phone: +49-231-2826-924 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-07-29 8:15 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-29 8:09 [PATCH] can: etas_es58x: remove useless calls to usb_fill_bulk_urb() Vincent Mailhol
2022-07-29 8:15 ` Marc Kleine-Budde
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.