Also, fix a few alignment issues that were originally missed.
Signed-off-by: matt mooney <mfm@muteddisk.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
};
#define BUSID_SIZE 20
+
struct bus_id_priv {
char name[BUSID_SIZE];
char status;
if (ud->tcp_tx && !task_is_dead(ud->tcp_tx))
kthread_stop(ud->tcp_tx);
- /* 2. close the socket */
/*
- * tcp_socket is freed after threads are killed.
- * So usbip_xmit do not touch NULL socket.
+ * 2. close the socket
+ *
+ * tcp_socket is freed after threads are killed so that usbip_xmit does
+ * not touch NULL socket.
*/
if (ud->tcp_socket) {
sock_release(ud->tcp_socket);
list_del(&unlink->list);
kfree(unlink);
}
- list_for_each_entry_safe(unlink, tmp,
- &sdev->unlink_free, list) {
+ list_for_each_entry_safe(unlink, tmp, &sdev->unlink_free,
+ list) {
list_del(&unlink->list);
kfree(unlink);
}
/* try to reset the device */
ret = usb_reset_device(udev);
-
usb_unlock_device(udev);
spin_lock(&ud->lock);
if (ret) {
dev_err(&udev->dev, "device reset\n");
ud->status = SDEV_ST_ERROR;
-
} else {
dev_info(&udev->dev, "device reset\n");
ud->status = SDEV_ST_AVAILABLE;
-
}
spin_unlock(&ud->lock);
-
- return;
}
static void stub_device_unusable(struct usbip_device *ud)
/* 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) ||
+ if (!busid_priv || (busid_priv->status == STUB_BUSID_REMOV) ||
(busid_priv->status == STUB_BUSID_OTHER)) {
dev_info(&interface->dev, "%s is not in match_busid table... "
"skip!\n", udev_busid);
udev_busid);
usb_set_intfdata(interface, NULL);
busid_priv->interf_count--;
-
return err;
}
/* set private data to usb_interface */
usb_set_intfdata(interface, sdev);
busid_priv->interf_count++;
-
busid_priv->sdev = sdev;
err = stub_add_files(&interface->dev);
usb_put_intf(interface);
busid_priv->interf_count = 0;
-
busid_priv->sdev = NULL;
stub_device_free(sdev);
return err;
#define DRIVER_AUTHOR "Takahiro Hirofuchi"
#define DRIVER_DESC "USB/IP Host Driver"
-/* stub_priv is allocated from stub_priv_cache */
struct kmem_cache *stub_priv_cache;
-
/*
* 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
int i;
spin_lock(&busid_table_lock);
-
for (i = 0; i < MAX_BUSID; i++)
if (busid_table[i].name[0])
if (!strncmp(busid_table[i].name, busid, BUSID_SIZE)) {
spin_unlock(&busid_table_lock);
return 0;
}
-
spin_unlock(&busid_table_lock);
return 1;
int i;
spin_lock(&busid_table_lock);
-
for (i = 0; i < MAX_BUSID; i++)
if (busid_table[i].name[0])
if (!strncmp(busid_table[i].name, busid, BUSID_SIZE)) {
spin_unlock(&busid_table_lock);
return &(busid_table[i]);
}
-
spin_unlock(&busid_table_lock);
return NULL;
char *out = buf;
spin_lock(&busid_table_lock);
-
for (i = 0; i < MAX_BUSID; i++)
if (busid_table[i].name[0])
out += sprintf(out, "%s ", busid_table[i].name);
-
spin_unlock(&busid_table_lock);
out += sprintf(out, "\n");
-
return out - buf;
}
return 0;
spin_lock(&busid_table_lock);
-
for (i = 0; i < MAX_BUSID; i++)
if (!busid_table[i].name[0]) {
strncpy(busid_table[i].name, busid, BUSID_SIZE);
spin_unlock(&busid_table_lock);
return 0;
}
-
spin_unlock(&busid_table_lock);
return -1;
int i;
spin_lock(&busid_table_lock);
-
for (i = 0; i < MAX_BUSID; i++)
if (!strncmp(busid_table[i].name, busid, BUSID_SIZE)) {
/* found */
spin_unlock(&busid_table_lock);
return 0;
}
-
spin_unlock(&busid_table_lock);
return -1;
/* link a urb to the queue of tx. */
spin_lock_irqsave(&sdev->priv_lock, flags);
-
if (priv->unlinking) {
stub_enqueue_ret_unlink(sdev, priv->seqnum, urb->status);
stub_free_priv_and_urb(priv);
- } else
+ } else {
list_move_tail(&priv->list, &sdev->priv_tx);
-
+ }
spin_unlock_irqrestore(&sdev->priv_lock, flags);
/* wake up tx_thread */
static inline void setup_base_pdu(struct usbip_header_basic *base,
__u32 command, __u32 seqnum)
{
- base->command = command;
- base->seqnum = seqnum;
- base->devid = 0;
- base->ep = 0;
+ base->command = command;
+ base->seqnum = seqnum;
+ base->devid = 0;
+ base->ep = 0;
base->direction = 0;
}
static void usbip_dump_pipe(unsigned int p)
{
unsigned char type = usb_pipetype(p);
- unsigned char ep = usb_pipeendpoint(p);
- unsigned char dev = usb_pipedevice(p);
- unsigned char dir = usb_pipein(p);
+ unsigned char ep = usb_pipeendpoint(p);
+ unsigned char dev = usb_pipedevice(p);
+ unsigned char dir = usb_pipein(p);
pr_debug("dev(%d) ep(%d) [%s] ", dev, ep, dir ? "IN" : "OUT");
EXPORT_SYMBOL_GPL(usbip_dump_header);
/* 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)
+int usbip_xmit(int send, struct socket *sock, char *buf, int size,
+ int msg_flags)
{
int result;
struct msghdr msg;
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) {
#define usbip_dbg_flag_vhci_tx (usbip_debug_flag & usbip_debug_vhci_tx)
#define usbip_dbg_flag_stub_rx (usbip_debug_flag & usbip_debug_stub_rx)
#define usbip_dbg_flag_stub_tx (usbip_debug_flag & usbip_debug_stub_tx)
-#define usbip_dbg_flag_vhci_sysfs (usbip_debug_flag & usbip_debug_vhci_sysfs)
+#define usbip_dbg_flag_vhci_sysfs (usbip_debug_flag & usbip_debug_vhci_sysfs)
extern unsigned long usbip_debug_flag;
extern struct device_attribute dev_attr_usbip_debug;
* */
if (dum->resuming && time_after(jiffies, dum->re_timeout)) {
dum->port_status[rhport] |=
- (1 << USB_PORT_FEAT_C_SUSPEND);
+ (1 << USB_PORT_FEAT_C_SUSPEND);
dum->port_status[rhport] &=
- ~(1 << USB_PORT_FEAT_SUSPEND);
+ ~(1 << USB_PORT_FEAT_SUSPEND);
dum->resuming = 0;
dum->re_timeout = 0;
/* if (dum->driver && dum->driver->resume) {
usb_hcd_unlink_urb_from_ep(hcd, urb);
no_need_unlink:
spin_unlock_irqrestore(&the_controller->lock, flags);
-
usb_hcd_giveback_urb(vhci_to_hcd(the_controller), urb, urb->status);
-
return ret;
}
hcd->state = HC_STATE_RUNNING;
}
spin_unlock_irq(&vhci->lock);
- return rc;
- return 0;
+ return rc;
}
#else
}
kfree(unlink);
-
- return;
}
static int vhci_priv_tx_empty(struct vhci_device *vdev)