Skip to content

Commit

Permalink
staging: usbip: cleanup of comments
Browse files Browse the repository at this point in the history
Removed commented-out code, obsolete comments, and fixed comment typos.

Signed-off-by: Bart Westgeest <bart@elbrys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Bart Westgeest authored and Greg Kroah-Hartman committed Oct 22, 2012
1 parent 20960fa commit c7f0089
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 55 deletions.
10 changes: 4 additions & 6 deletions drivers/staging/usbip/stub_dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -477,19 +477,17 @@ static void stub_disconnect(struct usb_interface *interface)
/* get stub_device */
if (!sdev) {
dev_err(&interface->dev, "could not get device");
/* BUG(); */
return;
}

usb_set_intfdata(interface, NULL);

/*
* NOTE:
* rx/tx threads are invoked for each usb_device.
* NOTE: rx/tx threads are invoked for each usb_device.
*/
stub_remove_files(&interface->dev);

/*If usb reset called from event handler*/
/* If usb reset is called from event handler */
if (busid_priv->sdev->ud.eh == current) {
busid_priv->interf_count--;
return;
Expand All @@ -504,13 +502,13 @@ static void stub_disconnect(struct usb_interface *interface)

busid_priv->interf_count = 0;

/* 1. shutdown the current connection */
/* shutdown the current connection */
shutdown_busid(busid_priv);

usb_put_dev(sdev->udev);
usb_put_intf(interface);

/* 3. free sdev */
/* free sdev */
busid_priv->sdev = NULL;
stub_device_free(sdev);

Expand Down
5 changes: 2 additions & 3 deletions drivers/staging/usbip/stub_rx.c
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,6 @@ static int tweak_set_configuration_cmd(struct urb *urb)
config, dev_name(&urb->dev->dev));

return 0;
/* return usb_driver_set_configuration(urb->dev, config); */
}

static int tweak_reset_device_cmd(struct urb *urb)
Expand Down Expand Up @@ -480,7 +479,7 @@ static void stub_recv_cmd_submit(struct stub_device *sdev,
return;
}

