aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/vt6656/usbpipe.c
diff options
context:
space:
mode:
authorMalcolm Priestley <tvboxspy@gmail.com>2020-05-27 09:54:44 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-05-27 12:23:10 +0200
commit5f46e3cde5a42502595effbc7ba7d4e902bff2f0 (patch)
tree74ae5a83d0038cd7eeb265a0728a768d0ac3dab6 /drivers/staging/vt6656/usbpipe.c
parentstaging: vt6656: vnt_tx_packet use skb_clone to preserve sk_buff. (diff)
downloadlinux-dev-5f46e3cde5a42502595effbc7ba7d4e902bff2f0.tar.xz
linux-dev-5f46e3cde5a42502595effbc7ba7d4e902bff2f0.zip
staging: vt6656: Move vnt_tx_usb_header to vnt_tx_context
Move the USB element out of vnt_tx_packet and vnt_beacon_xmit to vnt_tx_context with sk_buff passed in parameters with the data now between skb->data and skb->len. The vnt_tx_usb header is moved from vnt_tx_buffer to usbpipe.h with the size added to extra_tx_headroom the largest possible size. The CONTEXT enums types are aligned with usb ones and CONTEXT_MGMT_PACKET is removed and is never be used. The skb_push in vnt_tx_packet is now only ever used with vnt_get_hdr_size with variables tx_bytes and tx_header_size removed. buf_len in vnt_usb_send_context is no longer used and replaced with urb->actual_length in vnt_tx_context_complete. Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com> Link: https://lore.kernel.org/r/aa6257eb-1758-4e75-ab39-2a15ff6ffa7c@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/vt6656/usbpipe.c')
-rw-r--r--drivers/staging/vt6656/usbpipe.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/drivers/staging/vt6656/usbpipe.c b/drivers/staging/vt6656/usbpipe.c
index 2164f45e13ab..82b774be6485 100644
--- a/drivers/staging/vt6656/usbpipe.c
+++ b/drivers/staging/vt6656/usbpipe.c
@@ -428,7 +428,8 @@ static void vnt_tx_context_complete(struct urb *urb)
switch (urb->status) {
case 0:
- dev_dbg(&priv->usb->dev, "Write %d bytes\n", context->buf_len);
+ dev_dbg(&priv->usb->dev,
+ "Write %d bytes\n", urb->actual_length);
break;
case -ECONNRESET:
case -ENOENT:
@@ -453,17 +454,25 @@ static void vnt_tx_context_complete(struct urb *urb)
}
int vnt_tx_context(struct vnt_private *priv,
- struct vnt_usb_send_context *context)
+ struct vnt_usb_send_context *context,
+ struct sk_buff *skb)
{
- int status;
+ struct vnt_tx_usb_header *usb;
struct urb *urb;
+ int status;
+ u16 count = skb->len;
+
+ usb = skb_push(skb, sizeof(*usb));
+ usb->tx_byte_count = cpu_to_le16(count);
+ usb->pkt_no = context->pkt_no;
+ usb->type = context->type;
if (test_bit(DEVICE_FLAGS_DISCONNECTED, &priv->flags)) {
context->in_use = false;
return -ENODEV;
}
- if (context->buf_len > MAX_TOTAL_SIZE_WITH_ALL_HEADERS) {
+ if (skb->len > MAX_TOTAL_SIZE_WITH_ALL_HEADERS) {
context->in_use = false;
return -E2BIG;
}
@@ -477,8 +486,8 @@ int vnt_tx_context(struct vnt_private *priv,
usb_fill_bulk_urb(urb,
priv->usb,
usb_sndbulkpipe(priv->usb, 3),
- context->tx_buffer,
- context->buf_len,
+ skb->data,
+ skb->len,
vnt_tx_context_complete,
context);