Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 280963
b: refs/heads/master
c: 71d8572
h: refs/heads/master
i:
  280961: 8464496
  280959: b415ecb
v: v3
  • Loading branch information
Hans de Goede authored and Sarah Sharp committed Jan 4, 2012
1 parent 3a376e5 commit 3e12c46
Show file tree
Hide file tree
Showing 12 changed files with 36 additions and 73 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: d8cae98cddd286e38db1724dda1b0e7b467f9237
refs/heads/master: 71d85724bdd947a3b42a88d08af79f290a1a767b
14 changes: 5 additions & 9 deletions trunk/Documentation/usb/usbmon.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,22 +47,18 @@ This allows to filter away annoying devices that talk continuously.

2. Find which bus connects to the desired device

Run "cat /sys/kernel/debug/usb/devices", and find the T-line which corresponds
to the device. Usually you do it by looking for the vendor string. If you have
many similar devices, unplug one and compare the two
/sys/kernel/debug/usb/devices outputs. The T-line will have a bus number.
Example:
Run "cat /proc/bus/usb/devices", and find the T-line which corresponds to
the device. Usually you do it by looking for the vendor string. If you have
many similar devices, unplug one and compare two /proc/bus/usb/devices outputs.
The T-line will have a bus number. Example:

T: Bus=03 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 2 Spd=12 MxCh= 0
D: Ver= 1.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 8 #Cfgs= 1
P: Vendor=0557 ProdID=2004 Rev= 1.00
S: Manufacturer=ATEN
S: Product=UC100KM V2.00

"Bus=03" means it's bus 3. Alternatively, you can look at the output from
"lsusb" and get the bus number from the appropriate line. Example:

Bus 003 Device 002: ID 0557:2004 ATEN UC100KM V2.00
Bus=03 means it's bus 3.

3. Start 'cat'

