Skip to content

Commit

Permalink
can: gs_usb: rewrap usb_control_msg() and usb_fill_bulk_urb()
Browse files Browse the repository at this point in the history
This patch rewraps the arguments of usb_control_msg() and
usb_fill_bulk_urb() to make full use of the standard line length of 80
characters.

Link: https://lore.kernel.org/all/20220309124132.291861-7-mkl@pengutronix.de
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
  • Loading branch information
Marc Kleine-Budde committed Mar 10, 2022
1 parent d0cd2aa commit c1ee726
Showing 1 changed file with 22 additions and 65 deletions.
87 changes: 22 additions & 65 deletions drivers/net/can/usb/gs_usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -258,11 +258,7 @@ static int gs_cmd_reset(struct gs_can *gsdev)
usb_sndctrlpipe(interface_to_usbdev(intf), 0),
GS_USB_BREQ_MODE,
USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_INTERFACE,
gsdev->channel,
0,
dm,
sizeof(*dm),
1000);
gsdev->channel, 0, dm, sizeof(*dm), 1000);

kfree(dm);

Expand Down Expand Up @@ -392,14 +388,10 @@ static void gs_usb_receive_bulk_callback(struct urb *urb)
}

resubmit_urb:
usb_fill_bulk_urb(urb,
usbcan->udev,
usb_fill_bulk_urb(urb, usbcan->udev,
usb_rcvbulkpipe(usbcan->udev, GSUSB_ENDPOINT_IN),
hf,
sizeof(struct gs_host_frame),
gs_usb_receive_bulk_callback,
usbcan
);
hf, sizeof(struct gs_host_frame),
gs_usb_receive_bulk_callback, usbcan);

rc = usb_submit_urb(urb, GFP_ATOMIC);

Expand Down Expand Up @@ -436,11 +428,7 @@ static int gs_usb_set_bittiming(struct net_device *netdev)
usb_sndctrlpipe(interface_to_usbdev(intf), 0),
GS_USB_BREQ_BITTIMING,
USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_INTERFACE,
dev->channel,
0,
dbt,
sizeof(*dbt),
1000);
dev->channel, 0, dbt, sizeof(*dbt), 1000);

kfree(dbt);

Expand All @@ -460,10 +448,8 @@ static void gs_usb_xmit_callback(struct urb *urb)
if (urb->status)
netdev_info(netdev, "usb xmit fail %u\n", txc->echo_id);

usb_free_coherent(urb->dev,
urb->transfer_buffer_length,
urb->transfer_buffer,
urb->transfer_dma);
usb_free_coherent(urb->dev, urb->transfer_buffer_length,
urb->transfer_buffer, urb->transfer_dma);
}

static netdev_tx_t gs_can_start_xmit(struct sk_buff *skb,
Expand Down Expand Up @@ -519,10 +505,8 @@ static netdev_tx_t gs_can_start_xmit(struct sk_buff *skb,

usb_fill_bulk_urb(urb, dev->udev,
usb_sndbulkpipe(dev->udev, GSUSB_ENDPOINT_OUT),
hf,
sizeof(*hf),
gs_usb_xmit_callback,
txc);
hf, sizeof(*hf),
gs_usb_xmit_callback, txc);

urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
usb_anchor_urb(urb, &dev->tx_submitted);
Expand All @@ -540,9 +524,7 @@ static netdev_tx_t gs_can_start_xmit(struct sk_buff *skb,

usb_unanchor_urb(urb);
usb_free_coherent(dev->udev,
sizeof(*hf),
hf,
urb->transfer_dma);
sizeof(*hf), hf, urb->transfer_dma);

if (rc == -ENODEV) {
netif_device_detach(netdev);
Expand All @@ -562,10 +544,7 @@ static netdev_tx_t gs_can_start_xmit(struct sk_buff *skb,
return NETDEV_TX_OK;

badidx:
usb_free_coherent(dev->udev,
sizeof(*hf),
hf,
urb->transfer_dma);
usb_free_coherent(dev->udev, sizeof(*hf), hf, urb->transfer_dma);
nomem_hf:
usb_free_urb(urb);

Expand Down Expand Up @@ -618,8 +597,7 @@ static int gs_can_open(struct net_device *netdev)
GSUSB_ENDPOINT_IN),
buf,
sizeof(struct gs_host_frame),
gs_usb_receive_bulk_callback,
parent);
gs_usb_receive_bulk_callback, parent);
urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;

usb_anchor_urb(urb, &parent->rx_submitted);
Expand Down Expand Up @@ -671,13 +649,8 @@ static int gs_can_open(struct net_device *netdev)
rc = usb_control_msg(interface_to_usbdev(dev->iface),
usb_sndctrlpipe(interface_to_usbdev(dev->iface), 0),
GS_USB_BREQ_MODE,
USB_DIR_OUT | USB_TYPE_VENDOR |
USB_RECIP_INTERFACE,
dev->channel,
0,
dm,
sizeof(*dm),
1000);
USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_INTERFACE,
dev->channel, 0, dm, sizeof(*dm), 1000);

if (rc < 0) {
netdev_err(netdev, "Couldn't start device (err=%d)\n", rc);
Expand Down Expand Up @@ -754,16 +727,10 @@ static int gs_usb_set_identify(struct net_device *netdev, bool do_identify)
imode->mode = cpu_to_le32(GS_CAN_IDENTIFY_OFF);

rc = usb_control_msg(interface_to_usbdev(dev->iface),
usb_sndctrlpipe(interface_to_usbdev(dev->iface),
0),
usb_sndctrlpipe(interface_to_usbdev(dev->iface), 0),
GS_USB_BREQ_IDENTIFY,
USB_DIR_OUT | USB_TYPE_VENDOR |
USB_RECIP_INTERFACE,
dev->channel,
0,
imode,
sizeof(*imode),
100);
USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_INTERFACE,
dev->channel, 0, imode, sizeof(*imode), 100);

kfree(imode);

Expand Down Expand Up @@ -813,11 +780,7 @@ static struct gs_can *gs_make_candev(unsigned int channel,
usb_rcvctrlpipe(interface_to_usbdev(intf), 0),
GS_USB_BREQ_BT_CONST,
USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_INTERFACE,
channel,
0,
bt_const,
sizeof(*bt_const),
1000);
channel, 0, bt_const, sizeof(*bt_const), 1000);

if (rc < 0) {
dev_err(&intf->dev,
Expand Down Expand Up @@ -931,11 +894,8 @@ static int gs_usb_probe(struct usb_interface *intf,
usb_sndctrlpipe(interface_to_usbdev(intf), 0),
GS_USB_BREQ_HOST_FORMAT,
USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_INTERFACE,
1,
intf->cur_altsetting->desc.bInterfaceNumber,
hconf,
sizeof(*hconf),
1000);
1, intf->cur_altsetting->desc.bInterfaceNumber,
hconf, sizeof(*hconf), 1000);

kfree(hconf);

Expand All @@ -953,11 +913,8 @@ static int gs_usb_probe(struct usb_interface *intf,
usb_rcvctrlpipe(interface_to_usbdev(intf), 0),
GS_USB_BREQ_DEVICE_CONFIG,
USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_INTERFACE,
1,
intf->cur_altsetting->desc.bInterfaceNumber,
dconf,
sizeof(*dconf),
1000);
1, intf->cur_altsetting->desc.bInterfaceNumber,
dconf, sizeof(*dconf), 1000);
if (rc < 0) {
dev_err(&intf->dev, "Couldn't get device config: (err=%d)\n",
rc);
Expand Down

0 comments on commit c1ee726

Please sign in to comment.