Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 280965
b: refs/heads/master
c: 435c724
h: refs/heads/master
i:
  280963: 3e12c46
v: v3
  • Loading branch information
Greg Kroah-Hartman committed Jan 5, 2012
1 parent 9269dce commit 1da3619
Show file tree
Hide file tree
Showing 11 changed files with 72 additions and 35 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: e910b440da9f766f2623479be721032fecff98c3
refs/heads/master: 435c724232457f32e66d6460d036c5f64f67b0a7
14 changes: 9 additions & 5 deletions trunk/Documentation/usb/usbmon.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,18 +47,22 @@ This allows to filter away annoying devices that talk continuously.

2. Find which bus connects to the desired device

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:
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:

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.
"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

3. Start 'cat'

Expand Down
4 changes: 4 additions & 0 deletions trunk/drivers/usb/class/cdc-acm.c
Original file line number Diff line number Diff line change
Expand Up @@ -1230,6 +1230,8 @@ 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 @@ -1238,6 +1240,8 @@ 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(pci);
kfree(glue);

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

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

res_len = resource_size(&memory);

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

if (of_irq_map_one(dp, 0, &oirq)) {
ret = -ENODEV;
Expand Down Expand Up @@ -125,6 +129,7 @@ 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
3 changes: 1 addition & 2 deletions trunk/drivers/usb/host/xhci.c
Original file line number Diff line number Diff line change
Expand Up @@ -2800,8 +2800,7 @@ 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.bmAttributes);
max_streams = usb_ss_max_streams(&eps[i]->ss_ep_comp);
if (max_streams < (*num_streams - 1)) {
xhci_dbg(xhci, "Ep 0x%x only supports %u stream IDs.\n",
eps[i]->desc.bEndpointAddress,
Expand Down
5 changes: 5 additions & 0 deletions trunk/drivers/usb/serial/option.c
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,10 @@ 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 @@ -1173,6 +1177,7 @@ 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: 1 addition & 0 deletions trunk/drivers/usb/storage/usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -1073,6 +1073,7 @@ 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: 21 additions & 19 deletions trunk/drivers/usb/usb-skeleton.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
#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 @@ -60,7 +62,6 @@ 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 @@ -100,39 +101,37 @@ 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;
}

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 */
retval = usb_autopm_get_interface(interface);
if (retval)
goto out_err;

/* 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 @@ -148,7 +147,7 @@ static int skel_release(struct inode *inode, struct file *file)

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

Expand Down Expand Up @@ -612,7 +611,6 @@ 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 @@ -624,8 +622,12 @@ 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: 19 additions & 1 deletion trunk/include/linux/usb/ch9.h
Original file line number Diff line number Diff line change
Expand Up @@ -605,8 +605,26 @@ 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 */
#define USB_SS_MAX_STREAMS(p) (1 << ((p) & 0x1f))
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;
}

/* 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 1da3619

Please sign in to comment.