Expand Down
4 changes: 0 additions & 4 deletions trunk/drivers/usb/class/cdc-acm.c
Original file line number Diff line number Diff line change
Expand Up @@ -1230,8 +1230,6 @@ static int acm_probe(struct usb_interface *intf,
i = device_create_file(&intf->dev, &dev_attr_wCountryCodes);
if (i < 0) {
kfree(acm->country_codes);
acm->country_codes = NULL;
acm->country_code_size = 0;
goto skip_countries;
}

Expand All @@ -1240,8 +1238,6 @@ static int acm_probe(struct usb_interface *intf,
if (i < 0) {
device_remove_file(&intf->dev, &dev_attr_wCountryCodes);
kfree(acm->country_codes);
acm->country_codes = NULL;
acm->country_code_size = 0;
goto skip_countries;
}
}
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/usb/dwc3/dwc3-pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ static int __devinit dwc3_pci_probe(struct pci_dev *pci,
pci_disable_device(pci);

err1:
kfree(glue);
kfree(pci);

err0:
return ret;
Expand Down
3 changes: 2 additions & 1 deletion trunk/drivers/usb/dwc3/gadget.c
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,8 @@ static int dwc3_gadget_set_ep_config(struct dwc3 *dwc, struct dwc3_ep *dep,
params.param1 = DWC3_DEPCFG_XFER_COMPLETE_EN
| DWC3_DEPCFG_XFER_NOT_READY_EN;

if (usb_ss_max_streams(comp_desc) && usb_endpoint_xfer_bulk(desc)) {
if (comp_desc && USB_SS_MAX_STREAMS(comp_desc->bmAttributes)
&& usb_endpoint_xfer_bulk(desc)) {
params.param1 |= DWC3_DEPCFG_STREAM_CAPABLE
| DWC3_DEPCFG_STREAM_EVENT_EN;
dep->stream_capable = true;
Expand Down
13 changes: 4 additions & 9 deletions trunk/drivers/usb/host/isp1760-if.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,18 +56,14 @@ static int of_isp1760_probe(struct platform_device *dev)
return -ENOMEM;

ret = of_address_to_resource(dp, 0, &memory);
if (ret) {
ret = -ENXIO;
goto free_data;
}
if (ret)
return -ENXIO;

res_len = resource_size(&memory);

res = request_mem_region(memory.start, res_len, dev_name(&dev->dev));
if (!res) {
ret = -EBUSY;
goto free_data;
}
if (!res)
return -EBUSY;

if (of_irq_map_one(dp, 0, &oirq)) {
ret = -ENODEV;
Expand Down Expand Up @@ -129,7 +125,6 @@ static int of_isp1760_probe(struct platform_device *dev)
gpio_free(drvdata->rst_gpio);
release_reg:
release_mem_region(memory.start, res_len);
free_data:
kfree(drvdata);
return ret;
}
Expand Down
4 changes: 3 additions & 1 deletion trunk/drivers/usb/host/xhci.c
Original file line number Diff line number Diff line change
Expand Up @@ -1623,6 +1623,7 @@ static int xhci_configure_endpoint_result(struct xhci_hcd *xhci,
/* FIXME: can we allocate more resources for the HC? */
break;
case COMP_BW_ERR:
case COMP_2ND_BW_ERR:
dev_warn(&udev->dev, "Not enough bandwidth "
"for new device state.\n");
ret = -ENOSPC;
Expand Down Expand Up @@ -2799,7 +2800,8 @@ static int xhci_calculate_streams_and_bitmask(struct xhci_hcd *xhci,
if (ret < 0)
return ret;

max_streams = usb_ss_max_streams(&eps[i]->ss_ep_comp);
max_streams = USB_SS_MAX_STREAMS(
eps[i]->ss_ep_comp.bmAttributes);
if (max_streams < (*num_streams - 1)) {
xhci_dbg(xhci, "Ep 0x%x only supports %u stream IDs.\n",
eps[i]->desc.bEndpointAddress,
Expand Down
1 change: 0 additions & 1 deletion trunk/drivers/usb/host/xhci.h
Original file line number Diff line number Diff line change
Expand Up @@ -1033,7 +1033,6 @@ struct xhci_transfer_event {
/* Invalid Stream ID Error */
#define COMP_STRID_ERR 34
/* Secondary Bandwidth Error - may be returned by a Configure Endpoint cmd */
/* FIXME - check for this */
#define COMP_2ND_BW_ERR 35
/* Split Transaction Error */
#define COMP_SPLIT_ERR 36
Expand Down
5 changes: 0 additions & 5 deletions trunk/drivers/usb/serial/option.c
Original file line number Diff line number Diff line change
Expand Up @@ -476,10 +476,6 @@ static void option_instat_callback(struct urb *urb);
#define VIETTEL_VENDOR_ID 0x2262
#define VIETTEL_PRODUCT_VT1000 0x0002

/* ZD Incorporated */
#define ZD_VENDOR_ID 0x0685
#define ZD_PRODUCT_7000 0x7000

/* some devices interfaces need special handling due to a number of reasons */
enum option_blacklist_reason {
OPTION_BLACKLIST_NONE = 0,
Expand Down Expand Up @@ -1177,7 +1173,6 @@ static const struct usb_device_id option_ids[] = {
{ USB_DEVICE(YUGA_VENDOR_ID, YUGA_PRODUCT_CLU528) },
{ USB_DEVICE(YUGA_VENDOR_ID, YUGA_PRODUCT_CLU526) },
{ USB_DEVICE_AND_INTERFACE_INFO(VIETTEL_VENDOR_ID, VIETTEL_PRODUCT_VT1000, 0xff, 0xff, 0xff) },
{ USB_DEVICE_AND_INTERFACE_INFO(ZD_VENDOR_ID, ZD_PRODUCT_7000, 0xff, 0xff, 0xff) },
{ } /* Terminating entry */
};
MODULE_DEVICE_TABLE(usb, option_ids);
Expand Down
1 change: 0 additions & 1 deletion trunk/drivers/usb/storage/usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -1073,7 +1073,6 @@ static struct usb_driver usb_storage_driver = {
.id_table = usb_storage_usb_ids,
.supports_autosuspend = 1,
.soft_unbind = 1,
.no_dynamic_id = 1,
};

static int __init usb_stor_init(void)
Expand Down
40 changes: 19 additions & 21 deletions trunk/drivers/usb/usb-skeleton.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@
#define USB_SKEL_VENDOR_ID 0xfff0
#define USB_SKEL_PRODUCT_ID 0xfff0

static DEFINE_MUTEX(skel_mutex);

/* table of devices that work with this driver */
static const struct usb_device_id skel_table[] = {
{ USB_DEVICE(USB_SKEL_VENDOR_ID, USB_SKEL_PRODUCT_ID) },
Expand Down Expand Up @@ -62,6 +60,7 @@ struct usb_skel {
__u8 bulk_in_endpointAddr; /* the address of the bulk in endpoint */
__u8 bulk_out_endpointAddr; /* the address of the bulk out endpoint */
int errors; /* the last request tanked */
int open_count; /* count the number of openers */
bool ongoing_read; /* a read is going on */
bool processed_urb; /* indicates we haven't processed the urb */
spinlock_t err_lock; /* lock for errors */
Expand Down Expand Up @@ -101,37 +100,39 @@ static int skel_open(struct inode *inode, struct file *file)
goto exit;
}

mutex_lock(&skel_mutex);
dev = usb_get_intfdata(interface);
if (!dev) {
mutex_unlock(&skel_mutex);
retval = -ENODEV;
goto exit;
}

/* increment our usage count for the device */
kref_get(&dev->kref);
mutex_unlock(&skel_mutex);

/* lock the device to allow correctly handling errors
* in resumption */
mutex_lock(&dev->io_mutex);
if (!dev->interface) {
retval = -ENODEV;
goto out_err;
}

retval = usb_autopm_get_interface(interface);
if (retval)
goto out_err;
if (!dev->open_count++) {
retval = usb_autopm_get_interface(interface);
if (retval) {
dev->open_count--;
mutex_unlock(&dev->io_mutex);
kref_put(&dev->kref, skel_delete);
goto exit;
}
} /* else { //uncomment this block if you want exclusive open
retval = -EBUSY;
dev->open_count--;
mutex_unlock(&dev->io_mutex);
kref_put(&dev->kref, skel_delete);
goto exit;
} */
/* prevent the device from being autosuspended */

/* save our object in the file's private structure */
file->private_data = dev;

out_err:
mutex_unlock(&dev->io_mutex);
if (retval)
kref_put(&dev->kref, skel_delete);

exit:
return retval;
Expand All @@ -147,7 +148,7 @@ static int skel_release(struct inode *inode, struct file *file)

/* allow the device to be autosuspended */
mutex_lock(&dev->io_mutex);
if (dev->interface)
if (!--dev->open_count && dev->interface)
usb_autopm_put_interface(dev->interface);
mutex_unlock(&dev->io_mutex);

Expand Down Expand Up @@ -611,6 +612,7 @@ static void skel_disconnect(struct usb_interface *interface)
int minor = interface->minor;

dev = usb_get_intfdata(interface);
usb_set_intfdata(interface, NULL);

/* give back our minor */
usb_deregister_dev(interface, &skel_class);
Expand All @@ -622,12 +624,8 @@ static void skel_disconnect(struct usb_interface *interface)

usb_kill_anchored_urbs(&dev->submitted);

mutex_lock(&skel_mutex);
usb_set_intfdata(interface, NULL);

/* decrement our usage count */
kref_put(&dev->kref, skel_delete);
mutex_unlock(&skel_mutex);

dev_info(&interface->dev, "USB Skeleton #%d now disconnected", minor);
}
Expand Down
20 changes: 1 addition & 19 deletions trunk/include/linux/usb/ch9.h
Original file line number Diff line number Diff line change
Expand Up @@ -605,26 +605,8 @@ struct usb_ss_ep_comp_descriptor {
} __attribute__ ((packed));

#define USB_DT_SS_EP_COMP_SIZE 6

/* Bits 4:0 of bmAttributes if this is a bulk endpoint */
static inline int
usb_ss_max_streams(const struct usb_ss_ep_comp_descriptor *comp)
{
int max_streams;

if (!comp)
return 0;

max_streams = comp->bmAttributes & 0x1f;

if (!max_streams)
return 0;

max_streams = 1 << max_streams;

return max_streams;
}

#define USB_SS_MAX_STREAMS(p) (1 << ((p) & 0x1f))
/* Bits 1:0 of bmAttributes if this is an isoc endpoint */
#define USB_SS_MULT(p) (1 + ((p) & 0x3))

Expand Down

0 comments on commit 3e12c46

Please sign in to comment.