/* set priv->urb->transfer_buffer */
/* allocate urb transfer buffer, if needed */
if (pdu->u.cmd_submit.transfer_buffer_length > 0) {
priv->urb->transfer_buffer =
kzalloc(pdu->u.cmd_submit.transfer_buffer_length,
Expand All @@ -492,7 +491,7 @@ static void stub_recv_cmd_submit(struct stub_device *sdev,
}
}

/* set priv->urb->setup_packet */
/* copy urb setup packet */
priv->urb->setup_packet = kmemdup(&pdu->u.cmd_submit.setup, 8,
GFP_KERNEL);
if (!priv->urb->setup_packet) {
Expand Down
1 change: 0 additions & 1 deletion drivers/staging/usbip/stub_tx.c
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,6 @@ static int stub_send_ret_submit(struct stub_device *sdev)
setup_ret_submit_pdu(&pdu_header, urb);
usbip_dbg_stub_tx("setup txdata seqnum: %d urb: %p\n",
pdu_header.base.seqnum, urb);
/*usbip_dump_header(pdu_header);*/
usbip_header_correct_endian(&pdu_header, 1);

iov[iovnum].iov_base = &pdu_header;
Expand Down
13 changes: 1 addition & 12 deletions drivers/staging/usbip/usbip_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -439,17 +439,14 @@ static void usbip_pack_cmd_submit(struct usbip_header *pdu, struct urb *urb,
* will be discussed when usbip is ported to other operating systems.
*/
if (pack) {
/* vhci_tx.c */
spdu->transfer_flags =
tweak_transfer_flags(urb->transfer_flags);
spdu->transfer_buffer_length = urb->transfer_buffer_length;
spdu->start_frame = urb->start_frame;
spdu->number_of_packets = urb->number_of_packets;
spdu->interval = urb->interval;
} else {
/* stub_rx.c */
urb->transfer_flags = spdu->transfer_flags;

urb->transfer_buffer_length = spdu->transfer_buffer_length;
urb->start_frame = spdu->start_frame;
urb->number_of_packets = spdu->number_of_packets;
Expand All @@ -463,16 +460,12 @@ static void usbip_pack_ret_submit(struct usbip_header *pdu, struct urb *urb,
struct usbip_header_ret_submit *rpdu = &pdu->u.ret_submit;

if (pack) {
/* stub_tx.c */

rpdu->status = urb->status;
rpdu->actual_length = urb->actual_length;
rpdu->start_frame = urb->start_frame;
rpdu->number_of_packets = urb->number_of_packets;
rpdu->error_count = urb->error_count;
} else {
/* vhci_rx.c */

urb->status = rpdu->status;
urb->actual_length = rpdu->actual_length;
urb->start_frame = rpdu->start_frame;
Expand Down Expand Up @@ -678,8 +671,6 @@ int usbip_recv_iso(struct usbip_device *ud, struct urb *urb)

/* my Bluetooth dongle gets ISO URBs which are np = 0 */
if (np == 0) {
/* pr_info("iso np == 0\n"); */
/* usbip_dump_urb(urb); */
return 0;
}

Expand Down Expand Up @@ -751,7 +742,7 @@ void usbip_pad_iso(struct usbip_device *ud, struct urb *urb)
/*
* if actual_length is transfer_buffer_length then no padding is
* present.
*/
*/
if (urb->actual_length == urb->transfer_buffer_length)
return;

Expand All @@ -775,14 +766,12 @@ int usbip_recv_xbuff(struct usbip_device *ud, struct urb *urb)
int size;

if (ud->side == USBIP_STUB) {
/* stub_rx.c */
/* the direction of urb must be OUT. */
if (usb_pipein(urb->pipe))
return 0;

size = urb->transfer_buffer_length;
} else {
/* vhci_rx.c */
/* the direction of urb must be IN. */
if (usb_pipeout(urb->pipe))
return 0;
Expand Down
36 changes: 4 additions & 32 deletions drivers/staging/usbip/vhci_hcd.c
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,6 @@ void rh_port_connect(int rhport, enum usb_device_speed speed)
break;
}

/* spin_lock(&the_controller->vdev[rhport].ud.lock);
* the_controller->vdev[rhport].ud.status = VDEV_CONNECT;
* spin_unlock(&the_controller->vdev[rhport].ud.lock); */

spin_unlock_irqrestore(&the_controller->lock, flags);

usb_hcd_poll_rh_status(vhci_to_hcd(the_controller));
Expand All @@ -156,16 +152,11 @@ static void rh_port_disconnect(int rhport)
usbip_dbg_vhci_rh("rh_port_disconnect %d\n", rhport);

spin_lock_irqsave(&the_controller->lock, flags);
/* stop_activity(dum, driver); */

the_controller->port_status[rhport] &= ~USB_PORT_STAT_CONNECTION;
the_controller->port_status[rhport] |=
(1 << USB_PORT_FEAT_C_CONNECTION);

/* not yet complete the disconnection
* spin_lock(&vdev->ud.lock);
* vdev->ud.status = VHC_ST_DISCONNECT;
* spin_unlock(&vdev->ud.lock); */

spin_unlock_irqrestore(&the_controller->lock, flags);
usb_hcd_poll_rh_status(vhci_to_hcd(the_controller));
}
Expand Down Expand Up @@ -228,7 +219,6 @@ static int vhci_hub_status(struct usb_hcd *hcd, char *buf)
return changed ? retval : 0;
}

/* See hub_configure in hub.c */
static inline void hub_descriptor(struct usb_hub_descriptor *desc)
{
memset(desc, 0, sizeof(*desc));
Expand Down Expand Up @@ -292,8 +282,6 @@ static int vhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
usbip_dbg_vhci_rh(" ClearPortFeature: "
"USB_PORT_FEAT_POWER\n");
dum->port_status[rhport] = 0;
/* dum->address = 0; */
/* dum->hdev = 0; */
dum->resuming = 0;
break;
case USB_PORT_FEAT_C_RESET:
Expand Down Expand Up @@ -333,23 +321,18 @@ static int vhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
retval = -EPIPE;
}

/* we do no care of resume. */
/* we do not care about resume. */

/* whoever resets or resumes must GetPortStatus to
* complete it!!
* */
*/
if (dum->resuming && time_after(jiffies, dum->re_timeout)) {
dum->port_status[rhport] |=
(1 << USB_PORT_FEAT_C_SUSPEND);
dum->port_status[rhport] &=
~(1 << USB_PORT_FEAT_SUSPEND);
dum->resuming = 0;
dum->re_timeout = 0;
/* if (dum->driver && dum->driver->resume) {
* spin_unlock (&dum->lock);
* dum->driver->resume (&dum->gadget);
* spin_lock (&dum->lock);
* } */
}

if ((dum->port_status[rhport] & (1 << USB_PORT_FEAT_RESET)) !=
Expand Down Expand Up @@ -411,9 +394,6 @@ static int vhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,

default:
pr_err("default: no such request\n");
/* dev_dbg (hardware,
* "hub control req%04x v%04x i%04x l%d\n",
* typeReq, wValue, wIndex, wLength); */

/* "protocol stall" on error */
retval = -EPIPE;
Expand Down Expand Up @@ -456,7 +436,6 @@ static void vhci_tx_urb(struct urb *urb)

if (!vdev) {
pr_err("could not get virtual device");
/* BUG(); */
return;
}

Expand Down Expand Up @@ -813,7 +792,7 @@ static void vhci_shutdown_connection(struct usbip_device *ud)
kernel_sock_shutdown(ud->tcp_socket, SHUT_RDWR);
}

/* kill threads related to this sdev, if v.c. exists */
/* kill threads related to this sdev */
if (vdev->ud.tcp_rx) {
kthread_stop_put(vdev->ud.tcp_rx);
vdev->ud.tcp_rx = NULL;
Expand Down Expand Up @@ -976,8 +955,6 @@ static int vhci_bus_suspend(struct usb_hcd *hcd)
dev_dbg(&hcd->self.root_hub->dev, "%s\n", __func__);

spin_lock_irq(&vhci->lock);
/* vhci->rh_state = DUMMY_RH_SUSPENDED;
* set_link_state(vhci); */
hcd->state = HC_STATE_SUSPENDED;
spin_unlock_irq(&vhci->lock);

Expand All @@ -995,10 +972,6 @@ static int vhci_bus_resume(struct usb_hcd *hcd)
if (!HCD_HW_ACCESSIBLE(hcd)) {
rc = -ESHUTDOWN;
} else {
/* vhci->rh_state = DUMMY_RH_RUNNING;
* set_link_state(vhci);
* if (!list_empty(&vhci->urbp_list))
* mod_timer(&vhci->timer, jiffies); */
hcd->state = HC_STATE_RUNNING;
}
spin_unlock_irq(&vhci->lock);
Expand Down Expand Up @@ -1175,7 +1148,6 @@ static struct platform_device the_pdev = {
.name = (char *) driver_name,
.id = -1,
.dev = {
/* .driver = &vhci_driver, */
.release = the_pdev_release,
},
};
Expand Down
2 changes: 1 addition & 1 deletion drivers/staging/usbip/vhci_rx.c
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ static void vhci_recv_ret_unlink(struct vhci_device *vdev,
} else {
usbip_dbg_vhci_rx("now giveback urb %p\n", urb);

/* If unlink is succeed, status is -ECONNRESET */
/* If unlink is successful, status is -ECONNRESET */
urb->status = pdu->u.ret_unlink.status;
pr_info("urb->status %d\n", urb->status);

Expand Down

0 comments on commit c7f0089

Please sign in to comment.