Commit 5ef6aceb authored by matt mooney's avatar matt mooney Committed by Greg Kroah-Hartman

staging: usbip: vhci_rx.c: coding style cleanup

Fix alignment for consistency and remove extraneous lines.
Signed-off-by: default avatarmatt mooney <mfm@muteddisk.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 071d1d47
...@@ -23,10 +23,8 @@ ...@@ -23,10 +23,8 @@
#include "usbip_common.h" #include "usbip_common.h"
#include "vhci.h" #include "vhci.h"
/* get URB from transmitted urb queue. caller must hold vdev->priv_lock */ /* get URB from transmitted urb queue. caller must hold vdev->priv_lock */
struct urb *pickup_urb_and_free_priv(struct vhci_device *vdev, struct urb *pickup_urb_and_free_priv(struct vhci_device *vdev, __u32 seqnum)
__u32 seqnum)
{ {
struct vhci_priv *priv, *tmp; struct vhci_priv *priv, *tmp;
struct urb *urb = NULL; struct urb *urb = NULL;
...@@ -38,12 +36,12 @@ struct urb *pickup_urb_and_free_priv(struct vhci_device *vdev, ...@@ -38,12 +36,12 @@ struct urb *pickup_urb_and_free_priv(struct vhci_device *vdev,
status = urb->status; status = urb->status;
usbip_dbg_vhci_rx("find urb %p vurb %p seqnum %u\n", usbip_dbg_vhci_rx("find urb %p vurb %p seqnum %u\n",
urb, priv, seqnum); urb, priv, seqnum);
/* TODO: fix logic here to improve indent situtation */ /* TODO: fix logic here to improve indent situtation */
if (status != -EINPROGRESS) { if (status != -EINPROGRESS) {
if (status == -ENOENT || if (status == -ENOENT ||
status == -ECONNRESET) status == -ECONNRESET)
dev_info(&urb->dev->dev, dev_info(&urb->dev->dev,
"urb %p was unlinked " "urb %p was unlinked "
"%ssynchronuously.\n", urb, "%ssynchronuously.\n", urb,
...@@ -66,36 +64,31 @@ struct urb *pickup_urb_and_free_priv(struct vhci_device *vdev, ...@@ -66,36 +64,31 @@ struct urb *pickup_urb_and_free_priv(struct vhci_device *vdev,
} }
static void vhci_recv_ret_submit(struct vhci_device *vdev, static void vhci_recv_ret_submit(struct vhci_device *vdev,
struct usbip_header *pdu) struct usbip_header *pdu)
{ {
struct usbip_device *ud = &vdev->ud; struct usbip_device *ud = &vdev->ud;
struct urb *urb; struct urb *urb;
spin_lock(&vdev->priv_lock); spin_lock(&vdev->priv_lock);
urb = pickup_urb_and_free_priv(vdev, pdu->base.seqnum); urb = pickup_urb_and_free_priv(vdev, pdu->base.seqnum);
spin_unlock(&vdev->priv_lock); spin_unlock(&vdev->priv_lock);
if (!urb) { if (!urb) {
usbip_uerr("cannot find a urb of seqnum %u\n", usbip_uerr("cannot find a urb of seqnum %u\n",
pdu->base.seqnum); pdu->base.seqnum);
usbip_uinfo("max seqnum %d\n", usbip_uinfo("max seqnum %d\n",
atomic_read(&the_controller->seqnum)); atomic_read(&the_controller->seqnum));
usbip_event_add(ud, VDEV_EVENT_ERROR_TCP); usbip_event_add(ud, VDEV_EVENT_ERROR_TCP);
return; return;
} }
/* unpack the pdu to a urb */ /* unpack the pdu to a urb */
usbip_pack_pdu(pdu, urb, USBIP_RET_SUBMIT, 0); usbip_pack_pdu(pdu, urb, USBIP_RET_SUBMIT, 0);
/* recv transfer buffer */ /* recv transfer buffer */
if (usbip_recv_xbuff(ud, urb) < 0) if (usbip_recv_xbuff(ud, urb) < 0)
return; return;
/* recv iso_packet_descriptor */ /* recv iso_packet_descriptor */
if (usbip_recv_iso(ud, urb) < 0) if (usbip_recv_iso(ud, urb) < 0)
return; return;
...@@ -107,7 +100,6 @@ static void vhci_recv_ret_submit(struct vhci_device *vdev, ...@@ -107,7 +100,6 @@ static void vhci_recv_ret_submit(struct vhci_device *vdev,
if (usbip_dbg_flag_vhci_rx) if (usbip_dbg_flag_vhci_rx)
usbip_dump_urb(urb); usbip_dump_urb(urb);
usbip_dbg_vhci_rx("now giveback urb %p\n", urb); usbip_dbg_vhci_rx("now giveback urb %p\n", urb);
spin_lock(&the_controller->lock); spin_lock(&the_controller->lock);
...@@ -116,15 +108,13 @@ static void vhci_recv_ret_submit(struct vhci_device *vdev, ...@@ -116,15 +108,13 @@ static void vhci_recv_ret_submit(struct vhci_device *vdev,
usb_hcd_giveback_urb(vhci_to_hcd(the_controller), urb, urb->status); usb_hcd_giveback_urb(vhci_to_hcd(the_controller), urb, urb->status);
usbip_dbg_vhci_rx("Leave\n"); usbip_dbg_vhci_rx("Leave\n");
return; return;
} }
static struct vhci_unlink *dequeue_pending_unlink(struct vhci_device *vdev, static struct vhci_unlink *dequeue_pending_unlink(struct vhci_device *vdev,
struct usbip_header *pdu) struct usbip_header *pdu)
{ {
struct vhci_unlink *unlink, *tmp; struct vhci_unlink *unlink, *tmp;
...@@ -134,7 +124,7 @@ static struct vhci_unlink *dequeue_pending_unlink(struct vhci_device *vdev, ...@@ -134,7 +124,7 @@ static struct vhci_unlink *dequeue_pending_unlink(struct vhci_device *vdev,
usbip_uinfo("unlink->seqnum %lu\n", unlink->seqnum); usbip_uinfo("unlink->seqnum %lu\n", unlink->seqnum);
if (unlink->seqnum == pdu->base.seqnum) { if (unlink->seqnum == pdu->base.seqnum) {
usbip_dbg_vhci_rx("found pending unlink, %lu\n", usbip_dbg_vhci_rx("found pending unlink, %lu\n",
unlink->seqnum); unlink->seqnum);
list_del(&unlink->list); list_del(&unlink->list);
spin_unlock(&vdev->priv_lock); spin_unlock(&vdev->priv_lock);
...@@ -147,9 +137,8 @@ static struct vhci_unlink *dequeue_pending_unlink(struct vhci_device *vdev, ...@@ -147,9 +137,8 @@ static struct vhci_unlink *dequeue_pending_unlink(struct vhci_device *vdev,
return NULL; return NULL;
} }
static void vhci_recv_ret_unlink(struct vhci_device *vdev, static void vhci_recv_ret_unlink(struct vhci_device *vdev,
struct usbip_header *pdu) struct usbip_header *pdu)
{ {
struct vhci_unlink *unlink; struct vhci_unlink *unlink;
struct urb *urb; struct urb *urb;
...@@ -159,14 +148,12 @@ static void vhci_recv_ret_unlink(struct vhci_device *vdev, ...@@ -159,14 +148,12 @@ static void vhci_recv_ret_unlink(struct vhci_device *vdev,
unlink = dequeue_pending_unlink(vdev, pdu); unlink = dequeue_pending_unlink(vdev, pdu);
if (!unlink) { if (!unlink) {
usbip_uinfo("cannot find the pending unlink %u\n", usbip_uinfo("cannot find the pending unlink %u\n",
pdu->base.seqnum); pdu->base.seqnum);
return; return;
} }
spin_lock(&vdev->priv_lock); spin_lock(&vdev->priv_lock);
urb = pickup_urb_and_free_priv(vdev, unlink->unlink_seqnum); urb = pickup_urb_and_free_priv(vdev, unlink->unlink_seqnum);
spin_unlock(&vdev->priv_lock); spin_unlock(&vdev->priv_lock);
if (!urb) { if (!urb) {
...@@ -176,7 +163,7 @@ static void vhci_recv_ret_unlink(struct vhci_device *vdev, ...@@ -176,7 +163,7 @@ static void vhci_recv_ret_unlink(struct vhci_device *vdev,
* back the URB. * back the URB.
*/ */
usbip_uinfo("the urb (seqnum %d) was already given backed\n", usbip_uinfo("the urb (seqnum %d) was already given backed\n",
pdu->base.seqnum); pdu->base.seqnum);
} else { } else {
usbip_dbg_vhci_rx("now giveback urb %p\n", urb); usbip_dbg_vhci_rx("now giveback urb %p\n", urb);
...@@ -189,7 +176,7 @@ static void vhci_recv_ret_unlink(struct vhci_device *vdev, ...@@ -189,7 +176,7 @@ static void vhci_recv_ret_unlink(struct vhci_device *vdev,
spin_unlock(&the_controller->lock); spin_unlock(&the_controller->lock);
usb_hcd_giveback_urb(vhci_to_hcd(the_controller), urb, usb_hcd_giveback_urb(vhci_to_hcd(the_controller), urb,
urb->status); urb->status);
} }
kfree(unlink); kfree(unlink);
...@@ -202,9 +189,7 @@ static int vhci_priv_tx_empty(struct vhci_device *vdev) ...@@ -202,9 +189,7 @@ static int vhci_priv_tx_empty(struct vhci_device *vdev)
int empty = 0; int empty = 0;
spin_lock(&vdev->priv_lock); spin_lock(&vdev->priv_lock);
empty = list_empty(&vdev->priv_rx); empty = list_empty(&vdev->priv_rx);
spin_unlock(&vdev->priv_lock); spin_unlock(&vdev->priv_lock);
return empty; return empty;
...@@ -217,7 +202,6 @@ static void vhci_rx_pdu(struct usbip_device *ud) ...@@ -217,7 +202,6 @@ static void vhci_rx_pdu(struct usbip_device *ud)
struct usbip_header pdu; struct usbip_header pdu;
struct vhci_device *vdev = container_of(ud, struct vhci_device, ud); struct vhci_device *vdev = container_of(ud, struct vhci_device, ud);
usbip_dbg_vhci_rx("Enter\n"); usbip_dbg_vhci_rx("Enter\n");
memset(&pdu, 0, sizeof(pdu)); memset(&pdu, 0, sizeof(pdu));
...@@ -245,7 +229,7 @@ static void vhci_rx_pdu(struct usbip_device *ud) ...@@ -245,7 +229,7 @@ static void vhci_rx_pdu(struct usbip_device *ud)
} }
if (ret != sizeof(pdu)) { if (ret != sizeof(pdu)) {
usbip_uerr("received pdu size is %d, should be %d\n", usbip_uerr("received pdu size is %d, should be %d\n",
ret, (unsigned int)sizeof(pdu)); ret, (unsigned int)sizeof(pdu));
usbip_event_add(ud, VDEV_EVENT_ERROR_TCP); usbip_event_add(ud, VDEV_EVENT_ERROR_TCP);
return; return;
} }
...@@ -270,14 +254,12 @@ static void vhci_rx_pdu(struct usbip_device *ud) ...@@ -270,14 +254,12 @@ static void vhci_rx_pdu(struct usbip_device *ud)
} }
} }
/*-------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*/
int vhci_rx_loop(void *data) int vhci_rx_loop(void *data)
{ {
struct usbip_device *ud = data; struct usbip_device *ud = data;
while (!kthread_should_stop()) { while (!kthread_should_stop()) {
if (usbip_event_happened(ud)) if (usbip_event_happened(ud))
break; break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment