Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 249375
b: refs/heads/master
c: b744a45
h: refs/heads/master
i:
  249373: 28c1ea3
  249371: f765ddc
  249367: 912726f
  249359: dcde1aa
  249343: bd5b9c4
v: v3
  • Loading branch information
matt mooney authored and Greg Kroah-Hartman committed May 6, 2011
1 parent 9bbd66b commit 939c106
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 33 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: e8591270fa7b2520e68ed98d86b8bb99fd69bad8
refs/heads/master: b744a45f45e3d18db91b33d1ac45597ddc2ea71c
44 changes: 12 additions & 32 deletions trunk/drivers/staging/usbip/stub_dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -64,7 +61,6 @@ struct usb_driver stub_driver = {
.id_table = stub_table,
};


/*-------------------------------------------------------------------------*/

/* Define sysfs entries for a usbip-bound device */
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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;
}
Expand All @@ -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 */
Expand Down Expand Up @@ -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);
}
}
Expand All @@ -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;
}

Expand Down Expand Up @@ -306,7 +292,6 @@ static void stub_device_unusable(struct usbip_device *ud)
spin_unlock(&ud->lock);
}


/*-------------------------------------------------------------------------*/

/**
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -378,7 +362,6 @@ static int stub_device_free(struct stub_device *sdev)
return 0;
}


/*-------------------------------------------------------------------------*/

/*
Expand All @@ -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);
Expand All @@ -420,27 +403,27 @@ 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)
return -ENODEV;

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);
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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);

Expand Down

0 comments on commit 939c106

Please sign in to comment.