Commit 071d1d47 authored by matt mooney's avatar matt mooney Committed by Greg Kroah-Hartman

staging: usbip: vhci_hcd.c: coding style cleanup

Fix 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.
Signed-off-by: default avatarmatt mooney <mfm@muteddisk.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent ddbc9bc9
...@@ -27,11 +27,6 @@ ...@@ -27,11 +27,6 @@
#define DRIVER_AUTHOR "Takahiro Hirofuchi" #define DRIVER_AUTHOR "Takahiro Hirofuchi"
#define DRIVER_DESC "Virtual Host Controller Interface Driver for USB/IP" #define DRIVER_DESC "Virtual Host Controller Interface Driver for USB/IP"
#define DRIVER_LICENCE "GPL" #define DRIVER_LICENCE "GPL"
MODULE_AUTHOR(DRIVER_AUTHOR);
MODULE_DESCRIPTION(DRIVER_DESC);
MODULE_LICENSE(DRIVER_LICENCE);
/* /*
* TODO * TODO
...@@ -43,10 +38,8 @@ MODULE_LICENSE(DRIVER_LICENCE); ...@@ -43,10 +38,8 @@ MODULE_LICENSE(DRIVER_LICENCE);
* - clean up everything * - clean up everything
*/ */
/* See usb gadget dummy hcd */ /* See usb gadget dummy hcd */
static int vhci_hub_status(struct usb_hcd *hcd, char *buff); static int vhci_hub_status(struct usb_hcd *hcd, char *buff);
static int vhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, 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);
...@@ -62,7 +55,7 @@ static const char driver_desc[] = "USB/IP Virtual Host Controller"; ...@@ -62,7 +55,7 @@ static const char driver_desc[] = "USB/IP Virtual Host Controller";
struct vhci_hcd *the_controller; struct vhci_hcd *the_controller;
static const char *bit_desc[] = { static const char * const bit_desc[] = {
"CONNECTION", /*0*/ "CONNECTION", /*0*/
"ENABLE", /*1*/ "ENABLE", /*1*/
"SUSPEND", /*2*/ "SUSPEND", /*2*/
...@@ -97,7 +90,6 @@ static const char *bit_desc[] = { ...@@ -97,7 +90,6 @@ static const char *bit_desc[] = {
"R31", /*31*/ "R31", /*31*/
}; };
static void dump_port_status(u32 status) static void dump_port_status(u32 status)
{ {
int i = 0; int i = 0;
...@@ -105,14 +97,11 @@ static void dump_port_status(u32 status) ...@@ -105,14 +97,11 @@ static void dump_port_status(u32 status)
printk(KERN_DEBUG "status %08x:", status); printk(KERN_DEBUG "status %08x:", status);
for (i = 0; i < 32; i++) { for (i = 0; i < 32; i++) {
if (status & (1 << i)) if (status & (1 << i))
printk(" %s", bit_desc[i]); printk(KERN_DEBUG " %s", bit_desc[i]);
} }
printk(KERN_DEBUG "\n");
printk("\n");
} }
void rh_port_connect(int rhport, enum usb_device_speed speed) void rh_port_connect(int rhport, enum usb_device_speed speed)
{ {
unsigned long flags; unsigned long flags;
...@@ -156,19 +145,15 @@ void rh_port_disconnect(int rhport) ...@@ -156,19 +145,15 @@ void rh_port_disconnect(int rhport)
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 /* not yet complete the disconnection
* spin_lock(&vdev->ud.lock); * spin_lock(&vdev->ud.lock);
* vdev->ud.status = VHC_ST_DISCONNECT; * vdev->ud.status = VHC_ST_DISCONNECT;
* spin_unlock(&vdev->ud.lock); */ * 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));
} }
/*----------------------------------------------------------------------*/ /*----------------------------------------------------------------------*/
#define PORT_C_MASK \ #define PORT_C_MASK \
...@@ -210,7 +195,6 @@ static int vhci_hub_status(struct usb_hcd *hcd, char *buf) ...@@ -210,7 +195,6 @@ static int vhci_hub_status(struct usb_hcd *hcd, char *buf)
int rhport; int rhport;
int changed = 0; int changed = 0;
*event_bits = 0; *event_bits = 0;
vhci = hcd_to_vhci(hcd); vhci = hcd_to_vhci(hcd);
...@@ -393,7 +377,6 @@ static int vhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, ...@@ -393,7 +377,6 @@ static int vhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
} }
#if 0 #if 0
if (dum->driver) { if (dum->driver) {
dum->port_status[rhport] |= dum->port_status[rhport] |=
USB_PORT_STAT_ENABLE; USB_PORT_STAT_ENABLE;
/* give it the best speed we agree on */ /* give it the best speed we agree on */
...@@ -415,11 +398,9 @@ static int vhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, ...@@ -415,11 +398,9 @@ static int vhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
} }
} }
#endif #endif
} }
((u16 *) buf)[0] = cpu_to_le16(dum->port_status[rhport]); ((u16 *) buf)[0] = cpu_to_le16(dum->port_status[rhport]);
((u16 *) buf)[1] = ((u16 *) buf)[1] = cpu_to_le16(dum->port_status[rhport] >> 16);
cpu_to_le16(dum->port_status[rhport] >> 16);
usbip_dbg_vhci_rh(" GetPortStatus bye %x %x\n", ((u16 *)buf)[0], usbip_dbg_vhci_rh(" GetPortStatus bye %x %x\n", ((u16 *)buf)[0],
((u16 *)buf)[1]); ((u16 *)buf)[1]);
...@@ -545,7 +526,6 @@ static void vhci_tx_urb(struct urb *urb) ...@@ -545,7 +526,6 @@ static void vhci_tx_urb(struct urb *urb)
urb->hcpriv = (void *) priv; urb->hcpriv = (void *) priv;
list_add_tail(&priv->list, &vdev->priv_tx); list_add_tail(&priv->list, &vdev->priv_tx);
wake_up(&vdev->waitq_tx); wake_up(&vdev->waitq_tx);
...@@ -578,7 +558,8 @@ static int vhci_urb_enqueue(struct usb_hcd *hcd, struct urb *urb, ...@@ -578,7 +558,8 @@ static int vhci_urb_enqueue(struct usb_hcd *hcd, struct urb *urb,
/* refuse enqueue for dead connection */ /* refuse enqueue for dead connection */
spin_lock(&vdev->ud.lock); 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); usbip_uerr("enqueue for inactive port %d\n", vdev->rhport);
spin_unlock(&vdev->ud.lock); spin_unlock(&vdev->ud.lock);
spin_unlock_irqrestore(&the_controller->lock, flags); spin_unlock_irqrestore(&the_controller->lock, flags);
...@@ -599,7 +580,6 @@ static int vhci_urb_enqueue(struct usb_hcd *hcd, struct urb *urb, ...@@ -599,7 +580,6 @@ static int vhci_urb_enqueue(struct usb_hcd *hcd, struct urb *urb,
* 2. Set_Address request to DevAddr(0) EndPoint(0) * 2. Set_Address request to DevAddr(0) EndPoint(0)
* *
*/ */
if (usb_pipedevice(urb->pipe) == 0) { if (usb_pipedevice(urb->pipe) == 0) {
__u8 type = usb_pipetype(urb->pipe); __u8 type = usb_pipetype(urb->pipe);
struct usb_ctrlrequest *ctrlreq = struct usb_ctrlrequest *ctrlreq =
...@@ -657,7 +637,6 @@ static int vhci_urb_enqueue(struct usb_hcd *hcd, struct urb *urb, ...@@ -657,7 +637,6 @@ static int vhci_urb_enqueue(struct usb_hcd *hcd, struct urb *urb,
out: out:
vhci_tx_urb(urb); vhci_tx_urb(urb);
spin_unlock_irqrestore(&the_controller->lock, flags); spin_unlock_irqrestore(&the_controller->lock, flags);
return 0; return 0;
...@@ -726,7 +705,6 @@ static int vhci_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status) ...@@ -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); usbip_uinfo("vhci_hcd: dequeue a urb %p\n", urb);
spin_lock_irqsave(&the_controller->lock, flags); spin_lock_irqsave(&the_controller->lock, flags);
priv = urb->hcpriv; priv = urb->hcpriv;
...@@ -838,8 +816,8 @@ static void vhci_device_unlink_cleanup(struct vhci_device *vdev) ...@@ -838,8 +816,8 @@ static void vhci_device_unlink_cleanup(struct vhci_device *vdev)
urb = pickup_urb_and_free_priv(vdev, unlink->unlink_seqnum); urb = pickup_urb_and_free_priv(vdev, unlink->unlink_seqnum);
if (!urb) { if (!urb) {
usbip_uinfo("the urb (seqnum %lu) was already given back\n", usbip_uinfo("the urb (seqnum %lu) was already given "
unlink->unlink_seqnum); "back\n", unlink->unlink_seqnum);
list_del(&unlink->list); list_del(&unlink->list);
kfree(unlink); kfree(unlink);
continue; continue;
...@@ -851,7 +829,8 @@ static void vhci_device_unlink_cleanup(struct vhci_device *vdev) ...@@ -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); usb_hcd_unlink_urb_from_ep(vhci_to_hcd(the_controller), urb);
spin_unlock(&the_controller->lock); 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); list_del(&unlink->list);
kfree(unlink); kfree(unlink);
...@@ -930,7 +909,6 @@ static void vhci_device_reset(struct usbip_device *ud) ...@@ -930,7 +909,6 @@ static void vhci_device_reset(struct usbip_device *ud)
vdev->udev = NULL; vdev->udev = NULL;
ud->tcp_socket = NULL; ud->tcp_socket = NULL;
ud->status = VDEV_ST_NULL; ud->status = VDEV_ST_NULL;
spin_unlock(&ud->lock); spin_unlock(&ud->lock);
...@@ -939,9 +917,7 @@ static void vhci_device_reset(struct usbip_device *ud) ...@@ -939,9 +917,7 @@ static void vhci_device_reset(struct usbip_device *ud)
static void vhci_device_unusable(struct usbip_device *ud) static void vhci_device_unusable(struct usbip_device *ud)
{ {
spin_lock(&ud->lock); spin_lock(&ud->lock);
ud->status = VDEV_ST_ERROR; ud->status = VDEV_ST_ERROR;
spin_unlock(&ud->lock); spin_unlock(&ud->lock);
} }
...@@ -984,7 +960,6 @@ static int vhci_start(struct usb_hcd *hcd) ...@@ -984,7 +960,6 @@ static int vhci_start(struct usb_hcd *hcd)
usbip_dbg_vhci_hc("enter vhci_start\n"); usbip_dbg_vhci_hc("enter vhci_start\n");
/* initialize private data of usb_hcd */ /* initialize private data of usb_hcd */
for (rhport = 0; rhport < VHCI_NPORTS; rhport++) { for (rhport = 0; rhport < VHCI_NPORTS; rhport++) {
...@@ -996,13 +971,10 @@ static int vhci_start(struct usb_hcd *hcd) ...@@ -996,13 +971,10 @@ static int vhci_start(struct usb_hcd *hcd)
atomic_set(&vhci->seqnum, 0); atomic_set(&vhci->seqnum, 0);
spin_lock_init(&vhci->lock); spin_lock_init(&vhci->lock);
hcd->power_budget = 0; /* no limit */ hcd->power_budget = 0; /* no limit */
hcd->state = HC_STATE_RUNNING; hcd->state = HC_STATE_RUNNING;
hcd->uses_new_polling = 1; hcd->uses_new_polling = 1;
/* vhci_hcd is now ready to be controlled through sysfs */ /* vhci_hcd is now ready to be controlled through sysfs */
err = sysfs_create_group(&vhci_dev(vhci)->kobj, &dev_attr_group); err = sysfs_create_group(&vhci_dev(vhci)->kobj, &dev_attr_group);
if (err) { if (err) {
...@@ -1020,7 +992,6 @@ static void vhci_stop(struct usb_hcd *hcd) ...@@ -1020,7 +992,6 @@ static void vhci_stop(struct usb_hcd *hcd)
usbip_dbg_vhci_hc("stop VHCI controller\n"); usbip_dbg_vhci_hc("stop VHCI controller\n");
/* 1. remove the userland interface of vhci_hcd */ /* 1. remove the userland interface of vhci_hcd */
sysfs_remove_group(&vhci_dev(vhci)->kobj, &dev_attr_group); sysfs_remove_group(&vhci_dev(vhci)->kobj, &dev_attr_group);
...@@ -1032,7 +1003,6 @@ static void vhci_stop(struct usb_hcd *hcd) ...@@ -1032,7 +1003,6 @@ static void vhci_stop(struct usb_hcd *hcd)
usbip_stop_eh(&vdev->ud); usbip_stop_eh(&vdev->ud);
} }
usbip_uinfo("vhci_stop done\n"); usbip_uinfo("vhci_stop done\n");
} }
...@@ -1044,7 +1014,6 @@ static int vhci_get_frame_number(struct usb_hcd *hcd) ...@@ -1044,7 +1014,6 @@ static int vhci_get_frame_number(struct usb_hcd *hcd)
return 0; return 0;
} }
#ifdef CONFIG_PM #ifdef CONFIG_PM
/* FIXME: suspend/resume */ /* FIXME: suspend/resume */
...@@ -1092,8 +1061,6 @@ static int vhci_bus_resume(struct usb_hcd *hcd) ...@@ -1092,8 +1061,6 @@ static int vhci_bus_resume(struct usb_hcd *hcd)
#define vhci_bus_resume NULL #define vhci_bus_resume NULL
#endif #endif
static struct hc_driver vhci_hc_driver = { static struct hc_driver vhci_hc_driver = {
.description = driver_name, .description = driver_name,
.product_desc = driver_desc, .product_desc = driver_desc,
...@@ -1156,12 +1123,10 @@ static int vhci_hcd_probe(struct platform_device *pdev) ...@@ -1156,12 +1123,10 @@ static int vhci_hcd_probe(struct platform_device *pdev)
return ret; return ret;
} }
usbip_dbg_vhci_hc("bye\n"); usbip_dbg_vhci_hc("bye\n");
return 0; return 0;
} }
static int vhci_hcd_remove(struct platform_device *pdev) static int vhci_hcd_remove(struct platform_device *pdev)
{ {
struct usb_hcd *hcd; struct usb_hcd *hcd;
...@@ -1179,12 +1144,9 @@ static int vhci_hcd_remove(struct platform_device *pdev) ...@@ -1179,12 +1144,9 @@ static int vhci_hcd_remove(struct platform_device *pdev)
usb_put_hcd(hcd); usb_put_hcd(hcd);
the_controller = NULL; the_controller = NULL;
return 0; return 0;
} }
#ifdef CONFIG_PM #ifdef CONFIG_PM
/* what should happen for USB/IP under suspend/resume? */ /* what should happen for USB/IP under suspend/resume? */
...@@ -1240,7 +1202,6 @@ static int vhci_hcd_resume(struct platform_device *pdev) ...@@ -1240,7 +1202,6 @@ static int vhci_hcd_resume(struct platform_device *pdev)
#endif #endif
static struct platform_driver vhci_driver = { static struct platform_driver vhci_driver = {
.probe = vhci_hcd_probe, .probe = vhci_hcd_probe,
.remove = __devexit_p(vhci_hcd_remove), .remove = __devexit_p(vhci_hcd_remove),
...@@ -1299,12 +1260,10 @@ static int __init vhci_init(void) ...@@ -1299,12 +1260,10 @@ static int __init vhci_init(void)
/* error occurred */ /* error occurred */
err_platform_device_register: err_platform_device_register:
platform_driver_unregister(&vhci_driver); platform_driver_unregister(&vhci_driver);
err_driver_register: err_driver_register:
usbip_dbg_vhci_hc("bye\n"); usbip_dbg_vhci_hc("bye\n");
return ret; return ret;
} }
module_init(vhci_init);
static void __exit vhci_cleanup(void) static void __exit vhci_cleanup(void)
{ {
...@@ -1315,4 +1274,10 @@ static void __exit vhci_cleanup(void) ...@@ -1315,4 +1274,10 @@ static void __exit vhci_cleanup(void)
usbip_dbg_vhci_hc("bye\n"); usbip_dbg_vhci_hc("bye\n");
} }
module_init(vhci_init);
module_exit(vhci_cleanup); module_exit(vhci_cleanup);
MODULE_AUTHOR(DRIVER_AUTHOR);
MODULE_DESCRIPTION(DRIVER_DESC);
MODULE_LICENSE(DRIVER_LICENCE);
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