staging: usbip: cleanup
Subsystems (2)
cover staging: usbip: cleanup
Hi Greg,
Here is a set of extremely trivial changes; more substantial changes will follow.
Thanks,
matt
matt mooney (16):
staging: usbip: stub_dev.c: coding style cleanup
staging: usbip: stub_main.c: coding style cleanup
staging: usbip: stub_rx.c: coding style cleanup
staging: usbip: stub_tx.c: coding style cleanup
staging: usbip: usbip_common.h: coding style cleanup
staging: usbip: usbip_common.c: coding style cleanup
staging: usbip: usbip_event.c: coding style cleanup
staging: usbip: stub.h: coding style cleanup
staging: usbip: vhci.h: coding style cleanup
staging: usbip: vhci_hcd.c: coding style cleanup
staging: usbip: vhci_rx.c: coding style cleanup
staging: usbip: vhci_sysfs.c: coding style cleanup
staging: usbip: vhci_tx.c: coding style cleanup
staging: usbip: add break to default case in switch statements
staging: usbip: remove section dividers
staging: usbip: fixup MODULE_ macros
drivers/staging/usbip/stub.h | 5 - drivers/staging/usbip/stub_dev.c | 57 ++-------- drivers/staging/usbip/stub_main.c | 31 +---- drivers/staging/usbip/stub_rx.c | 52 ++++----- drivers/staging/usbip/stub_tx.c | 68 ++++------- drivers/staging/usbip/usbip_common.c | 138 ++++++++++------------- drivers/staging/usbip/usbip_common.h | 85 +++++--------- drivers/staging/usbip/usbip_event.c | 18 +-- drivers/staging/usbip/vhci.h | 24 +--- drivers/staging/usbip/vhci_hcd.c | 204 +++++++++++++--------------------- drivers/staging/usbip/vhci_rx.c | 49 +++------ drivers/staging/usbip/vhci_sysfs.c | 15 +-- drivers/staging/usbip/vhci_tx.c | 36 ++---- 13 files changed, 278 insertions(+), 504 deletions(-)
Signature · 1 line
1.7.5.1
PATCH 1/16 staging: usbip: stub_dev.c: coding style cleanup
Fix alignment for consistency and remove extraneous lines.
--- drivers/staging/usbip/stub_dev.c | 44 ++++++++++--------------------------- 1 files changed, 12 insertions(+), 32 deletions(-)
drivers/staging/usbip/stub_dev.c +12 -32
@@ -23,13 +23,10 @@#include "usbip_common.h" #include "stub.h" - -static int stub_probe (struct usb_interface *interface, -const struct usb_device_id *id); +const struct usb_device_id *id);static void stub_disconnect (struct usb_interface *interface); -/* * Define device IDs here if you want to explicitly limit exportable devices. * In the most cases, wild card matching will be ok because driver binding can
@@ -64,7 +61,6 @@ struct usb_driver stub_driver = { .id_table = stub_table, }; -/*-------------------------------------------------------------------------*/ /* Define sysfs entries for a usbip-bound device */
@@ -128,13 +124,11 @@ static ssize_t store_sockfd(struct device *dev, struct device_attribute *attr,spin_unlock (&sdev->ud.lock);return -EINVAL ; } -#if 0 setnodelay (socket);setkeepalive (socket);setreuse (socket);#endif - sdev->ud.tcp_socket = socket;spin_unlock (&sdev->ud.lock);
@@ -183,10 +177,8 @@ static int stub_add_files(struct device *dev) err_debug:device_remove_file (dev, &dev_attr_usbip_sockfd); - err_sockfd:device_remove_file (dev, &dev_attr_usbip_status); - err_status:return err; }
@@ -198,8 +190,6 @@ static void stub_remove_files(struct device *dev)device_remove_file (dev, &dev_attr_usbip_debug); } - -/*-------------------------------------------------------------------------*/ /* Event handler functions called by an event handler thread */
@@ -244,18 +234,15 @@ static void stub_shutdown_connection(struct usbip_device *ud)struct stub_unlink *unlink, *tmp;spin_lock_irqsave (&sdev->priv_lock, flags); -list_for_each_entry_safe (unlink, tmp, &sdev->unlink_tx, list) {list_del (&unlink->list);kfree (unlink); } -list_for_each_entry_safe (unlink, tmp, &sdev->unlink_free, list) {list_del (&unlink->list);kfree (unlink); } -spin_unlock_irqrestore (&sdev->priv_lock, flags); } }
@@ -275,7 +262,6 @@ static void stub_device_reset(struct usbip_device *ud)spin_lock (&ud->lock); ud->status =SDEV_ST_ERROR ;spin_unlock (&ud->lock); -return ; }
@@ -306,7 +292,6 @@ static void stub_device_unusable(struct usbip_device *ud)spin_unlock (&ud->lock); } -/*-------------------------------------------------------------------------*/ /**
@@ -339,13 +324,12 @@ static struct stub_device *stub_device_alloc(struct usb_device *udev,* devnum may change later if a device is reset. However, devid never * changes during a usbip connection. */ - sdev->devid = (busnum <<16 ) | devnum; - - sdev->ud.side =USBIP_STUB ; - sdev->ud.status =SDEV_ST_AVAILABLE ; + sdev->devid = (busnum <<16 ) | devnum; + sdev->ud.side =USBIP_STUB ; + sdev->ud.status =SDEV_ST_AVAILABLE ;/* sdev->ud.lock = SPIN_LOCK_UNLOCKED; */ spin_lock_init (&sdev->ud.lock); - sdev->ud.tcp_socket =NULL ; + sdev->ud.tcp_socket =NULL ;INIT_LIST_HEAD (&sdev->priv_init);INIT_LIST_HEAD (&sdev->priv_tx);
@@ -378,7 +362,6 @@ static int stub_device_free(struct stub_device *sdev)return 0 ; } -/*-------------------------------------------------------------------------*/ /*
@@ -405,7 +388,7 @@ static int stub_probe(struct usb_interface *interface,/* check we should claim or not by busid_table */ busid_priv =get_busid_priv (udev_busid);if (!busid_priv || (busid_priv->status =STUB_BUSID_REMOV ) || - (busid_priv->status =STUB_BUSID_OTHER )) { + (busid_priv->status =STUB_BUSID_OTHER )) {dev_info (&interface->dev,"this device %s is not in match_busid table. skip!\n" , udev_busid);
@@ -420,17 +403,16 @@ static int stub_probe(struct usb_interface *interface,if (udev->descriptor.bDeviceClass =USB_CLASS_HUB ) {usbip_udbg ("this device %s is a usb hub device. skip!\n" , - udev_busid); + udev_busid);return -ENODEV ; }if (!strcmp (udev->bus->bus_name,"vhci_hcd" )) {usbip_udbg ("this device %s is attached on vhci_hcd. skip!\n" , - udev_busid); + udev_busid);return -ENODEV ; } -if (busid_priv->status =STUB_BUSID_ALLOC ) { sdev = busid_priv->sdev;if (!sdev)
@@ -438,9 +420,10 @@ static int stub_probe(struct usb_interface *interface, busid_priv->interf_count++;dev_info (&interface->dev, -"USB/IP Stub: register a new interface " -"(bus %u dev %u ifn %u)\n" , udev->bus->busnum, udev->devnum, - interface->cur_altsetting->desc.bInterfaceNumber); +"USB/IP Stub: register a new interface " +"(bus %u dev %u ifn %u)\n" , + udev->bus->busnum, udev->devnum, + interface->cur_altsetting->desc.bInterfaceNumber);/* set private data to usb_interface */ usb_set_intfdata (interface, sdev);
@@ -504,10 +487,8 @@ static void shutdown_busid(struct bus_id_priv *busid_priv)/* 2. wait for the stop of the event handler */ usbip_stop_eh (&busid_priv->sdev->ud); } - } -/* * called in usb_disconnect() or usb_deregister() * but only if actconfig(active configuration) exists
@@ -559,7 +540,6 @@ static void stub_disconnect(struct usb_interface *interface) busid_priv->interf_count =0 ; -/* 1. shutdown the current connection */ shutdown_busid (busid_priv);
Signature · 1 line
1.7.5.1
PATCH 2/16 staging: usbip: stub_main.c: coding style cleanup
In reply to matt mooneyFix alignment for consistency and remove extraneous lines.
--- drivers/staging/usbip/stub_main.c | 19 ++++++------------- 1 files changed, 6 insertions(+), 13 deletions(-)
drivers/staging/usbip/stub_main.c +6 -13
@@ -34,7 +34,6 @@ struct kmem_cache *stub_priv_cache;/* Define sysfs entries for the usbip driver */ -/* * busid_tables defines matching busids that usbip can grab. A user can change * dynamically what device is locally used and what device is exported to a
@@ -44,7 +43,6 @@ struct kmem_cache *stub_priv_cache;static struct bus_id_priv busid_table[MAX_BUSID ];static spinlock_t busid_table_lock; -int match_busid (const char *busid) {int i;
@@ -148,11 +146,11 @@ int del_match_busid(char *busid)return -1 ; } +static void init_busid_table (void ) {int i; -for (i =0 ; i <MAX_BUSID ; i++) {memset (busid_table[i].name,0 ,BUSID_SIZE ); busid_table[i].status =STUB_BUSID_OTHER ;
@@ -160,11 +158,12 @@ static void init_busid_table(void) busid_table[i].sdev =NULL ; busid_table[i].shutdown_busid =0 ; } +spin_lock_init (&busid_table_lock); }static ssize_t store_match_busid (struct device_driver *dev,const char *buf, -size_t count) +size_t count) {int len;char busid[BUSID_SIZE ];
@@ -181,7 +180,6 @@ static ssize_t store_match_busid(struct device_driver *dev, const char *buf,strncpy (busid, buf +4 ,BUSID_SIZE ); -if (!strncmp (buf,"add " ,4 )) {if (add_match_busid (busid) <0 )return -ENOMEM ;
@@ -199,11 +197,8 @@ static ssize_t store_match_busid(struct device_driver *dev, const char *buf, }else return -EINVAL ; } - static DRIVER_ATTR(match_busid, S_IRUSR|S_IWUSR, show_match_busid, - store_match_busid); - - + store_match_busid);/*-------------------------------------------------------------------------*/
@@ -265,14 +260,12 @@ void stub_device_cleanup_urbs(struct stub_device *sdev)kmem_cache_free (stub_priv_cache, priv);kfree (urb->transfer_buffer); -kfree (urb->setup_packet);usb_free_urb (urb); } } -/*-------------------------------------------------------------------------*/ static int __init usb_stub_init (void )
@@ -296,8 +289,8 @@ static int __init usb_stub_init(void) goto error_usb_register; } - printk(KERN_INFO KBUILD_MODNAME ":" - DRIVER_DESC ":" DRIVER_VERSION "\n"); + printk(KERN_INFO KBUILD_MODNAME ":" DRIVER_DESC ":" DRIVER_VERSION + "\n");init_busid_table ();
Signature · 1 line
1.7.5.1
PATCH 3/16 staging: usbip: stub_rx.c: coding style cleanup
In reply to matt mooneyFix alignment for consistency and remove extraneous lines.
--- drivers/staging/usbip/stub_rx.c | 50 ++++++++++++++++---------------------- 1 files changed, 21 insertions(+), 29 deletions(-)
drivers/staging/usbip/stub_rx.c +21 -28
@@ -24,7 +24,6 @@#include "stub.h" #include <linux/usb/hcd.h> -static int is_clear_halt_cmd (struct urb *urb) {struct usb_ctrlrequest *req;
@@ -43,7 +42,7 @@ static int is_set_interface_cmd(struct urb *urb) req = (struct usb_ctrlrequest *) urb->setup_packet;return (req->bRequest =USB_REQ_SET_INTERFACE ) && - (req->bRequestType =USB_RECIP_INTERFACE ); + (req->bRequestType =USB_RECIP_INTERFACE ); }static int is_set_configuration_cmd (struct urb *urb)
@@ -53,7 +52,7 @@ static int is_set_configuration_cmd(struct urb *urb) req = (struct usb_ctrlrequest *) urb->setup_packet;return (req->bRequest =USB_REQ_SET_CONFIGURATION ) && - (req->bRequestType =USB_RECIP_DEVICE ); + (req->bRequestType =USB_RECIP_DEVICE ); }static int is_reset_device_cmd (struct urb *urb)
@@ -67,8 +66,8 @@ static int is_reset_device_cmd(struct urb *urb) index =le16_to_cpu (req->wIndex);if ((req->bRequest =USB_REQ_SET_FEATURE ) && - (req->bRequestType =USB_RT_PORT ) && - (value =USB_PORT_FEAT_RESET )) { + (req->bRequestType =USB_RT_PORT ) && + (value =USB_PORT_FEAT_RESET )) {usbip_dbg_stub_rx ("reset_device_cmd, port %u\n" , index);return 1 ; }else
@@ -103,10 +102,10 @@ static int tweak_clear_halt_cmd(struct urb *urb) ret =usb_clear_halt (urb->dev, target_pipe);if (ret <0 )usbip_uinfo ("clear_halt error: devnum %d endp %d, %d\n" , - urb->dev->devnum, target_endp, ret); + urb->dev->devnum, target_endp, ret);else usbip_uinfo ("clear_halt done: devnum %d endp %d\n" , - urb->dev->devnum, target_endp); + urb->dev->devnum, target_endp);return ret; }
@@ -122,17 +121,16 @@ static int tweak_set_interface_cmd(struct urb *urb) alternate =le16_to_cpu (req->wValue); interface =le16_to_cpu (req->wIndex); -usbip_dbg_stub_rx ("set_interface: inf %u alt %u\n" , interface, - alternate); +usbip_dbg_stub_rx ("set_interface: inf %u alt %u\n" , + interface, alternate); ret =usb_set_interface (urb->dev, interface, alternate);if (ret <0 )usbip_uinfo ("set_interface error: inf %u alt %u, %d\n" , - interface, alternate, ret); + interface, alternate, ret);else usbip_uinfo ("set_interface done: inf %u alt %u\n" , - interface, - alternate); + interface, alternate);return ret; }
@@ -161,8 +159,8 @@ static int tweak_set_configuration_cmd(struct urb *urb)* A user may need to set a special configuration value before * exporting the device. */ -usbip_uinfo ("set_configuration (%d) to %s\n" , config, -dev_name (&urb->dev->dev)); +usbip_uinfo ("set_configuration %d to %s\n" , + config,dev_name (&urb->dev->dev));usbip_uinfo ("but, skip!\n" );return 0 ;
@@ -228,13 +226,12 @@ static void tweak_special_requests(struct urb *urb)* See also comments about unlinking strategy in vhci_hcd.c. */ static int stub_recv_cmd_unlink (struct stub_device *sdev, -struct usbip_header *pdu) +struct usbip_header *pdu) {unsigned long flags;struct stub_priv *priv; -spin_lock_irqsave (&sdev->priv_lock, flags);list_for_each_entry (priv, &sdev->priv_init, list) {
@@ -289,7 +286,7 @@ static int stub_recv_cmd_unlink(struct stub_device *sdev, }usbip_dbg_stub_rx ("seqnum %d is not pending\n" , - pdu->u.cmd_unlink.seqnum); + pdu->u.cmd_unlink.seqnum);/* * The urb of the unlink target is not found in priv_init queue. It was
@@ -301,7 +298,6 @@ static int stub_recv_cmd_unlink(struct stub_device *sdev,spin_unlock_irqrestore (&sdev->priv_lock, flags); -return 0 ; }
@@ -370,8 +366,6 @@ static int get_pipe(struct stub_device *sdev, int epnum, int dir) } epd = &ep->desc; - -#if 0 /* epnum 0 is always control */ if (epnum =0 ) {
@@ -381,7 +375,6 @@ static int get_pipe(struct stub_device *sdev, int epnum, int dir) return usb_rcvctrlpipe(udev, 0); }#endif -if (usb_endpoint_xfer_control (epd)) {if (dir =USBIP_DIR_OUT )return usb_sndctrlpipe (udev, epnum);
@@ -430,19 +423,19 @@ static void masking_bogus_flags(struct urb *urb)return ; ep = (usb_pipein (urb->pipe) ? dev->ep_in : dev->ep_out) - [usb_pipeendpoint (urb->pipe)]; + [usb_pipeendpoint (urb->pipe)];if (!ep)return ; xfertype =usb_endpoint_type (&ep->desc);if (xfertype =USB_ENDPOINT_XFER_CONTROL ) { struct usb_ctrlrequest *setup - (struct usb_ctrlrequest *) urb->setup_packet; + (struct usb_ctrlrequest *) urb->setup_packet;if (!setup)return ; is_out = !(setup->bRequestType &USB_DIR_IN ) || - !setup->wLength; + !setup->wLength; }else { is_out =usb_endpoint_dir_out (&ep->desc); }
@@ -478,7 +471,6 @@ static void stub_recv_cmd_submit(struct stub_device *sdev,struct usb_device *udev = sdev->udev;int pipe =get_pipe (sdev, pdu->base.ep, pdu->base.direction); - priv =stub_priv_alloc (sdev, pdu);if (!priv)return ;
@@ -486,7 +478,7 @@ static void stub_recv_cmd_submit(struct stub_device *sdev,/* setup a urb */ if (usb_pipeisoc (pipe)) priv->urb =usb_alloc_urb (pdu->u.cmd_submit.number_of_packets, -GFP_KERNEL ); +GFP_KERNEL );else priv->urb =usb_alloc_urb (0 ,GFP_KERNEL );
@@ -500,7 +492,7 @@ static void stub_recv_cmd_submit(struct stub_device *sdev,if (pdu->u.cmd_submit.transfer_buffer_length >0 ) { priv->urb->transfer_buffer kzalloc(pdu->u.cmd_submit.transfer_buffer_length, -GFP_KERNEL ); +GFP_KERNEL );if (!priv->urb->transfer_buffer) {dev_err (&sdev->interface->dev,"malloc x_buff\n" );usbip_event_add (ud,SDEV_EVENT_ERROR_MALLOC );
@@ -541,7 +533,7 @@ static void stub_recv_cmd_submit(struct stub_device *sdev,if (ret =0 )usbip_dbg_stub_rx ("submit urb ok, seqnum %u\n" , - pdu->base.seqnum); + pdu->base.seqnum);else {dev_err (&sdev->interface->dev,"submit_urb error, %d\n" , ret);usbip_dump_header (pdu);
@@ -604,7 +596,6 @@ static void stub_rx_pdu(struct usbip_device *ud)usbip_event_add (ud,SDEV_EVENT_ERROR_TCP );return ; } - }int stub_rx_loop (void *data)
@@ -617,5 +608,6 @@ int stub_rx_loop(void *data)stub_rx_pdu (ud); } +return 0 ; }
Signature · 1 line
1.7.5.1
PATCH 4/16 staging: usbip: stub_tx.c: coding style cleanup
In reply to matt mooneyFix alignment for consistency, checkpatch.pl warnings for lines over 80 characters, remove extraneous lines, and change conversion specifier within a format string to remove warning.
--- drivers/staging/usbip/stub_tx.c | 56 ++++++++++++++++----------------------- 1 files changed, 23 insertions(+), 33 deletions(-)
drivers/staging/usbip/stub_tx.c +22 -33
@@ -23,7 +23,6 @@#include "usbip_common.h" #include "stub.h" -static void stub_free_priv_and_urb (struct stub_priv *priv) {struct urb *urb = priv->urb;
@@ -71,28 +70,27 @@ void stub_complete(struct urb *urb)usbip_dbg_stub_tx ("complete! status %d\n" , urb->status); -switch (urb->status) {case 0 :/* OK */ break ;case -ENOENT :usbip_uinfo ("stopped by a call of usb_kill_urb() because of" -"cleaning up a virtual connection\n" ); +"cleaning up a virtual connection\n" );return ;case -ECONNRESET :usbip_uinfo ("unlinked by a call of usb_unlink_urb()\n" );break ;case -EPIPE :usbip_uinfo ("endpoint %d is stalled\n" , -usb_pipeendpoint (urb->pipe)); +usb_pipeendpoint (urb->pipe));break ;case -ESHUTDOWN :usbip_uinfo ("device removed?\n" );break ;default :usbip_uinfo ("urb completion with non-zero status %d\n" , - urb->status); + urb->status); }/* link a urb to the queue of tx. */
@@ -104,25 +102,23 @@ void stub_complete(struct urb *urb) }else list_move_tail (&priv->list, &sdev->priv_tx); -spin_unlock_irqrestore (&sdev->priv_lock, flags);/* wake up tx_thread */ wake_up (&sdev->tx_waitq); } -/*-------------------------------------------------------------------------*/ /* fill PDU */ static inline void setup_base_pdu (struct usbip_header_basic *base, -__u32 command,__u32 seqnum) +__u32 command,__u32 seqnum) { base->command = command; base->seqnum = seqnum; base->devid =0 ; base->ep =0 ; - base->direction =0 ; + base->direction =0 ; }static void setup_ret_submit_pdu (struct usbip_header *rpdu,struct urb *urb)
@@ -130,19 +126,16 @@ static void setup_ret_submit_pdu(struct usbip_header *rpdu, struct urb *urb)struct stub_priv *priv = (struct stub_priv *) urb->context;setup_base_pdu (&rpdu->base,USBIP_RET_SUBMIT , priv->seqnum); -usbip_pack_pdu (rpdu, urb,USBIP_RET_SUBMIT ,1 ); }static void setup_ret_unlink_pdu (struct usbip_header *rpdu, -struct stub_unlink *unlink) +struct stub_unlink *unlink) {setup_base_pdu (&rpdu->base,USBIP_RET_UNLINK , unlink->seqnum); - rpdu->u.ret_unlink.status = unlink->status; } -/*-------------------------------------------------------------------------*/ /* send RET_SUBMIT */
@@ -203,7 +196,7 @@ static int stub_send_ret_submit(struct stub_device *sdev)/* 1. setup usbip_header */ setup_ret_submit_pdu (&pdu_header, urb);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 );
@@ -214,14 +207,14 @@ static int stub_send_ret_submit(struct stub_device *sdev)/* 2. setup transfer buffer */ if (usb_pipein (urb->pipe) && -usb_pipetype (urb->pipe) !=PIPE_ISOCHRONOUS && - urb->actual_length >0 ) { +usb_pipetype (urb->pipe) !=PIPE_ISOCHRONOUS && + urb->actual_length >0 ) { iov[iovnum].iov_base = urb->transfer_buffer; iov[iovnum].iov_len = urb->actual_length; iovnum++; txsize += urb->actual_length; }else if (usb_pipein (urb->pipe) && -usb_pipetype (urb->pipe) =PIPE_ISOCHRONOUS ) { +usb_pipetype (urb->pipe) =PIPE_ISOCHRONOUS ) {/* * For isochronous packets: actual length is the sum of * the actual length of the individual, packets, but as
@@ -232,18 +225,23 @@ static int stub_send_ret_submit(struct stub_device *sdev)int i;for (i =0 ; i < urb->number_of_packets; i++) { - iov[iovnum].iov_base = urb->transfer_buffer + urb->iso_frame_desc[i].offset; - iov[iovnum].iov_len = urb->iso_frame_desc[i].actual_length; + iov[iovnum].iov_base = urb->transfer_buffer + + urb->iso_frame_desc[i].offset; + iov[iovnum].iov_len + urb->iso_frame_desc[i].actual_length; iovnum++; txsize += urb->iso_frame_desc[i].actual_length; }if (txsize !=sizeof (pdu_header) + urb->actual_length) {dev_err (&sdev->interface->dev, -"actual length of urb (%d) does not match iso packet sizes (%d)\n" , - urb->actual_length, txsize-sizeof (pdu_header)); +"actual length of urb %d does not " +"match iso packet sizes %lu\n" , + urb->actual_length, + txsize-sizeof (pdu_header));kfree (iov); -usbip_event_add (&sdev->ud,SDEV_EVENT_ERROR_TCP ); +usbip_event_add (&sdev->ud, +SDEV_EVENT_ERROR_TCP );return -1 ; } }
@@ -285,17 +283,14 @@ static int stub_send_ret_submit(struct stub_device *sdev) }spin_lock_irqsave (&sdev->priv_lock, flags); -list_for_each_entry_safe (priv, tmp, &sdev->priv_free, list) {stub_free_priv_and_urb (priv); } -spin_unlock_irqrestore (&sdev->priv_lock, flags);return total_size; } -/*-------------------------------------------------------------------------*/ /* send RET_UNLINK */
@@ -317,7 +312,6 @@ static struct stub_unlink *dequeue_from_unlink_tx(struct stub_device *sdev)return NULL ; } -static int stub_send_ret_unlink (struct stub_device *sdev) {unsigned long flags;
@@ -358,13 +352,10 @@ static int stub_send_ret_unlink(struct stub_device *sdev)return -1 ; } -usbip_dbg_stub_tx ("send txdata\n" ); - total_size += txsize; } -spin_lock_irqsave (&sdev->priv_lock, flags);list_for_each_entry_safe (unlink, tmp, &sdev->unlink_free, list) {
@@ -377,7 +368,6 @@ static int stub_send_ret_unlink(struct stub_device *sdev)return total_size; } -/*-------------------------------------------------------------------------*/ int stub_tx_loop (void *data)
@@ -410,9 +400,9 @@ int stub_tx_loop(void *data)break ;wait_event_interruptible (sdev->tx_waitq, - (!list_empty (&sdev->priv_tx) || - !list_empty (&sdev->unlink_tx) || -kthread_should_stop ())); + (!list_empty (&sdev->priv_tx) || + !list_empty (&sdev->unlink_tx) || +kthread_should_stop ())); }return 0 ;
Signature · 1 line
1.7.5.1
PATCH 5/16 staging: usbip: usbip_common.h: coding style cleanup
In reply to matt mooneyUse the compiler macro __packed, fix a few alignment issues, and remove extraneous lines.
--- drivers/staging/usbip/usbip_common.h | 75 +++++++++++++--------------------- 1 files changed, 29 insertions(+), 46 deletions(-)
drivers/staging/usbip/usbip_common.h +29 -46
@@ -20,8 +20,8 @@#ifndef __VHCI_COMMON_H#define __VHCI_COMMON_H -#include <linux/version.h> +#include <linux/compiler.h> #include <linux/usb.h> #include <asm/byteorder.h> #include <net/sock.h>
@@ -37,23 +37,21 @@* @fmt: * @args: */ -#ifdef CONFIG_USB_IP_DEBUG_ENABLE #define usbip_udbg(fmt, args...) \ do { \ printk(KERN_DEBUG "%-10s:(%s,%d) %s: " fmt, \ - (in_interrupt() ? "interrupt" : (current)->comm),\ - __FILE__, __LINE__, __func__, ##args); \ + (in_interrupt() ? "interrupt" : (current)->comm),\ + __FILE__, __LINE__, __func__, ##args); \ } while (0)#else /* CONFIG_USB_IP_DEBUG_ENABLE */ -#define usbip_udbg(fmt, args...) do { } while (0) +#define usbip_udbg(fmt, args...) do { } while (0)#endif /* CONFIG_USB_IP_DEBUG_ENABLE */ -enum { usbip_debug_xmit = (1 <<0 ), usbip_debug_sysfs = (1 <<1 ),
@@ -87,16 +85,16 @@ extern struct device_attribute dev_attr_usbip_debug; #define usbip_dbg_with_flag(flag, fmt, args...) \ do { \ if (flag & usbip_debug_flag) \ - usbip_udbg(fmt , ##args); \ + usbip_udbg(fmt , ##args); \ } while (0) -#define usbip_dbg_sysfs(fmt, args...) \ +#define usbip_dbg_sysfs(fmt, args...) \ usbip_dbg_with_flag(usbip_debug_sysfs, fmt , ##args) -#define usbip_dbg_xmit(fmt, args...) \ +#define usbip_dbg_xmit(fmt, args...) \ usbip_dbg_with_flag(usbip_debug_xmit, fmt , ##args) -#define usbip_dbg_urb(fmt, args...) \ +#define usbip_dbg_urb(fmt, args...) \ usbip_dbg_with_flag(usbip_debug_urb, fmt , ##args) -#define usbip_dbg_eh(fmt, args...) \ +#define usbip_dbg_eh(fmt, args...) \ usbip_dbg_with_flag(usbip_debug_eh, fmt , ##args) #define usbip_dbg_vhci_rh(fmt, args...) \
@@ -107,17 +105,16 @@ extern struct device_attribute dev_attr_usbip_debug; usbip_dbg_with_flag(usbip_debug_vhci_rx, fmt , ##args) #define usbip_dbg_vhci_tx(fmt, args...) \ usbip_dbg_with_flag(usbip_debug_vhci_tx, fmt , ##args) -#define usbip_dbg_vhci_sysfs(fmt, args...) \ +#define usbip_dbg_vhci_sysfs(fmt, args...) \ usbip_dbg_with_flag(usbip_debug_vhci_sysfs, fmt , ##args) -#define usbip_dbg_stub_cmp(fmt, args...) \ +#define usbip_dbg_stub_cmp(fmt, args...) \ usbip_dbg_with_flag(usbip_debug_stub_cmp, fmt , ##args) -#define usbip_dbg_stub_rx(fmt, args...) \ +#define usbip_dbg_stub_rx(fmt, args...) \ usbip_dbg_with_flag(usbip_debug_stub_rx, fmt , ##args) -#define usbip_dbg_stub_tx(fmt, args...) \ +#define usbip_dbg_stub_tx(fmt, args...) \ usbip_dbg_with_flag(usbip_debug_stub_tx, fmt , ##args) - /** * usbip_uerr - print error messages * @fmt:
@@ -126,8 +123,8 @@ extern struct device_attribute dev_attr_usbip_debug; #define usbip_uerr(fmt, args...) \ do { \ printk(KERN_ERR "%-10s: ***ERROR*** (%s,%d) %s: " fmt, \ - (in_interrupt() ? "interrupt" : (current)->comm),\ - __FILE__, __LINE__, __func__, ##args); \ + (in_interrupt() ? "interrupt" : (current)->comm),\ + __FILE__, __LINE__, __func__, ##args); \ } while (0)/**
@@ -140,7 +137,6 @@ extern struct device_attribute dev_attr_usbip_debug; printk(KERN_INFO "usbip: " fmt , ## args); \ }while (0 ) -/*-------------------------------------------------------------------------*/ /*
@@ -185,7 +181,7 @@ struct usbip_header_basic {#define USBIP_DIR_IN 1__u32 direction;__u32 ep;/* endpoint number */ -} __attribute__ ((packed)); +} __packed;/* * An additional header for a CMD_SUBMIT packet.
@@ -212,43 +208,40 @@ struct usbip_header_cmd_submit {/* set setup packet data for a CTRL request */ unsigned char setup[8 ]; -} __attribute__ ((packed)); +} __packed;/* * An additional header for a RET_SUBMIT packet. */ struct usbip_header_ret_submit {__s32 status; -__s32 actual_length;/* returned data length */ -__s32 start_frame;/* ISO and INT */ -__s32 number_of_packets;/* ISO only */ -__s32 error_count;/* ISO only */ -} __attribute__ ((packed)); +__s32 actual_length;/* returned data length */ +__s32 start_frame;/* ISO and INT */ +__s32 number_of_packets;/* ISO only */ +__s32 error_count;/* ISO only */ +} __packed;/* * An additional header for a CMD_UNLINK packet. */ struct usbip_header_cmd_unlink { -__u32 seqnum;/* URB's seqnum which will be unlinked */ -} __attribute__ ((packed)); - +__u32 seqnum;/* URB's seqnum that will be unlinked */ +} __packed;/* * An additional header for a RET_UNLINK packet. */ struct usbip_header_ret_unlink {__s32 status; -} __attribute__ ((packed)); - +} __packed;/* the same as usb_iso_packet_descriptor but packed for pdu */ struct usbip_iso_packet_descriptor {__u32 offset; -__u32 length;/* expected length */ +__u32 length;/* expected length */ __u32 actual_length;__u32 status; -} __attribute__ ((packed)); - +} __packed;/* * All usbip packets use a common header to keep code simple.
@@ -262,18 +255,13 @@ struct usbip_header {struct usbip_header_cmd_unlink cmd_unlink;struct usbip_header_ret_unlink ret_unlink; } u; -} __attribute__ ((packed)); - - - +} __packed;/*-------------------------------------------------------------------------*/ -int usbip_xmit (int ,struct socket *,char *,int ,int );int usbip_sendmsg (struct socket *,struct msghdr *,int ); -static inline int interface_to_busnum (struct usb_interface *interface) {struct usb_device *udev =interface_to_usbdev (interface);
@@ -304,7 +292,6 @@ int set_sockaddr(struct socket *socket, struct sockaddr_storage *ss);void usbip_dump_urb (struct urb *purb);void usbip_dump_header (struct usbip_header *pdu); -struct usbip_device ;enum usbip_side {
@@ -331,7 +318,6 @@ enum usbip_status {/* a common structure for stub_device and vhci_device */ struct usbip_device {enum usbip_side side; -enum usbip_status status;/* lock for status */
@@ -370,9 +356,8 @@ struct usbip_device { } eh_ops; }; -void usbip_pack_pdu (struct usbip_header *pdu,struct urb *urb,int cmd, -int pack); +int pack);void usbip_header_correct_endian (struct usbip_header *pdu,int send);/* some members of urb must be substituted before. */
@@ -383,12 +368,10 @@ int usbip_recv_iso(struct usbip_device *ud, struct urb *urb);int usbip_pad_iso (struct usbip_device *ud,struct urb *urb);void *usbip_alloc_iso_desc_pdu (struct urb *urb,ssize_t *bufflen); -/* usbip_event.c */ int usbip_start_eh (struct usbip_device *ud);void usbip_stop_eh (struct usbip_device *ud);void usbip_event_add (struct usbip_device *ud,unsigned long event);int usbip_event_happened (struct usbip_device *ud); -#endif
Signature · 1 line
1.7.5.1
PATCH 6/16 staging: usbip: usbip_common.c: coding style cleanup
In reply to matt mooneyFix alignment for consistency, checkpatch.pl warning of line over 80 characters, and remove extraneous lines.
--- drivers/staging/usbip/usbip_common.c | 107 +++++++++++++++------------------- 1 files changed, 46 insertions(+), 61 deletions(-)
drivers/staging/usbip/usbip_common.c +46 -60
@@ -27,7 +27,8 @@/* version information */ #define DRIVER_VERSION "1.0" -#define DRIVER_AUTHOR "Takahiro Hirofuchi <hirofuchi _at_ users.sourceforge.net>" +#define DRIVER_AUTHOR \ + "Takahiro Hirofuchi <hirofuchi _at_ users.sourceforge.net>"#define DRIVER_DESC "usbip common driver"/*-------------------------------------------------------------------------*/
@@ -40,23 +41,20 @@ unsigned long usbip_debug_flag;#endif EXPORT_SYMBOL_GPL (usbip_debug_flag); -/* FIXME */ struct device_attribute dev_attr_usbip_debug;EXPORT_SYMBOL_GPL (dev_attr_usbip_debug); -static ssize_t show_flag (struct device *dev,struct device_attribute *attr, -char *buf) +char *buf) {return sprintf (buf,"%lx\n" , usbip_debug_flag); }static ssize_t store_flag (struct device *dev,struct device_attribute *attr, -const char *buf,size_t count) +const char *buf,size_t count) {sscanf (buf,"%lx" , &usbip_debug_flag); -return count; }DEVICE_ATTR (usbip_debug, (S_IRUGO |S_IWUSR ), show_flag, store_flag);
@@ -298,7 +296,7 @@ void usbip_dump_urb(struct urb *urb)dev_dbg (dev," setup_packet :%p\n" , urb->setup_packet);if (urb->setup_packet &&usb_pipetype (urb->pipe) =PIPE_CONTROL ) -usbip_dump_usb_ctrlrequest ( +usbip_dump_usb_ctrlrequest ( (struct usb_ctrlrequest *)urb->setup_packet);dev_dbg (dev," start_frame :%d\n" , urb->start_frame);
@@ -313,32 +311,32 @@ EXPORT_SYMBOL_GPL(usbip_dump_urb);void usbip_dump_header (struct usbip_header *pdu) {usbip_udbg ("BASE: cmd %u seq %u devid %u dir %u ep %u\n" , - pdu->base.command, - pdu->base.seqnum, - pdu->base.devid, - pdu->base.direction, - pdu->base.ep); + pdu->base.command, + pdu->base.seqnum, + pdu->base.devid, + pdu->base.direction, + pdu->base.ep);switch (pdu->base.command) {case USBIP_CMD_SUBMIT :usbip_udbg ("CMD_SUBMIT: " -"x_flags %u x_len %u sf %u #p %u iv %u\n" , - pdu->u.cmd_submit.transfer_flags, - pdu->u.cmd_submit.transfer_buffer_length, - pdu->u.cmd_submit.start_frame, - pdu->u.cmd_submit.number_of_packets, - pdu->u.cmd_submit.interval); -break ; +"x_flags %u x_len %u sf %u #p %u iv %u\n" , + pdu->u.cmd_submit.transfer_flags, + pdu->u.cmd_submit.transfer_buffer_length, + pdu->u.cmd_submit.start_frame, + pdu->u.cmd_submit.number_of_packets, + pdu->u.cmd_submit.interval); +break ;case USBIP_CMD_UNLINK :usbip_udbg ("CMD_UNLINK: seq %u\n" , pdu->u.cmd_unlink.seqnum);break ;case USBIP_RET_SUBMIT :usbip_udbg ("RET_SUBMIT: st %d al %u sf %d #p %d ec %d\n" , - pdu->u.ret_submit.status, - pdu->u.ret_submit.actual_length, - pdu->u.ret_submit.start_frame, - pdu->u.ret_submit.number_of_packets, - pdu->u.ret_submit.error_count); + pdu->u.ret_submit.status, + pdu->u.ret_submit.actual_length, + pdu->u.ret_submit.start_frame, + pdu->u.ret_submit.number_of_packets, + pdu->u.ret_submit.error_count);case USBIP_RET_UNLINK :usbip_udbg ("RET_UNLINK: status %d\n" , pdu->u.ret_unlink.status);break ;
@@ -352,7 +350,7 @@ EXPORT_SYMBOL_GPL(usbip_dump_header);/*-------------------------------------------------------------------------*/ /* socket routines */ -/* Send/receive messages over TCP/IP. I refer drivers/block/nbd.c */ +/* Send/receive messages over TCP/IP. I refer drivers/block/nbd.c */ int usbip_xmit (int send,struct socket *sock,char *buf,int size,int msg_flags) {
@@ -373,7 +371,6 @@ int usbip_xmit(int send, struct socket *sock, char *buf,return -EINVAL ; } -if (usbip_dbg_flag_xmit) {if (send) {if (!in_interrupt ())
@@ -388,7 +385,6 @@ int usbip_xmit(int send, struct socket *sock, char *buf, } } - do { sock->sk->sk_allocation = GFP_NOIO; iov.iov_base = buf;
@@ -404,13 +400,12 @@ int usbip_xmit(int send, struct socket *sock, char *buf, result =kernel_sendmsg (sock, &msg, &iov,1 , size); else result =kernel_recvmsg (sock, &msg, &iov,1 , size, -MSG_WAITALL ); +MSG_WAITALL );if (result <=0 ) {usbip_udbg ("usbip_xmit: %s sock %p buf %p size %u ret " -"%d total %d\n" , - send ?"send" :"receive" , sock, buf, - size, result, total); +"%d total %d\n" , send ?"send" :"receive" , + sock, buf, size, result, total); goto err; }
@@ -420,7 +415,6 @@ int usbip_xmit(int send, struct socket *sock, char *buf, }while (size >0 ); -if (usbip_dbg_flag_xmit) {if (!send) {if (!in_interrupt ())
@@ -431,13 +425,13 @@ int usbip_xmit(int send, struct socket *sock, char *buf,printk (KERN_DEBUG "usbip_xmit: receiving....\n" );usbip_dump_buffer (bp, osize);printk (KERN_DEBUG "usbip_xmit: received, osize %d ret " -"%d size %d total %d\n" , osize, result, - size, total); +"%d size %d total %d\n" , osize, result, size, + total); }if (send)printk (KERN_DEBUG "usbip_xmit: send, total %d\n" , - total); + total); }return total;
@@ -470,8 +464,6 @@ struct socket *sockfd_to_socket(unsigned int sockfd) }EXPORT_SYMBOL_GPL (sockfd_to_socket); - -/*-------------------------------------------------------------------------*/ /* pdu routines */
@@ -483,7 +475,7 @@ static unsigned int tweak_transfer_flags(unsigned int flags) }static void usbip_pack_cmd_submit (struct usbip_header *pdu,struct urb *urb, -int pack) +int pack) {struct usbip_header_cmd_submit *spdu = &pdu->u.cmd_submit;
@@ -494,7 +486,7 @@ static void usbip_pack_cmd_submit(struct usbip_header *pdu, struct urb *urb,if (pack) {/* vhci_tx.c */ spdu->transfer_flags -tweak_transfer_flags (urb->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;
@@ -511,7 +503,7 @@ static void usbip_pack_cmd_submit(struct usbip_header *pdu, struct urb *urb, }static void usbip_pack_ret_submit (struct usbip_header *pdu,struct urb *urb, -int pack) +int pack) {struct usbip_header_ret_submit *rpdu = &pdu->u.ret_submit;
@@ -534,9 +526,8 @@ static void usbip_pack_ret_submit(struct usbip_header *pdu, struct urb *urb, } } -void usbip_pack_pdu (struct usbip_header *pdu,struct urb *urb,int cmd, -int pack) +int pack) {switch (cmd) {case USBIP_CMD_SUBMIT :
@@ -553,7 +544,6 @@ void usbip_pack_pdu(struct usbip_header *pdu, struct urb *urb, int cmd, }EXPORT_SYMBOL_GPL (usbip_pack_pdu); -static void correct_endian_basic (struct usbip_header_basic *base,int send) {if (send) {
@@ -572,7 +562,7 @@ static void correct_endian_basic(struct usbip_header_basic *base, int send) }static void correct_endian_cmd_submit (struct usbip_header_cmd_submit *pdu, -int send) +int send) {if (send) { pdu->transfer_flags =cpu_to_be32 (pdu->transfer_flags);
@@ -592,7 +582,7 @@ static void correct_endian_cmd_submit(struct usbip_header_cmd_submit *pdu, }static void correct_endian_ret_submit (struct usbip_header_ret_submit *pdu, -int send) +int send) {if (send) {cpu_to_be32s (&pdu->status);
@@ -610,7 +600,7 @@ static void correct_endian_ret_submit(struct usbip_header_ret_submit *pdu, }static void correct_endian_cmd_unlink (struct usbip_header_cmd_unlink *pdu, -int send) +int send) {if (send) pdu->seqnum =cpu_to_be32 (pdu->seqnum);
@@ -619,7 +609,7 @@ static void correct_endian_cmd_unlink(struct usbip_header_cmd_unlink *pdu, }static void correct_endian_ret_unlink (struct usbip_header_ret_unlink *pdu, -int send) +int send) {if (send)cpu_to_be32s (&pdu->status);
@@ -661,8 +651,8 @@ void usbip_header_correct_endian(struct usbip_header *pdu, int send)EXPORT_SYMBOL_GPL (usbip_header_correct_endian);static void usbip_iso_pakcet_correct_endian ( -struct usbip_iso_packet_descriptor *iso, -int send) +struct usbip_iso_packet_descriptor *iso, +int send) {/* does not need all members. but copy all simply. */ if (send) {
@@ -679,7 +669,7 @@ static void usbip_iso_pakcet_correct_endian( }static void usbip_pack_iso (struct usbip_iso_packet_descriptor *iso, -struct usb_iso_packet_descriptor *uiso,int pack) +struct usb_iso_packet_descriptor *uiso,int pack) {if (pack) { iso->offset = uiso->offset;
@@ -694,7 +684,6 @@ static void usbip_pack_iso(struct usbip_iso_packet_descriptor *iso, } } -/* must free buffer */ void *usbip_alloc_iso_desc_pdu (struct urb *urb,ssize_t *bufflen) {
@@ -760,7 +749,6 @@ int usbip_recv_iso(struct usbip_device *ud, struct urb *urb)return -EPIPE ; } -for (i =0 ; i < np; i++) { iso = buff + (i *sizeof (*iso));
@@ -773,8 +761,9 @@ int usbip_recv_iso(struct usbip_device *ud, struct urb *urb)if (total_length != urb->actual_length) {dev_err (&urb->dev->dev, -"total length of iso packets (%d) not equal to actual length of buffer (%d)\n" , - total_length, urb->actual_length); +"total length of iso packets %d not equal to actual " +"length of buffer %d\n" , + total_length, urb->actual_length);if (ud->side =USBIP_STUB )usbip_event_add (ud,SDEV_EVENT_ERROR_TCP );
@@ -823,9 +812,10 @@ int usbip_pad_iso(struct usbip_device *ud, struct urb *urb)for (i = np-1 ; i >0 ; i--) { actualoffset -= urb->iso_frame_desc[i].actual_length;memmove (urb->transfer_buffer + urb->iso_frame_desc[i].offset, - urb->transfer_buffer + actualoffset, - urb->iso_frame_desc[i].actual_length); + urb->transfer_buffer + actualoffset, + urb->iso_frame_desc[i].actual_length); } +return ret; }EXPORT_SYMBOL_GPL (usbip_pad_iso);
@@ -872,13 +862,11 @@ int usbip_recv_xbuff(struct usbip_device *ud, struct urb *urb) }EXPORT_SYMBOL_GPL (usbip_recv_xbuff); -/*-------------------------------------------------------------------------*/ static int __init usbip_common_init (void ) { printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_DESC "" DRIVER_VERSION); -return 0 ; }
@@ -887,9 +875,6 @@ static void __exit usbip_common_exit(void)return ; } - - -module_init (usbip_common_init);module_exit (usbip_common_exit);
Signature · 1 line
1.7.5.1
PATCH 7/16 staging: usbip: usbip_event.c: coding style cleanup
In reply to matt mooneyFix a few alignment issues and remove extraneous lines.
--- drivers/staging/usbip/usbip_event.c | 18 ++++++------------ 1 files changed, 6 insertions(+), 12 deletions(-)
drivers/staging/usbip/usbip_event.c +6 -12
@@ -17,8 +17,8 @@* USA. */ -#include "usbip_common.h" #include <linux/kthread.h> +#include "usbip_common.h" static int event_handler (struct usbip_device *ud) {
@@ -36,21 +36,18 @@ static int event_handler(struct usbip_device *ud)*/ if (ud->event &USBIP_EH_SHUTDOWN ) { ud->eh_ops.shutdown (ud); - ud->event &= ~USBIP_EH_SHUTDOWN ; }/* Reset the device. */ if (ud->event &USBIP_EH_RESET ) { ud->eh_ops.reset (ud); - ud->event &= ~USBIP_EH_RESET ; }/* Mark the device as unusable. */ if (ud->event &USBIP_EH_UNUSABLE ) { ud->eh_ops.unusable (ud); - ud->event &= ~USBIP_EH_UNUSABLE ; }
@@ -68,13 +65,14 @@ static int event_handler_loop(void *data)while (!kthread_should_stop ()) {wait_event_interruptible (ud->eh_waitq, -usbip_event_happened (ud) || -kthread_should_stop ()); +usbip_event_happened (ud) || +kthread_should_stop ());usbip_dbg_eh ("wakeup\n" );if (event_handler (ud) <0 )break ; } +return 0 ; }
@@ -86,9 +84,10 @@ int usbip_start_eh(struct usbip_device *ud) ud->eh =kthread_run (event_handler_loop, ud,"usbip_eh" );if (IS_ERR (ud->eh)) {printk (KERN_WARNING -"Unable to start control thread\n" ); +"Unable to start control thread\n" );return PTR_ERR (ud->eh); } +return 0 ; }EXPORT_SYMBOL_GPL (usbip_start_eh);
@@ -106,11 +105,8 @@ EXPORT_SYMBOL_GPL(usbip_stop_eh);void usbip_event_add (struct usbip_device *ud,unsigned long event) {spin_lock (&ud->lock); - ud->event |= event; -wake_up (&ud->eh_waitq); -spin_unlock (&ud->lock); }EXPORT_SYMBOL_GPL (usbip_event_add);
@@ -120,10 +116,8 @@ int usbip_event_happened(struct usbip_device *ud)int happened =0 ;spin_lock (&ud->lock); -if (ud->event !=0 ) happened =1 ; -spin_unlock (&ud->lock);return happened;
Signature · 1 line
1.7.5.1
PATCH 8/16 staging: usbip: stub.h: coding style cleanup
In reply to matt mooneyRemove extraneous lines.
--- drivers/staging/usbip/stub.h | 2 -- 1 files changed, 0 insertions(+), 2 deletions(-)
drivers/staging/usbip/stub.h +0 -2
@@ -58,7 +58,6 @@ struct stub_device {struct list_head unlink_tx;struct list_head unlink_free; -wait_queue_head_t tx_waitq; };
@@ -89,7 +88,6 @@ struct bus_id_priv {extern struct kmem_cache *stub_priv_cache; -/*-------------------------------------------------------------------------*/ /* prototype declarations */
Signature · 1 line
1.7.5.1
PATCH 9/16 staging: usbip: vhci.h: coding style cleanup
In reply to matt mooneyFix a few alignment issues and remove extraneous lines.
--- drivers/staging/usbip/vhci.h | 21 +++++++-------------- 1 files changed, 7 insertions(+), 14 deletions(-)
drivers/staging/usbip/vhci.h +7 -14
@@ -20,7 +20,6 @@#include <linux/platform_device.h> #include <linux/usb/hcd.h> -struct vhci_device {struct usb_device *udev;
@@ -33,12 +32,11 @@ struct vhci_device {/* speed of a remote device */ enum usb_device_speed speed; -/* vhci root-hub port to which this device is attached */ +/* vhci root-hub port to which this device is attached */ __u32 rhport;struct usbip_device ud; -/* lock for the below link lists */ spinlock_t priv_lock;
@@ -54,7 +52,6 @@ struct vhci_device {wait_queue_head_t waitq_tx; }; -/* urb->hcpriv, use container_of() */ struct vhci_priv {unsigned long seqnum;
@@ -64,7 +61,6 @@ struct vhci_priv {struct urb *urb; }; -struct vhci_unlink {/* seqnum of this request */ unsigned long seqnum;
@@ -85,12 +81,12 @@ struct vhci_unlink {/* for usb_bus.hcpriv */ struct vhci_hcd { -spinlock_t lock; +spinlock_t lock; -u32 port_status[VHCI_NPORTS ]; +u32 port_status[VHCI_NPORTS ]; -unsigned resuming:1 ; -unsigned long re_timeout; +unsigned resuming:1 ; +unsigned long re_timeout;atomic_t seqnum;
@@ -102,11 +98,9 @@ struct vhci_hcd {struct vhci_device vdev[VHCI_NPORTS ]; }; -extern struct vhci_hcd *the_controller;extern struct attribute_group dev_attr_group; -/*-------------------------------------------------------------------------*/ /* prototype declaration */
@@ -116,10 +110,9 @@ void rh_port_disconnect(int rhport);int vhci_rx_loop (void *data);int vhci_tx_loop (void *data); -struct urb *pickup_urb_and_free_priv (struct vhci_device *vdev, -__u32 seqnum); +struct urb *pickup_urb_and_free_priv (struct vhci_device *vdev,__u32 seqnum); -#define hardware (&the_controller->pdev.dev) +#define hardware (&the_controller->pdev.dev)static inline struct vhci_device *port_to_vdev (__u32 port) {
Signature · 1 line
1.7.5.1
PATCH 10/16 staging: usbip: vhci_hcd.c: coding style cleanup
In reply to matt mooneyFix alignment for consistency and remove extraneous lines. Move MODULE_ macros to the end of file.
Make bit_desc[] an array of const pointers.
Add KERN_ level to a couple of printks.
--- drivers/staging/usbip/vhci_hcd.c | 187 +++++++++++++++---------------------- 1 files changed, 76 insertions(+), 111 deletions(-)
drivers/staging/usbip/vhci_hcd.c +76 -98
@@ -27,11 +27,6 @@#define DRIVER_AUTHOR "Takahiro Hirofuchi"#define DRIVER_DESC "Virtual Host Controller Interface Driver for USB/IP"#define DRIVER_LICENCE "GPL" -MODULE_AUTHOR (DRIVER_AUTHOR ); -MODULE_DESCRIPTION (DRIVER_DESC ); -MODULE_LICENSE (DRIVER_LICENCE ); - -/* * TODO
@@ -43,15 +38,13 @@ MODULE_LICENSE(DRIVER_LICENCE);* - clean up everything */ -/* See usb gadget dummy hcd */ -static int vhci_hub_status (struct usb_hcd *hcd,char *buff);static int vhci_hub_control (struct usb_hcd *hcd,u16 typeReq,u16 wValue, -u16 wIndex,char *buff,u16 wLength); +u16 wIndex,char *buff,u16 wLength);static int vhci_urb_enqueue (struct usb_hcd *hcd,struct urb *urb, -gfp_t mem_flags); +gfp_t mem_flags);static int vhci_urb_dequeue (struct usb_hcd *hcd,struct urb *urb,int status);static int vhci_start (struct usb_hcd *vhci_hcd);static void vhci_stop (struct usb_hcd *hcd);
@@ -62,42 +55,41 @@ static const char driver_desc[] = "USB/IP Virtual Host Controller";struct vhci_hcd *the_controller; -static const char *bit_desc[] = { +static const char *const bit_desc[] = {"CONNECTION" ,/*0*/ "ENABLE" ,/*1*/ "SUSPEND" ,/*2*/ "OVER_CURRENT" ,/*3*/ "RESET" ,/*4*/ -"R5" ,/*5*/ -"R6" ,/*6*/ -"R7" ,/*7*/ +"R5" ,/*5*/ +"R6" ,/*6*/ +"R7" ,/*7*/ "POWER" ,/*8*/ "LOWSPEED" ,/*9*/ "HIGHSPEED" ,/*10*/ "PORT_TEST" ,/*11*/ "INDICATOR" ,/*12*/ -"R13" ,/*13*/ -"R14" ,/*14*/ -"R15" ,/*15*/ +"R13" ,/*13*/ +"R14" ,/*14*/ +"R15" ,/*15*/ "C_CONNECTION" ,/*16*/ "C_ENABLE" ,/*17*/ "C_SUSPEND" ,/*18*/ "C_OVER_CURRENT" ,/*19*/ "C_RESET" ,/*20*/ -"R21" ,/*21*/ -"R22" ,/*22*/ -"R23" ,/*23*/ -"R24" ,/*24*/ -"R25" ,/*25*/ -"R26" ,/*26*/ -"R27" ,/*27*/ -"R28" ,/*28*/ -"R29" ,/*29*/ -"R30" ,/*30*/ -"R31" ,/*31*/ +"R21" ,/*21*/ +"R22" ,/*22*/ +"R23" ,/*23*/ +"R24" ,/*24*/ +"R25" ,/*25*/ +"R26" ,/*26*/ +"R27" ,/*27*/ +"R28" ,/*28*/ +"R29" ,/*29*/ +"R30" ,/*30*/ +"R31" ,/*31*/ }; -static void dump_port_status (u32 status) {int i =0 ;
@@ -105,14 +97,11 @@ static void dump_port_status(u32 status)printk (KERN_DEBUG "status %08x:" , status);for (i =0 ; i <32 ; i++) {if (status & (1 << i)) -printk (" %s" , bit_desc[i]); +printk (KERN_DEBUG " %s" , bit_desc[i]); } - -printk ("\n" ); +printk (KERN_DEBUG "\n" ); } - -void rh_port_connect (int rhport,enum usb_device_speed speed) {unsigned long flags;
@@ -156,26 +145,22 @@ void rh_port_disconnect(int rhport) 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)); } - -/*----------------------------------------------------------------------*/ -#define PORT_C_MASK \ - ((USB_PORT_STAT_C_CONNECTION \ - | USB_PORT_STAT_C_ENABLE \ - | USB_PORT_STAT_C_SUSPEND \ - | USB_PORT_STAT_C_OVERCURRENT \ +#define PORT_C_MASK \ + ((USB_PORT_STAT_C_CONNECTION \ + | USB_PORT_STAT_C_ENABLE \ + | USB_PORT_STAT_C_SUSPEND \ + | USB_PORT_STAT_C_OVERCURRENT \ | USB_PORT_STAT_C_RESET) << 16)/*
@@ -210,7 +195,6 @@ static int vhci_hub_status(struct usb_hcd *hcd, char *buf)int rhport;int changed =0 ; - *event_bits =0 ; vhci =hcd_to_vhci (hcd);
@@ -278,10 +262,10 @@ static int vhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,* wIndex shows the port number and begins from 1. */ usbip_dbg_vhci_rh ("typeReq %x wValue %x wIndex %x\n" , typeReq, wValue, - wIndex); + wIndex);if (wIndex >VHCI_NPORTS )printk (KERN_ERR "%s: invalid port number %d\n" , __func__, - wIndex); + wIndex); rhport = ((__u8)(wIndex &0x00ff )) -1 ; dum =hcd_to_vhci (hcd);
@@ -311,7 +295,7 @@ static int vhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,break ;case USB_PORT_FEAT_POWER :usbip_dbg_vhci_rh (" ClearPortFeature: " -"USB_PORT_FEAT_POWER\n" ); +"USB_PORT_FEAT_POWER\n" ); dum->port_status[rhport] =0 ;/* dum->address = 0; */ /* dum->hdev = 0; */
@@ -319,22 +303,22 @@ static int vhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,break ;case USB_PORT_FEAT_C_RESET :usbip_dbg_vhci_rh (" ClearPortFeature: " -"USB_PORT_FEAT_C_RESET\n" ); +"USB_PORT_FEAT_C_RESET\n" );switch (dum->vdev[rhport].speed) {case USB_SPEED_HIGH : dum->port_status[rhport] |-USB_PORT_STAT_HIGH_SPEED ; +USB_PORT_STAT_HIGH_SPEED ;break ;case USB_SPEED_LOW : dum->port_status[rhport] |-USB_PORT_STAT_LOW_SPEED ; +USB_PORT_STAT_LOW_SPEED ;break ;default :break ; }default :usbip_dbg_vhci_rh (" ClearPortFeature: default %x\n" , - wValue); + wValue); dum->port_status[rhport] &= ~(1 << wValue); }break ;
@@ -375,39 +359,38 @@ static int vhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, } if ((dum->port_status[rhport] & (1 << USB_PORT_FEAT_RESET)) !- 0 && time_after(jiffies, dum->re_timeout)) { + 0 && time_after(jiffies, dum->re_timeout)) { dum->port_status[rhport] |- (1 <<USB_PORT_FEAT_C_RESET ); + (1 <<USB_PORT_FEAT_C_RESET ); dum->port_status[rhport] &- ~(1 <<USB_PORT_FEAT_RESET ); + ~(1 <<USB_PORT_FEAT_RESET ); dum->re_timeout =0 ;if (dum->vdev[rhport].ud.status = -VDEV_ST_NOTASSIGNED ) { +VDEV_ST_NOTASSIGNED ) {usbip_dbg_vhci_rh (" enable rhport %d " -"(status %u)\n" , - rhport, - dum->vdev[rhport].ud.status); +"(status %u)\n" , + rhport, + dum->vdev[rhport].ud.status); dum->port_status[rhport] |-USB_PORT_STAT_ENABLE ; +USB_PORT_STAT_ENABLE ; }#if 0 if (dum->driver) { - dum->port_status[rhport] |-USB_PORT_STAT_ENABLE ; +USB_PORT_STAT_ENABLE ;/* give it the best speed we agree on */ dum->gadget.speed = dum->driver->speed; dum->gadget.ep0->maxpacket =64 ;switch (dum->gadget.speed) {case USB_SPEED_HIGH : dum->port_status[rhport] |-USB_PORT_STAT_HIGH_SPEED ; +USB_PORT_STAT_HIGH_SPEED ;break ;case USB_SPEED_LOW : dum->gadget.ep0->maxpacket =8 ; dum->port_status[rhport] |-USB_PORT_STAT_LOW_SPEED ; +USB_PORT_STAT_LOW_SPEED ;break ;default : dum->gadget.speed =USB_SPEED_FULL ;
@@ -415,14 +398,12 @@ static int vhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, } }#endif - } ((u16 *) buf)[0 ] =cpu_to_le16 (dum->port_status[rhport]); - ((u16 *) buf)[1 ] -cpu_to_le16 (dum->port_status[rhport] >>16 ); + ((u16 *) buf)[1 ] =cpu_to_le16 (dum->port_status[rhport] >>16 );usbip_dbg_vhci_rh (" GetPortStatus bye %x %x\n" , ((u16 *)buf)[0 ], - ((u16 *)buf)[1 ]); + ((u16 *)buf)[1 ]);break ;case SetHubFeature:usbip_dbg_vhci_rh (" SetHubFeature\n" );
@@ -432,11 +413,11 @@ static int vhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,switch (wValue) {case USB_PORT_FEAT_SUSPEND :usbip_dbg_vhci_rh (" SetPortFeature: " -"USB_PORT_FEAT_SUSPEND\n" ); +"USB_PORT_FEAT_SUSPEND\n" );printk (KERN_ERR "%s: not yet\n" , __func__);#if 0 dum->port_status[rhport] |- (1 <<USB_PORT_FEAT_SUSPEND ); + (1 <<USB_PORT_FEAT_SUSPEND );if (dum->driver->suspend) {spin_unlock (&dum->lock); dum->driver->suspend (&dum->gadget);
@@ -446,13 +427,13 @@ static int vhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,break ;case USB_PORT_FEAT_RESET :usbip_dbg_vhci_rh (" SetPortFeature: " -"USB_PORT_FEAT_RESET\n" ); +"USB_PORT_FEAT_RESET\n" );/* if it's already running, disconnect first */ if (dum->port_status[rhport] &USB_PORT_STAT_ENABLE ) { dum->port_status[rhport] &- ~(USB_PORT_STAT_ENABLE | -USB_PORT_STAT_LOW_SPEED | -USB_PORT_STAT_HIGH_SPEED ); + ~(USB_PORT_STAT_ENABLE | +USB_PORT_STAT_LOW_SPEED | + USB_PORT_STAT_HIGH_SPEED);#if 0 if (dum->driver) {dev_dbg (hardware,"disconnect\n" );
@@ -468,7 +449,7 @@ static int vhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,/* FALLTHROUGH */ default :usbip_dbg_vhci_rh (" SetPortFeature: default %d\n" , - wValue); + wValue); dum->port_status[rhport] |= (1 << wValue); }break ;
@@ -545,7 +526,6 @@ static void vhci_tx_urb(struct urb *urb) urb->hcpriv = (void *) priv; -list_add_tail (&priv->list, &vdev->priv_tx);wake_up (&vdev->waitq_tx);
@@ -561,7 +541,7 @@ static int vhci_urb_enqueue(struct usb_hcd *hcd, struct urb *urb,struct vhci_device *vdev;usbip_dbg_vhci_hc ("enter, usb_hcd %p urb %p mem_flags %d\n" , - hcd, urb, mem_flags); + hcd, urb, mem_flags);/* patch to usb_sg_init() is in 2.5.60 */ BUG_ON (!urb->transfer_buffer && urb->transfer_buffer_length);
@@ -578,7 +558,8 @@ static int vhci_urb_enqueue(struct usb_hcd *hcd, struct urb *urb,/* refuse enqueue for dead connection */ spin_lock (&vdev->ud.lock); -if (vdev->ud.status =VDEV_ST_NULL || vdev->ud.status =VDEV_ST_ERROR ) { +if (vdev->ud.status =VDEV_ST_NULL || + vdev->ud.status =VDEV_ST_ERROR ) {usbip_uerr ("enqueue for inactive port %d\n" , vdev->rhport);spin_unlock (&vdev->ud.lock);spin_unlock_irqrestore (&the_controller->lock, flags);
@@ -599,11 +580,10 @@ static int vhci_urb_enqueue(struct usb_hcd *hcd, struct urb *urb,* 2. Set_Address request to DevAddr(0) EndPoint(0) * */ -if (usb_pipedevice (urb->pipe) =0 ) {__u8 type =usb_pipetype (urb->pipe); struct usb_ctrlrequest *ctrlreq - (struct usb_ctrlrequest *) urb->setup_packet; + (struct usb_ctrlrequest *) urb->setup_packet;if (type !=PIPE_CONTROL || !ctrlreq) {dev_err (dev,"invalid request to devnum 0\n" );
@@ -636,8 +616,8 @@ static int vhci_urb_enqueue(struct usb_hcd *hcd, struct urb *urb,case USB_REQ_GET_DESCRIPTOR :if (ctrlreq->wValue = (USB_DT_DEVICE <<8 ))usbip_dbg_vhci_hc ("Not yet?: " -"Get_Descriptor to device 0 " -"(get max pipe size)\n" ); +"Get_Descriptor to device 0 " +"(get max pipe size)\n" );if (vdev->udev)usb_put_dev (vdev->udev);
@@ -657,7 +637,6 @@ static int vhci_urb_enqueue(struct usb_hcd *hcd, struct urb *urb, out:vhci_tx_urb (urb); -spin_unlock_irqrestore (&the_controller->lock, flags);return 0 ;
@@ -726,7 +705,6 @@ static int vhci_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status)usbip_uinfo ("vhci_hcd: dequeue a urb %p\n" , urb); -spin_lock_irqsave (&the_controller->lock, flags); priv = urb->hcpriv;
@@ -756,7 +734,7 @@ static int vhci_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status)spin_lock_irqsave (&vdev->priv_lock, flags2);usbip_uinfo ("vhci_hcd: device %p seems to be disconnected\n" , - vdev); + vdev);list_del (&priv->list);kfree (priv); urb->hcpriv =NULL ;
@@ -769,13 +747,13 @@ static int vhci_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status)* Otherwise, we give back it here. */ usbip_uinfo ("vhci_hcd: vhci_urb_dequeue() gives back urb %p\n" , - urb); + urb);usb_hcd_unlink_urb_from_ep (hcd, urb);spin_unlock_irqrestore (&the_controller->lock, flags);usb_hcd_giveback_urb (vhci_to_hcd (the_controller), urb, - urb->status); + urb->status);spin_lock_irqsave (&the_controller->lock, flags); }else {
@@ -802,7 +780,7 @@ static int vhci_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status) unlink->unlink_seqnum = priv->seqnum;usbip_uinfo ("vhci_hcd: device %p seems to be still connected\n" , - vdev); + vdev);/* send cmd_unlink and try to cancel the pending URB in the * peer */
@@ -838,8 +816,8 @@ static void vhci_device_unlink_cleanup(struct vhci_device *vdev) urb =pickup_urb_and_free_priv (vdev, unlink->unlink_seqnum);if (!urb) { -usbip_uinfo ("the urb (seqnum %lu) was already given back\n" , - unlink->unlink_seqnum); +usbip_uinfo ("the urb (seqnum %lu) was already given " +"back\n" , unlink->unlink_seqnum);list_del (&unlink->list);kfree (unlink);continue ;
@@ -851,7 +829,8 @@ static void vhci_device_unlink_cleanup(struct vhci_device *vdev)usb_hcd_unlink_urb_from_ep (vhci_to_hcd (the_controller), urb);spin_unlock (&the_controller->lock); -usb_hcd_giveback_urb (vhci_to_hcd (the_controller), urb, urb->status); +usb_hcd_giveback_urb (vhci_to_hcd (the_controller), urb, + urb->status);list_del (&unlink->list);kfree (unlink);
@@ -932,7 +911,6 @@ static void vhci_device_reset(struct usbip_device *ud) vdev->udev =NULL ; ud->tcp_socket =NULL ; - ud->status =VDEV_ST_NULL ;spin_unlock (&ud->lock);
@@ -941,9 +919,7 @@ static void vhci_device_reset(struct usbip_device *ud)static void vhci_device_unusable (struct usbip_device *ud) {spin_lock (&ud->lock); - ud->status =VDEV_ST_ERROR ; -spin_unlock (&ud->lock); }
@@ -983,7 +959,6 @@ static int vhci_start(struct usb_hcd *hcd)usbip_dbg_vhci_hc ("enter vhci_start\n" ); -/* initialize private data of usb_hcd */ for (rhport =0 ; rhport <VHCI_NPORTS ; rhport++) {
@@ -995,13 +970,10 @@ static int vhci_start(struct usb_hcd *hcd)atomic_set (&vhci->seqnum,0 );spin_lock_init (&vhci->lock); - - hcd->power_budget =0 ;/* no limit */ hcd->state =HC_STATE_RUNNING ; hcd->uses_new_polling =1 ; -/* vhci_hcd is now ready to be controlled through sysfs */ err =sysfs_create_group (&vhci_dev (vhci)->kobj, &dev_attr_group);if (err) {
@@ -1019,7 +991,6 @@ static void vhci_stop(struct usb_hcd *hcd)usbip_dbg_vhci_hc ("stop VHCI controller\n" ); -/* 1. remove the userland interface of vhci_hcd */ sysfs_remove_group (&vhci_dev (vhci)->kobj, &dev_attr_group);
@@ -1031,7 +1002,6 @@ static void vhci_stop(struct usb_hcd *hcd)usbip_stop_eh (&vdev->ud); } -usbip_uinfo ("vhci_stop done\n" ); }
@@ -1043,7 +1013,6 @@ static int vhci_get_frame_number(struct usb_hcd *hcd)return 0 ; } -#ifdef CONFIG_PM /* FIXME: suspend/resume */
@@ -1091,8 +1060,6 @@ static int vhci_bus_resume(struct usb_hcd *hcd)#define vhci_bus_resume NULL#endif - -static struct hc_driver vhci_hc_driver = { .description = driver_name, .product_desc = driver_desc,
@@ -1155,12 +1122,10 @@ static int vhci_hcd_probe(struct platform_device *pdev)return ret; } -usbip_dbg_vhci_hc ("bye\n" );return 0 ; } -static int vhci_hcd_remove (struct platform_device *pdev) {struct usb_hcd *hcd;
@@ -1178,12 +1143,9 @@ static int vhci_hcd_remove(struct platform_device *pdev)usb_put_hcd (hcd); the_controller =NULL ; -return 0 ; } - -#ifdef CONFIG_PM /* what should happen for USB/IP under suspend/resume? */
@@ -1202,14 +1164,14 @@ static int vhci_hcd_suspend(struct platform_device *pdev, pm_message_t state)for (rhport =0 ; rhport <VHCI_NPORTS ; rhport++)if (the_controller->port_status[rhport] & -USB_PORT_STAT_CONNECTION ) +USB_PORT_STAT_CONNECTION ) connected +=1 ;spin_unlock (&the_controller->lock);if (connected >0 ) {usbip_uinfo ("We have %d active connection%s. Do not suspend.\n" , - connected, (connected =1 ?"" :"s" )); + connected, (connected =1 ?"" :"s" )); ret = -EBUSY ; }else {usbip_uinfo ("suspend vhci_hcd" );
@@ -1239,7 +1201,6 @@ static int vhci_hcd_resume(struct platform_device *pdev)#endif -static struct platform_driver vhci_driver = { .probe = vhci_hcd_probe, .remove =__devexit_p (vhci_hcd_remove),
@@ -1298,12 +1259,10 @@ static int __init vhci_init(void)/* error occurred */ err_platform_device_register:platform_driver_unregister (&vhci_driver); - err_driver_register:usbip_dbg_vhci_hc ("bye\n" );return ret; } -module_init (vhci_init); static void __exit vhci_cleanup(void) {
@@ -1314,4 +1273,10 @@ static void __exit vhci_cleanup(void)usbip_dbg_vhci_hc ("bye\n" ); } + +module_init (vhci_init);module_exit (vhci_cleanup); + +MODULE_AUTHOR (DRIVER_AUTHOR ); +MODULE_DESCRIPTION (DRIVER_DESC ); +MODULE_LICENSE (DRIVER_LICENCE );
Signature · 1 line
1.7.5.1
PATCH 11/16 staging: usbip: vhci_rx.c: coding style cleanup
In reply to matt mooneyFix alignment for consistency and remove extraneous lines.
--- drivers/staging/usbip/vhci_rx.c | 44 +++++++++++--------------------------- 1 files changed, 13 insertions(+), 31 deletions(-)
drivers/staging/usbip/vhci_rx.c +13 -31
@@ -23,10 +23,8 @@#include "usbip_common.h" #include "vhci.h" -/* get URB from transmitted urb queue. caller must hold vdev->priv_lock */ -struct urb *pickup_urb_and_free_priv (struct vhci_device *vdev, -__u32 seqnum) +struct urb *pickup_urb_and_free_priv (struct vhci_device *vdev,__u32 seqnum) {struct vhci_priv *priv, *tmp;struct urb *urb =NULL ;
@@ -38,12 +36,12 @@ struct urb *pickup_urb_and_free_priv(struct vhci_device *vdev, status = urb->status;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 */ if (status != -EINPROGRESS ) {if (status = -ENOENT || - status = -ECONNRESET ) + status = -ECONNRESET ) dev_info(&urb->dev->dev, "urb %p was unlinked " "%ssynchronuously.\n", urb,
@@ -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, -struct usbip_header *pdu) +struct usbip_header *pdu) {struct usbip_device *ud = &vdev->ud;struct urb *urb;spin_lock (&vdev->priv_lock); - urb =pickup_urb_and_free_priv (vdev, pdu->base.seqnum); -spin_unlock (&vdev->priv_lock);if (!urb) {usbip_uerr ("cannot find a urb of seqnum %u\n" , - pdu->base.seqnum); + pdu->base.seqnum);usbip_uinfo ("max seqnum %d\n" , -atomic_read (&the_controller->seqnum)); +atomic_read (&the_controller->seqnum));usbip_event_add (ud,VDEV_EVENT_ERROR_TCP );return ; } -/* unpack the pdu to a urb */ usbip_pack_pdu (pdu, urb,USBIP_RET_SUBMIT ,0 ); -/* recv transfer buffer */ if (usbip_recv_xbuff (ud, urb) <0 )return ; -/* recv iso_packet_descriptor */ if (usbip_recv_iso (ud, urb) <0 )return ;
@@ -107,7 +100,6 @@ static void vhci_recv_ret_submit(struct vhci_device *vdev,if (usbip_dbg_flag_vhci_rx)usbip_dump_urb (urb); -usbip_dbg_vhci_rx ("now giveback urb %p\n" , urb);spin_lock (&the_controller->lock);
@@ -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); -usbip_dbg_vhci_rx ("Leave\n" );return ; } -static struct vhci_unlink *dequeue_pending_unlink (struct vhci_device *vdev, -struct usbip_header *pdu) +struct usbip_header *pdu) {struct vhci_unlink *unlink, *tmp;
@@ -134,7 +124,7 @@ static struct vhci_unlink *dequeue_pending_unlink(struct vhci_device *vdev,usbip_uinfo ("unlink->seqnum %lu\n" , unlink->seqnum);if (unlink->seqnum = pdu->base.seqnum) {usbip_dbg_vhci_rx ("found pending unlink, %lu\n" , - unlink->seqnum); + unlink->seqnum);list_del (&unlink->list);spin_unlock (&vdev->priv_lock);
@@ -147,9 +137,8 @@ static struct vhci_unlink *dequeue_pending_unlink(struct vhci_device *vdev,return NULL ; } -static void vhci_recv_ret_unlink (struct vhci_device *vdev, -struct usbip_header *pdu) +struct usbip_header *pdu) {struct vhci_unlink *unlink;struct urb *urb;
@@ -159,14 +148,12 @@ static void vhci_recv_ret_unlink(struct vhci_device *vdev, unlink =dequeue_pending_unlink (vdev, pdu);if (!unlink) {usbip_uinfo ("cannot find the pending unlink %u\n" , - pdu->base.seqnum); + pdu->base.seqnum);return ; }spin_lock (&vdev->priv_lock); - urb =pickup_urb_and_free_priv (vdev, unlink->unlink_seqnum); -spin_unlock (&vdev->priv_lock);if (!urb) {
@@ -176,7 +163,7 @@ static void vhci_recv_ret_unlink(struct vhci_device *vdev,* back the URB. */ usbip_uinfo ("the urb (seqnum %d) was already given backed\n" , - pdu->base.seqnum); + pdu->base.seqnum); }else {usbip_dbg_vhci_rx ("now giveback urb %p\n" , urb);
@@ -189,7 +176,7 @@ static void vhci_recv_ret_unlink(struct vhci_device *vdev,spin_unlock (&the_controller->lock);usb_hcd_giveback_urb (vhci_to_hcd (the_controller), urb, - urb->status); + urb->status); }kfree (unlink);
@@ -202,9 +189,7 @@ static int vhci_priv_tx_empty(struct vhci_device *vdev)int empty =0 ;spin_lock (&vdev->priv_lock); - empty =list_empty (&vdev->priv_rx); -spin_unlock (&vdev->priv_lock);return empty;
@@ -217,7 +202,6 @@ static void vhci_rx_pdu(struct usbip_device *ud)struct usbip_header pdu; struct vhci_device *vdev = container_of(ud, struct vhci_device, ud); -usbip_dbg_vhci_rx ("Enter\n" );memset (&pdu,0 ,sizeof (pdu));
@@ -245,7 +229,7 @@ static void vhci_rx_pdu(struct usbip_device *ud) }if (ret !=sizeof (pdu)) {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 );return ; }
@@ -270,14 +254,12 @@ static void vhci_rx_pdu(struct usbip_device *ud) } } -/*-------------------------------------------------------------------------*/ int vhci_rx_loop (void *data) {struct usbip_device *ud = data; -while (!kthread_should_stop ()) {if (usbip_event_happened (ud))break ;
Signature · 1 line
1.7.5.1
PATCH 12/16 staging: usbip: vhci_sysfs.c: coding style cleanup
In reply to matt mooneyFix a few alignment issues and remove extraneous lines. Add braces to else clause.
--- drivers/staging/usbip/vhci_sysfs.c | 15 ++++++--------- 1 files changed, 6 insertions(+), 9 deletions(-)
drivers/staging/usbip/vhci_sysfs.c +6 -9
@@ -53,20 +53,19 @@ static ssize_t show_status(struct device *dev, struct device_attribute *attr,struct vhci_device *vdev =port_to_vdev (i);spin_lock (&vdev->ud.lock); - out +=sprintf (out,"%03u %03u " , i, vdev->ud.status);if (vdev->ud.status =VDEV_ST_USED ) { out +=sprintf (out,"%03u %08x " , - vdev->speed, vdev->devid); + vdev->speed, vdev->devid); out +=sprintf (out,"%16p " , vdev->ud.tcp_socket); out +=sprintf (out,"%s" ,dev_name (&vdev->udev->dev)); - }else + }else { out +=sprintf (out,"000 000 000 0000000000000000 0-0" ); + } out +=sprintf (out,"\n" ); -spin_unlock (&vdev->ud.lock); }
@@ -127,6 +126,7 @@ static ssize_t store_detach(struct device *dev, struct device_attribute *attr,return -EINVAL ;usbip_dbg_vhci_sysfs ("Leave\n" ); +return count; } static DEVICE_ATTR(detach, S_IWUSR, NULL, store_detach);
@@ -183,8 +183,7 @@ static ssize_t store_attach(struct device *dev, struct device_attribute *attr,sscanf (buf,"%u %u %u %u" , &rhport, &sockfd, &devid, &speed);usbip_dbg_vhci_sysfs ("rhport(%u) sockfd(%u) devid(%u) speed(%u)\n" , - rhport, sockfd, devid, speed); - + rhport, sockfd, devid, speed);/* check received parameters */ if (valid_args (rhport, speed) <0 )
@@ -199,9 +198,7 @@ static ssize_t store_attach(struct device *dev, struct device_attribute *attr,/* begin a lock */ spin_lock (&the_controller->lock); - vdev =port_to_vdev (rhport); -spin_lock (&vdev->ud.lock);if (vdev->ud.status !=VDEV_ST_NULL ) {
@@ -214,7 +211,7 @@ static ssize_t store_attach(struct device *dev, struct device_attribute *attr, }usbip_uinfo ("rhport(%u) sockfd(%d) devid(%u) speed(%u)\n" , - rhport, sockfd, devid, speed); + rhport, sockfd, devid, speed); vdev->devid = devid; vdev->speed = speed;
Signature · 1 line
1.7.5.1
PATCH 13/16 staging: usbip: vhci_tx.c: coding style cleanup
In reply to matt mooneyFix a few alignment issues and remove extraneous lines. Use ternary operator for pdup->base.direction assignment.
--- drivers/staging/usbip/vhci_tx.c | 32 +++++++++++--------------------- 1 files changed, 11 insertions(+), 21 deletions(-)
drivers/staging/usbip/vhci_tx.c +11 -21
@@ -23,23 +23,20 @@#include "usbip_common.h" #include "vhci.h" -static void setup_cmd_submit_pdu (struct usbip_header *pdup,struct urb *urb) {struct vhci_priv *priv = ((struct vhci_priv *)urb->hcpriv);struct vhci_device *vdev = priv->vdev;usbip_dbg_vhci_tx ("URB, local devnum %u, remote devid %u\n" , -usb_pipedevice (urb->pipe), vdev->devid); +usb_pipedevice (urb->pipe), vdev->devid); - pdup->base.command =USBIP_CMD_SUBMIT ; - pdup->base.seqnum = priv->seqnum; - pdup->base.devid = vdev->devid; -if (usb_pipein (urb->pipe)) - pdup->base.direction =USBIP_DIR_IN ; -else - pdup->base.direction =USBIP_DIR_OUT ; - pdup->base.ep =usb_pipeendpoint (urb->pipe); + pdup->base.command =USBIP_CMD_SUBMIT ; + pdup->base.seqnum = priv->seqnum; + pdup->base.devid = vdev->devid; + pdup->base.direction =usb_pipein (urb->pipe) ? +USBIP_DIR_IN :USBIP_DIR_OUT ; + pdup->base.ep =usb_pipeendpoint (urb->pipe);usbip_pack_pdu (pdup, urb,USBIP_CMD_SUBMIT ,1 );
@@ -65,8 +62,6 @@ static struct vhci_priv *dequeue_from_priv_tx(struct vhci_device *vdev)return NULL ; } - -static int vhci_send_cmd_submit (struct vhci_device *vdev) {struct vhci_priv *priv =NULL ;
@@ -90,7 +85,6 @@ static int vhci_send_cmd_submit(struct vhci_device *vdev)usbip_dbg_vhci_tx ("setup txdata urb %p\n" , urb); -/* 1. setup usbip_header */ setup_cmd_submit_pdu (&pdu_header, urb);usbip_header_correct_endian (&pdu_header,1 );
@@ -125,7 +119,7 @@ static int vhci_send_cmd_submit(struct vhci_device *vdev) ret =kernel_sendmsg (vdev->ud.tcp_socket, &msg, iov,3 , txsize);if (ret != txsize) {usbip_uerr ("sendmsg failed!, retval %d for %zd\n" , ret, - txsize); + txsize);kfree (iso_buffer);usbip_event_add (&vdev->ud,VDEV_EVENT_ERROR_TCP );return -1 ;
@@ -140,7 +134,6 @@ static int vhci_send_cmd_submit(struct vhci_device *vdev)return total_size; } -/*-------------------------------------------------------------------------*/ static struct vhci_unlink *dequeue_from_unlink_tx (struct vhci_device *vdev)
@@ -182,7 +175,6 @@ static int vhci_send_cmd_unlink(struct vhci_device *vdev)usbip_dbg_vhci_tx ("setup cmd unlink, %lu\n" , unlink->seqnum); -/* 1. setup usbip_header */ pdu_header.base.command =USBIP_CMD_UNLINK ; pdu_header.base.seqnum = unlink->seqnum;
@@ -204,7 +196,6 @@ static int vhci_send_cmd_unlink(struct vhci_device *vdev)return -1 ; } -usbip_dbg_vhci_tx ("send txdata\n" ); total_size += txsize;
@@ -213,7 +204,6 @@ static int vhci_send_cmd_unlink(struct vhci_device *vdev)return total_size; } -/*-------------------------------------------------------------------------*/ int vhci_tx_loop (void *data)
@@ -229,9 +219,9 @@ int vhci_tx_loop(void *data)break ;wait_event_interruptible (vdev->waitq_tx, - (!list_empty (&vdev->priv_tx) || - !list_empty (&vdev->unlink_tx) || -kthread_should_stop ())); + (!list_empty (&vdev->priv_tx) || + !list_empty (&vdev->unlink_tx) || +kthread_should_stop ()));usbip_dbg_vhci_tx ("pending urbs ?, now wake up\n" ); }
Signature · 1 line
1.7.5.1
PATCH 14/16 staging: usbip: add break to default case in switch statements
In reply to matt mooneyFor consistency, a break statement is added to all default cases that do not jump to a label.
--- drivers/staging/usbip/stub_rx.c | 2 +- drivers/staging/usbip/stub_tx.c | 1 + drivers/staging/usbip/usbip_common.c | 13 ++++++++++--- drivers/staging/usbip/vhci_hcd.c | 2 ++ drivers/staging/usbip/vhci_rx.c | 3 ++- 5 files changed, 16 insertions(+), 5 deletions(-)
drivers/staging/usbip/stub_rx.c +1 -1
@@ -594,7 +594,7 @@ static void stub_rx_pdu(struct usbip_device *ud)/* NOTREACHED */ dev_err (dev,"unknown pdu\n" );usbip_event_add (ud,SDEV_EVENT_ERROR_TCP ); -return ; +break ; } }
drivers/staging/usbip/stub_tx.c +1 -0
@@ -91,6 +91,7 @@ void stub_complete(struct urb *urb)default :usbip_uinfo ("urb completion with non-zero status %d\n" , urb->status); +break ; }/* link a urb to the queue of tx. */
drivers/staging/usbip/usbip_common.c +10 -3
@@ -91,6 +91,7 @@ static void usbip_dump_pipe(unsigned int p)break ;default :printk (KERN_DEBUG "ERR" ); +break ; }printk (KERN_DEBUG "\n" );
@@ -120,6 +121,7 @@ static void usbip_dump_usb_device(struct usb_device *udev)break ;default :printk (KERN_DEBUG " SPD_ERROR" ); +break ; }printk (KERN_DEBUG " tt %p, ttport %d" , udev->tt, udev->ttport);
@@ -187,6 +189,7 @@ static void usbip_dump_request_type(__u8 rt)break ;default :printk (KERN_DEBUG "------" ); +break ; } }
@@ -244,6 +247,7 @@ static void usbip_dump_usb_ctrlrequest(struct usb_ctrlrequest *cmd)break ;default :printk (KERN_DEBUG "REQ(%02X) " , cmd->bRequest); +break ; }printk (KERN_DEBUG " " );
@@ -342,7 +346,8 @@ void usbip_dump_header(struct usbip_header *pdu)break ;default :/* NOT REACHED */ -usbip_udbg ("UNKNOWN\n" ); +usbip_udbg ("unknown command\n" ); +break ; } }EXPORT_SYMBOL_GPL (usbip_dump_header);
@@ -537,9 +542,10 @@ void usbip_pack_pdu(struct usbip_header *pdu, struct urb *urb, int cmd,usbip_pack_ret_submit (pdu, urb, pack);break ;default : +/* NOT REACHED */ err ("unknown command" ); -/* NOTREACHED */ /* BUG(); */ +break ; } }EXPORT_SYMBOL_GPL (usbip_pack_pdu);
@@ -643,9 +649,10 @@ void usbip_header_correct_endian(struct usbip_header *pdu, int send)correct_endian_ret_unlink (&pdu->u.ret_unlink, send);break ;default : -/* NOTREACHED */ +/* NOT REACHED */ err ("unknown command in pdu header: %d" , cmd);/* BUG(); */ +break ; } }EXPORT_SYMBOL_GPL (usbip_header_correct_endian);
drivers/staging/usbip/vhci_hcd.c +2 -0
@@ -320,6 +320,7 @@ static int vhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,usbip_dbg_vhci_rh (" ClearPortFeature: default %x\n" , wValue); dum->port_status[rhport] &= ~(1 << wValue); +break ; }break ;case GetHubDescriptor:
@@ -451,6 +452,7 @@ static int vhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,usbip_dbg_vhci_rh (" SetPortFeature: default %d\n" , wValue); dum->port_status[rhport] |= (1 << wValue); +break ; }break ;
drivers/staging/usbip/vhci_rx.c +2 -1
@@ -247,10 +247,11 @@ static void vhci_rx_pdu(struct usbip_device *ud)vhci_recv_ret_unlink (vdev, &pdu);break ;default : -/* NOTREACHED */ +/* NOT REACHED */ usbip_uerr ("unknown pdu %u\n" , pdu.base.command);usbip_dump_header (&pdu);usbip_event_add (ud,VDEV_EVENT_ERROR_TCP ); +break ; } }
Signature · 1 line
1.7.5.1
PATCH 15/16 staging: usbip: remove section dividers
In reply to matt mooneyAlso, removes the one-line comments that were associated with some of the dividers because they provided no additional information.
--- drivers/staging/usbip/stub.h | 3 --- drivers/staging/usbip/stub_dev.c | 13 ------------- drivers/staging/usbip/stub_main.c | 10 ---------- drivers/staging/usbip/stub_tx.c | 11 ----------- drivers/staging/usbip/usbip_common.c | 11 ----------- drivers/staging/usbip/usbip_common.h | 10 ---------- drivers/staging/usbip/vhci.h | 3 --- drivers/staging/usbip/vhci_hcd.c | 13 ------------- drivers/staging/usbip/vhci_rx.c | 2 -- drivers/staging/usbip/vhci_tx.c | 4 ---- 10 files changed, 0 insertions(+), 80 deletions(-)
drivers/staging/usbip/stub.h +0 -3
@@ -88,9 +88,6 @@ struct bus_id_priv {extern struct kmem_cache *stub_priv_cache; -/*-------------------------------------------------------------------------*/ -/* prototype declarations */ -/* stub_tx.c */ void stub_complete (struct urb *);int stub_tx_loop (void *data);
drivers/staging/usbip/stub_dev.c +0 -13
@@ -61,11 +61,6 @@ struct usb_driver stub_driver = { .id_table = stub_table, }; -/*-------------------------------------------------------------------------*/ - -/* Define sysfs entries for a usbip-bound device */ - -/* * usbip_status shows status of usbip as long as this driver is bound to the * target device.
@@ -190,10 +185,6 @@ static void stub_remove_files(struct device *dev)device_remove_file (dev, &dev_attr_usbip_debug); } -/*-------------------------------------------------------------------------*/ - -/* Event handler functions called by an event handler thread */ -static void stub_shutdown_connection (struct usbip_device *ud) { struct stub_device *sdev = container_of(ud, struct stub_device, ud);
@@ -292,8 +283,6 @@ static void stub_device_unusable(struct usbip_device *ud)spin_unlock (&ud->lock); } -/*-------------------------------------------------------------------------*/ -/** * stub_device_alloc - allocate a new stub_device struct * @interface: usb_interface of a new device
@@ -362,8 +351,6 @@ static int stub_device_free(struct stub_device *sdev)return 0 ; } -/*-------------------------------------------------------------------------*/ -/* * If a usb device has multiple active interfaces, this driver is bound to all * the active interfaces. However, usbip exports *a* usb device (i.e., not *an*
drivers/staging/usbip/stub_main.c +0 -10
@@ -30,10 +30,6 @@/* stub_priv is allocated from stub_priv_cache */ struct kmem_cache *stub_priv_cache; -/*-------------------------------------------------------------------------*/ - -/* Define sysfs entries for the usbip driver */ -/* * busid_tables defines matching busids that usbip can grab. A user can change * dynamically what device is locally used and what device is exported to a
@@ -200,10 +196,6 @@ static ssize_t store_match_busid(struct device_driver *dev, const char *buf, static DRIVER_ATTR(match_busid, S_IRUSR|S_IWUSR, show_match_busid, store_match_busid); -/*-------------------------------------------------------------------------*/ - -/* Cleanup functions used to free private data */ -static struct stub_priv *stub_priv_pop_from_listhead (struct list_head *listhead) {struct stub_priv *priv, *tmp;
@@ -266,8 +258,6 @@ void stub_device_cleanup_urbs(struct stub_device *sdev) } } -/*-------------------------------------------------------------------------*/ -static int __init usb_stub_init (void ) {int ret;
drivers/staging/usbip/stub_tx.c +0 -11
@@ -109,9 +109,6 @@ void stub_complete(struct urb *urb)wake_up (&sdev->tx_waitq); } -/*-------------------------------------------------------------------------*/ -/* fill PDU */ -static inline void setup_base_pdu (struct usbip_header_basic *base,__u32 command,__u32 seqnum) {
@@ -137,9 +134,6 @@ static void setup_ret_unlink_pdu(struct usbip_header *rpdu, rpdu->u.ret_unlink.status = unlink->status; } -/*-------------------------------------------------------------------------*/ -/* send RET_SUBMIT */ -static struct stub_priv *dequeue_from_priv_tx (struct stub_device *sdev) {unsigned long flags;
@@ -292,9 +286,6 @@ static int stub_send_ret_submit(struct stub_device *sdev)return total_size; } -/*-------------------------------------------------------------------------*/ -/* send RET_UNLINK */ -static struct stub_unlink *dequeue_from_unlink_tx (struct stub_device *sdev) {unsigned long flags;
@@ -369,8 +360,6 @@ static int stub_send_ret_unlink(struct stub_device *sdev)return total_size; } -/*-------------------------------------------------------------------------*/ -int stub_tx_loop (void *data) {struct usbip_device *ud = data;
drivers/staging/usbip/usbip_common.c +0 -11
@@ -31,9 +31,6 @@ "Takahiro Hirofuchi <hirofuchi _at_ users.sourceforge.net>"#define DRIVER_DESC "usbip common driver" -/*-------------------------------------------------------------------------*/ -/* debug routines */ -#ifdef CONFIG_USB_IP_DEBUG_ENABLE unsigned long usbip_debug_flag =0xffffffff ;#else
@@ -352,9 +349,6 @@ void usbip_dump_header(struct usbip_header *pdu) }EXPORT_SYMBOL_GPL (usbip_dump_header); -/*-------------------------------------------------------------------------*/ -/* socket routines */ -/* Send/receive messages over TCP/IP. I refer drivers/block/nbd.c */ int usbip_xmit (int send,struct socket *sock,char *buf,int size,int msg_flags)
@@ -469,9 +463,6 @@ struct socket *sockfd_to_socket(unsigned int sockfd) }EXPORT_SYMBOL_GPL (sockfd_to_socket); -/*-------------------------------------------------------------------------*/ -/* pdu routines */ -/* there may be more cases to tweak the flags. */ static unsigned int tweak_transfer_flags (unsigned int flags) {
@@ -869,8 +860,6 @@ int usbip_recv_xbuff(struct usbip_device *ud, struct urb *urb) }EXPORT_SYMBOL_GPL (usbip_recv_xbuff); -/*-------------------------------------------------------------------------*/ -static int __init usbip_common_init (void ) { printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_DESC "" DRIVER_VERSION);
drivers/staging/usbip/usbip_common.h +0 -10
@@ -26,12 +26,6 @@#include <asm/byteorder.h> #include <net/sock.h> -/*-------------------------------------------------------------------------*/ - -/* -* define macros to print messages -*/ -/** * usbip_udbg - print debug messages if CONFIG_USB_IP_DEBUG_ENABLE is defined * @fmt:
@@ -137,8 +131,6 @@ extern struct device_attribute dev_attr_usbip_debug; printk(KERN_INFO "usbip: " fmt , ## args); \ }while (0 ) -/*-------------------------------------------------------------------------*/ -/* * USB/IP request headers. * Currently, we define 4 request types:
@@ -257,8 +249,6 @@ struct usbip_header { } u; } __packed; -/*-------------------------------------------------------------------------*/ -int usbip_xmit (int ,struct socket *,char *,int ,int );int usbip_sendmsg (struct socket *,struct msghdr *,int );
drivers/staging/usbip/vhci.h +0 -3
@@ -101,9 +101,6 @@ struct vhci_hcd {extern struct vhci_hcd *the_controller;extern struct attribute_group dev_attr_group; -/*-------------------------------------------------------------------------*/ -/* prototype declaration */ -/* vhci_hcd.c */ void rh_port_connect (int rhport,enum usb_device_speed speed);void rh_port_disconnect (int rhport);
drivers/staging/usbip/vhci_hcd.c +0 -13
@@ -154,8 +154,6 @@ void rh_port_disconnect(int rhport)usb_hcd_poll_rh_status (vhci_to_hcd (the_controller)); } -/*----------------------------------------------------------------------*/ -#define PORT_C_MASK \ ((USB_PORT_STAT_C_CONNECTION \ | USB_PORT_STAT_C_ENABLE \
@@ -478,10 +476,6 @@ static int vhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,return retval; } - - -/*----------------------------------------------------------------------*/ -static struct vhci_device *get_vdev (struct usb_device *udev) {int i;
@@ -950,9 +944,6 @@ static void vhci_device_init(struct vhci_device *vdev)usbip_start_eh (&vdev->ud); } - -/*----------------------------------------------------------------------*/ -static int vhci_start (struct usb_hcd *hcd) {struct vhci_hcd *vhci =hcd_to_vhci (hcd);
@@ -1007,8 +998,6 @@ static void vhci_stop(struct usb_hcd *hcd)usbip_uinfo ("vhci_stop done\n" ); } -/*----------------------------------------------------------------------*/ -static int vhci_get_frame_number (struct usb_hcd *hcd) {usbip_uerr ("Not yet implemented\n" );
@@ -1214,8 +1203,6 @@ static struct platform_driver vhci_driver = { }, }; -/*----------------------------------------------------------------------*/ -/* * The VHCI 'device' is 'virtual'; not a real plug&play hardware. * We need to add this virtual device as a platform device arbitrarily:
drivers/staging/usbip/vhci_rx.c +0 -2
@@ -255,8 +255,6 @@ static void vhci_rx_pdu(struct usbip_device *ud) } } -/*-------------------------------------------------------------------------*/ -int vhci_rx_loop (void *data) {struct usbip_device *ud = data;
drivers/staging/usbip/vhci_tx.c +0 -4
@@ -134,8 +134,6 @@ static int vhci_send_cmd_submit(struct vhci_device *vdev)return total_size; } -/*-------------------------------------------------------------------------*/ -static struct vhci_unlink *dequeue_from_unlink_tx (struct vhci_device *vdev) {unsigned long flags;
@@ -204,8 +202,6 @@ static int vhci_send_cmd_unlink(struct vhci_device *vdev)return total_size; } -/*-------------------------------------------------------------------------*/ -int vhci_tx_loop (void *data) {struct usbip_device *ud = data;
Signature · 1 line
1.7.5.1
PATCH 16/16 staging: usbip: fixup MODULE_ macros
In reply to matt mooneyModify description and email address for usbip_common_mod; export module version number; and modify __init messages slightly.
--- drivers/staging/usbip/stub_main.c | 4 ++-- drivers/staging/usbip/usbip_common.c | 11 ++++++----- drivers/staging/usbip/vhci_hcd.c | 4 ++-- 3 files changed, 10 insertions(+), 9 deletions(-)
drivers/staging/usbip/stub_main.c +2 -2
@@ -22,7 +22,6 @@#include "usbip_common.h" #include "stub.h" -/* Version Information */ #define DRIVER_VERSION "1.0"#define DRIVER_AUTHOR "Takahiro Hirofuchi"#define DRIVER_DESC "Stub Driver for USB/IP"
@@ -279,7 +278,7 @@ static int __init usb_stub_init(void) goto error_usb_register; } - printk(KERN_INFO KBUILD_MODNAME ":" DRIVER_DESC ":" DRIVER_VERSION + printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_DESC " " DRIVER_VERSION "\n");init_busid_table ();
@@ -320,3 +319,4 @@ module_exit(usb_stub_exit);MODULE_AUTHOR (DRIVER_AUTHOR );MODULE_DESCRIPTION (DRIVER_DESC );MODULE_LICENSE ("GPL" ); +MODULE_VERSION (DRIVER_VERSION );
drivers/staging/usbip/usbip_common.c +6 -5
@@ -23,13 +23,12 @@#include <linux/in.h> #include <linux/kthread.h> #include <linux/slab.h> +#include "usbip_common.h" -/* version information */ #define DRIVER_VERSION "1.0" -#define DRIVER_AUTHOR \ - "Takahiro Hirofuchi <hirofuchi _at_ users.sourceforge.net>" -#define DRIVER_DESC "usbip common driver" +#define DRIVER_AUTHOR "Takahiro Hirofuchi <[email protected]>" +#define DRIVER_DESC "USB/IP Common Driver"#ifdef CONFIG_USB_IP_DEBUG_ENABLE unsigned long usbip_debug_flag =0xffffffff ;
@@ -862,7 +861,8 @@ EXPORT_SYMBOL_GPL(usbip_recv_xbuff);static int __init usbip_common_init (void ) { - printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_DESC "" DRIVER_VERSION); + printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_DESC " " DRIVER_VERSION + "\n");return 0 ; }
@@ -877,3 +877,4 @@ module_exit(usbip_common_exit);MODULE_AUTHOR (DRIVER_AUTHOR );MODULE_DESCRIPTION (DRIVER_DESC );MODULE_LICENSE ("GPL" ); +MODULE_VERSION (DRIVER_VERSION );
drivers/staging/usbip/vhci_hcd.c +2 -2
@@ -26,7 +26,6 @@#define DRIVER_VERSION "1.0"#define DRIVER_AUTHOR "Takahiro Hirofuchi"#define DRIVER_DESC "Virtual Host Controller Interface Driver for USB/IP" -#define DRIVER_LICENCE "GPL"/* * TODO
@@ -1268,4 +1267,5 @@ module_exit(vhci_cleanup);MODULE_AUTHOR (DRIVER_AUTHOR );MODULE_DESCRIPTION (DRIVER_DESC ); -MODULE_LICENSE (DRIVER_LICENCE ); +MODULE_LICENSE ("GPL" ); +MODULE_VERSION (DRIVER_VERSION );
Signature · 1 line
1.7.5.1
Quoted 4 lines · matt mooney
Hi Greg,
Here is a set of extremely trivial changes; more substantial changes will follow.
Nice work, all queued up now, thanks.
greg k-h