Skip to content

Commit e0f3907

Browse files
vincent-mailholmarckleinebudde
authored andcommitted
can: etas_es58x: remove useless calls to usb_fill_bulk_urb()
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 <[email protected]> Link: https://lore.kernel.org/all/[email protected] Signed-off-by: Marc Kleine-Budde <[email protected]>
1 parent 12a18d7 commit e0f3907

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

drivers/net/can/usb/etas_es58x/es58x_core.c

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1460,10 +1460,6 @@ static void es58x_read_bulk_callback(struct urb *urb)
14601460
}
14611461

14621462
resubmit_urb:
1463-
usb_fill_bulk_urb(urb, es58x_dev->udev, es58x_dev->rx_pipe,
1464-
urb->transfer_buffer, urb->transfer_buffer_length,
1465-
es58x_read_bulk_callback, es58x_dev);
1466-
14671463
ret = usb_submit_urb(urb, GFP_ATOMIC);
14681464
if (ret == -ENODEV) {
14691465
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)
15971593
return NULL;
15981594

15991595
usb_fill_bulk_urb(urb, es58x_dev->udev, es58x_dev->tx_pipe,
1600-
buf, tx_buf_len, NULL, NULL);
1596+
buf, tx_buf_len, es58x_write_bulk_callback,
1597+
NULL);
16011598
return urb;
16021599
}
16031600

@@ -1630,9 +1627,7 @@ static int es58x_submit_urb(struct es58x_device *es58x_dev, struct urb *urb,
16301627
int ret;
16311628

16321629
es58x_set_crc(urb->transfer_buffer, urb->transfer_buffer_length);
1633-
usb_fill_bulk_urb(urb, es58x_dev->udev, es58x_dev->tx_pipe,
1634-
urb->transfer_buffer, urb->transfer_buffer_length,
1635-
es58x_write_bulk_callback, netdev);
1630+
urb->context = netdev;
16361631
usb_anchor_urb(urb, &es58x_dev->tx_urbs_busy);
16371632
ret = usb_submit_urb(urb, GFP_ATOMIC);
16381633
if (ret) {

0 commit comments

Comments
 (0)