Commit c7f00899 authored by Bart Westgeest's avatar Bart Westgeest Committed by Greg Kroah-Hartman

staging: usbip: cleanup of comments

Removed commented-out code, obsolete comments, and fixed comment typos.
Signed-off-by: default avatarBart Westgeest <bart@elbrys.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 20960fac
...@@ -477,19 +477,17 @@ static void stub_disconnect(struct usb_interface *interface) ...@@ -477,19 +477,17 @@ static void stub_disconnect(struct usb_interface *interface)
/* get stub_device */ /* get stub_device */
if (!sdev) { if (!sdev) {
dev_err(&interface->dev, "could not get device"); dev_err(&interface->dev, "could not get device");
/* BUG(); */
return; return;
} }
usb_set_intfdata(interface, NULL); usb_set_intfdata(interface, NULL);
/* /*
* NOTE: * NOTE: rx/tx threads are invoked for each usb_device.
* rx/tx threads are invoked for each usb_device.
*/ */
stub_remove_files(&interface->dev); 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) { if (busid_priv->sdev->ud.eh == current) {
busid_priv->interf_count--; busid_priv->interf_count--;
return; return;
...@@ -504,13 +502,13 @@ static void stub_disconnect(struct usb_interface *interface) ...@@ -504,13 +502,13 @@ static void stub_disconnect(struct usb_interface *interface)
busid_priv->interf_count = 0; busid_priv->interf_count = 0;
/* 1. shutdown the current connection */ /* shutdown the current connection */
shutdown_busid(busid_priv); shutdown_busid(busid_priv);
usb_put_dev(sdev->udev); usb_put_dev(sdev->udev);
usb_put_intf(interface); usb_put_intf(interface);
/* 3. free sdev */ /* free sdev */
busid_priv->sdev = NULL; busid_priv->sdev = NULL;
stub_device_free(sdev); stub_device_free(sdev);
......
...@@ -164,7 +164,6 @@ static int tweak_set_configuration_cmd(struct urb *urb) ...@@ -164,7 +164,6 @@ static int tweak_set_configuration_cmd(struct urb *urb)
config, dev_name(&urb->dev->dev)); config, dev_name(&urb->dev->dev));
return 0; return 0;
/* return usb_driver_set_configuration(urb->dev, config); */
} }
static int tweak_reset_device_cmd(struct urb *urb) static int tweak_reset_device_cmd(struct urb *urb)
...@@ -480,7 +479,7 @@ static void stub_recv_cmd_submit(struct stub_device *sdev, ...@@ -480,7 +479,7 @@ static void stub_recv_cmd_submit(struct stub_device *sdev,
return; return;
} }
/* set priv->urb->transfer_buffer */ /* allocate urb transfer buffer, if needed */
if (pdu->u.cmd_submit.transfer_buffer_length > 0) { if (pdu->u.cmd_submit.transfer_buffer_length > 0) {
priv->urb->transfer_buffer = priv->urb->transfer_buffer =
kzalloc(pdu->u.cmd_submit.transfer_buffer_length, kzalloc(pdu->u.cmd_submit.transfer_buffer_length,
...@@ -492,7 +491,7 @@ static void stub_recv_cmd_submit(struct stub_device *sdev, ...@@ -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, priv->urb->setup_packet = kmemdup(&pdu->u.cmd_submit.setup, 8,
GFP_KERNEL); GFP_KERNEL);
if (!priv->urb->setup_packet) { if (!priv->urb->setup_packet) {
......
...@@ -192,7 +192,6 @@ static int stub_send_ret_submit(struct stub_device *sdev) ...@@ -192,7 +192,6 @@ static int stub_send_ret_submit(struct stub_device *sdev)
setup_ret_submit_pdu(&pdu_header, urb); setup_ret_submit_pdu(&pdu_header, urb);
usbip_dbg_stub_tx("setup txdata seqnum: %d urb: %p\n", usbip_dbg_stub_tx("setup txdata seqnum: %d urb: %p\n",
pdu_header.base.seqnum, urb); pdu_header.base.seqnum, urb);
/*usbip_dump_header(pdu_header);*/
usbip_header_correct_endian(&pdu_header, 1); usbip_header_correct_endian(&pdu_header, 1);
iov[iovnum].iov_base = &pdu_header; iov[iovnum].iov_base = &pdu_header;
......
...@@ -439,7 +439,6 @@ static void usbip_pack_cmd_submit(struct usbip_header *pdu, struct urb *urb, ...@@ -439,7 +439,6 @@ static void usbip_pack_cmd_submit(struct usbip_header *pdu, struct urb *urb,
* will be discussed when usbip is ported to other operating systems. * will be discussed when usbip is ported to other operating systems.
*/ */
if (pack) { if (pack) {
/* vhci_tx.c */
spdu->transfer_flags = spdu->transfer_flags =
tweak_transfer_flags(urb->transfer_flags); tweak_transfer_flags(urb->transfer_flags);
spdu->transfer_buffer_length = urb->transfer_buffer_length; spdu->transfer_buffer_length = urb->transfer_buffer_length;
...@@ -447,9 +446,7 @@ static void usbip_pack_cmd_submit(struct usbip_header *pdu, struct urb *urb, ...@@ -447,9 +446,7 @@ static void usbip_pack_cmd_submit(struct usbip_header *pdu, struct urb *urb,
spdu->number_of_packets = urb->number_of_packets; spdu->number_of_packets = urb->number_of_packets;
spdu->interval = urb->interval; spdu->interval = urb->interval;
} else { } else {
/* stub_rx.c */
urb->transfer_flags = spdu->transfer_flags; urb->transfer_flags = spdu->transfer_flags;
urb->transfer_buffer_length = spdu->transfer_buffer_length; urb->transfer_buffer_length = spdu->transfer_buffer_length;
urb->start_frame = spdu->start_frame; urb->start_frame = spdu->start_frame;
urb->number_of_packets = spdu->number_of_packets; urb->number_of_packets = spdu->number_of_packets;
...@@ -463,16 +460,12 @@ static void usbip_pack_ret_submit(struct usbip_header *pdu, struct urb *urb, ...@@ -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; struct usbip_header_ret_submit *rpdu = &pdu->u.ret_submit;
if (pack) { if (pack) {
/* stub_tx.c */
rpdu->status = urb->status; rpdu->status = urb->status;
rpdu->actual_length = urb->actual_length; rpdu->actual_length = urb->actual_length;
rpdu->start_frame = urb->start_frame; rpdu->start_frame = urb->start_frame;
rpdu->number_of_packets = urb->number_of_packets; rpdu->number_of_packets = urb->number_of_packets;
rpdu->error_count = urb->error_count; rpdu->error_count = urb->error_count;
} else { } else {
/* vhci_rx.c */
urb->status = rpdu->status; urb->status = rpdu->status;
urb->actual_length = rpdu->actual_length; urb->actual_length = rpdu->actual_length;
urb->start_frame = rpdu->start_frame; urb->start_frame = rpdu->start_frame;
...@@ -678,8 +671,6 @@ int usbip_recv_iso(struct usbip_device *ud, struct urb *urb) ...@@ -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 */ /* my Bluetooth dongle gets ISO URBs which are np = 0 */
if (np == 0) { if (np == 0) {
/* pr_info("iso np == 0\n"); */
/* usbip_dump_urb(urb); */
return 0; return 0;
} }
...@@ -751,7 +742,7 @@ void usbip_pad_iso(struct usbip_device *ud, struct urb *urb) ...@@ -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 * if actual_length is transfer_buffer_length then no padding is
* present. * present.
*/ */
if (urb->actual_length == urb->transfer_buffer_length) if (urb->actual_length == urb->transfer_buffer_length)
return; return;
...@@ -775,14 +766,12 @@ int usbip_recv_xbuff(struct usbip_device *ud, struct urb *urb) ...@@ -775,14 +766,12 @@ int usbip_recv_xbuff(struct usbip_device *ud, struct urb *urb)
int size; int size;
if (ud->side == USBIP_STUB) { if (ud->side == USBIP_STUB) {
/* stub_rx.c */
/* the direction of urb must be OUT. */ /* the direction of urb must be OUT. */
if (usb_pipein(urb->pipe)) if (usb_pipein(urb->pipe))
return 0; return 0;
size = urb->transfer_buffer_length; size = urb->transfer_buffer_length;
} else { } else {
/* vhci_rx.c */
/* the direction of urb must be IN. */ /* the direction of urb must be IN. */
if (usb_pipeout(urb->pipe)) if (usb_pipeout(urb->pipe))
return 0; return 0;
......
...@@ -140,10 +140,6 @@ void rh_port_connect(int rhport, enum usb_device_speed speed) ...@@ -140,10 +140,6 @@ void rh_port_connect(int rhport, enum usb_device_speed speed)
break; 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); spin_unlock_irqrestore(&the_controller->lock, flags);
usb_hcd_poll_rh_status(vhci_to_hcd(the_controller)); usb_hcd_poll_rh_status(vhci_to_hcd(the_controller));
...@@ -156,16 +152,11 @@ static void rh_port_disconnect(int rhport) ...@@ -156,16 +152,11 @@ static void rh_port_disconnect(int rhport)
usbip_dbg_vhci_rh("rh_port_disconnect %d\n", rhport); usbip_dbg_vhci_rh("rh_port_disconnect %d\n", rhport);
spin_lock_irqsave(&the_controller->lock, flags); 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] &= ~USB_PORT_STAT_CONNECTION;
the_controller->port_status[rhport] |= the_controller->port_status[rhport] |=
(1 << USB_PORT_FEAT_C_CONNECTION); (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); spin_unlock_irqrestore(&the_controller->lock, flags);
usb_hcd_poll_rh_status(vhci_to_hcd(the_controller)); usb_hcd_poll_rh_status(vhci_to_hcd(the_controller));
} }
...@@ -228,7 +219,6 @@ static int vhci_hub_status(struct usb_hcd *hcd, char *buf) ...@@ -228,7 +219,6 @@ static int vhci_hub_status(struct usb_hcd *hcd, char *buf)
return changed ? retval : 0; return changed ? retval : 0;
} }
/* See hub_configure in hub.c */
static inline void hub_descriptor(struct usb_hub_descriptor *desc) static inline void hub_descriptor(struct usb_hub_descriptor *desc)
{ {
memset(desc, 0, sizeof(*desc)); memset(desc, 0, sizeof(*desc));
...@@ -292,8 +282,6 @@ static int vhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, ...@@ -292,8 +282,6 @@ static int vhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
usbip_dbg_vhci_rh(" ClearPortFeature: " usbip_dbg_vhci_rh(" ClearPortFeature: "
"USB_PORT_FEAT_POWER\n"); "USB_PORT_FEAT_POWER\n");
dum->port_status[rhport] = 0; dum->port_status[rhport] = 0;
/* dum->address = 0; */
/* dum->hdev = 0; */
dum->resuming = 0; dum->resuming = 0;
break; break;
case USB_PORT_FEAT_C_RESET: case USB_PORT_FEAT_C_RESET:
...@@ -333,11 +321,11 @@ static int vhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, ...@@ -333,11 +321,11 @@ static int vhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
retval = -EPIPE; retval = -EPIPE;
} }
/* we do no care of resume. */ /* we do not care about resume. */
/* whoever resets or resumes must GetPortStatus to /* whoever resets or resumes must GetPortStatus to
* complete it!! * complete it!!
* */ */
if (dum->resuming && time_after(jiffies, dum->re_timeout)) { if (dum->resuming && time_after(jiffies, dum->re_timeout)) {
dum->port_status[rhport] |= dum->port_status[rhport] |=
(1 << USB_PORT_FEAT_C_SUSPEND); (1 << USB_PORT_FEAT_C_SUSPEND);
...@@ -345,11 +333,6 @@ static int vhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, ...@@ -345,11 +333,6 @@ static int vhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
~(1 << USB_PORT_FEAT_SUSPEND); ~(1 << USB_PORT_FEAT_SUSPEND);
dum->resuming = 0; dum->resuming = 0;
dum->re_timeout = 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)) != if ((dum->port_status[rhport] & (1 << USB_PORT_FEAT_RESET)) !=
...@@ -411,9 +394,6 @@ static int vhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, ...@@ -411,9 +394,6 @@ static int vhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
default: default:
pr_err("default: no such request\n"); 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 */ /* "protocol stall" on error */
retval = -EPIPE; retval = -EPIPE;
...@@ -456,7 +436,6 @@ static void vhci_tx_urb(struct urb *urb) ...@@ -456,7 +436,6 @@ static void vhci_tx_urb(struct urb *urb)
if (!vdev) { if (!vdev) {
pr_err("could not get virtual device"); pr_err("could not get virtual device");
/* BUG(); */
return; return;
} }
...@@ -813,7 +792,7 @@ static void vhci_shutdown_connection(struct usbip_device *ud) ...@@ -813,7 +792,7 @@ static void vhci_shutdown_connection(struct usbip_device *ud)
kernel_sock_shutdown(ud->tcp_socket, SHUT_RDWR); 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) { if (vdev->ud.tcp_rx) {
kthread_stop_put(vdev->ud.tcp_rx); kthread_stop_put(vdev->ud.tcp_rx);
vdev->ud.tcp_rx = NULL; vdev->ud.tcp_rx = NULL;
...@@ -976,8 +955,6 @@ static int vhci_bus_suspend(struct usb_hcd *hcd) ...@@ -976,8 +955,6 @@ static int vhci_bus_suspend(struct usb_hcd *hcd)
dev_dbg(&hcd->self.root_hub->dev, "%s\n", __func__); dev_dbg(&hcd->self.root_hub->dev, "%s\n", __func__);
spin_lock_irq(&vhci->lock); spin_lock_irq(&vhci->lock);
/* vhci->rh_state = DUMMY_RH_SUSPENDED;
* set_link_state(vhci); */
hcd->state = HC_STATE_SUSPENDED; hcd->state = HC_STATE_SUSPENDED;
spin_unlock_irq(&vhci->lock); spin_unlock_irq(&vhci->lock);
...@@ -995,10 +972,6 @@ static int vhci_bus_resume(struct usb_hcd *hcd) ...@@ -995,10 +972,6 @@ static int vhci_bus_resume(struct usb_hcd *hcd)
if (!HCD_HW_ACCESSIBLE(hcd)) { if (!HCD_HW_ACCESSIBLE(hcd)) {
rc = -ESHUTDOWN; rc = -ESHUTDOWN;
} else { } 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; hcd->state = HC_STATE_RUNNING;
} }
spin_unlock_irq(&vhci->lock); spin_unlock_irq(&vhci->lock);
...@@ -1175,7 +1148,6 @@ static struct platform_device the_pdev = { ...@@ -1175,7 +1148,6 @@ static struct platform_device the_pdev = {
.name = (char *) driver_name, .name = (char *) driver_name,
.id = -1, .id = -1,
.dev = { .dev = {
/* .driver = &vhci_driver, */
.release = the_pdev_release, .release = the_pdev_release,
}, },
}; };
......
...@@ -167,7 +167,7 @@ static void vhci_recv_ret_unlink(struct vhci_device *vdev, ...@@ -167,7 +167,7 @@ static void vhci_recv_ret_unlink(struct vhci_device *vdev,
} else { } else {
usbip_dbg_vhci_rx("now giveback urb %p\n", urb); 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; urb->status = pdu->u.ret_unlink.status;
pr_info("urb->status %d\n", urb->status); pr_info("urb->status %d\n", urb->status);
......
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