Skip to content

Commit

Permalink
Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb-2.6
Browse files Browse the repository at this point in the history
* git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb-2.6:
  USB: pwc : do not pass stack allocated buffers to USB core.
  USB: otg: Fix bug on remove path without transceiver
  USB: correct error handling in cdc-wdm
  USB: removal of tty->low_latency hack dating back to the old serial code
  USB: serial: sierra driver bug fix for composite interface
  USB: gadget: omap_udc uses platform_driver_probe()
  USB: ci13xxx_udc: fix build error
  USB: musb: Prevent multiple includes of musb.h
  USB: pass mem_flags to dma_alloc_coherent
  USB: g_file_storage: fix use-after-free bug when closing files
  USB: ehci-sched.c: EHCI SITD scheduling bugfix
  USB: fix mos7840 problem with minor numbers
  USB: mos7840: add new device id
  USB: musb: fix build when !CONFIG_PM
  USB: musb: Remove my email address from few musb related drivers
  USB: Gadget: MIPS CI13xxx UDC bugfixes
  USB: Unusual Device support for Gold MP3 Player Energy
  USB: serial: fix lifetime and locking problems
  • Loading branch information
Linus Torvalds committed Apr 24, 2009
2 parents ff91fad + 6b35ca0 commit d72cd3a
Show file tree
Hide file tree
Showing 33 changed files with 319 additions and 271 deletions.
238 changes: 164 additions & 74 deletions drivers/media/video/pwc/pwc-ctrl.c

Large diffs are not rendered by default.

27 changes: 18 additions & 9 deletions drivers/usb/class/cdc-wdm.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*
* This driver supports USB CDC WCM Device Management.
*
* Copyright (c) 2007-2008 Oliver Neukum
* Copyright (c) 2007-2009 Oliver Neukum
*
* Some code taken from cdc-acm.c
*
Expand Down Expand Up @@ -610,7 +610,7 @@ static int wdm_probe(struct usb_interface *intf, const struct usb_device_id *id)
if (!buffer)
goto out;

while (buflen > 0) {
while (buflen > 2) {
if (buffer [1] != USB_DT_CS_INTERFACE) {
dev_err(&intf->dev, "skipping garbage\n");
goto next_desc;
Expand Down Expand Up @@ -646,16 +646,18 @@ static int wdm_probe(struct usb_interface *intf, const struct usb_device_id *id)
spin_lock_init(&desc->iuspin);
init_waitqueue_head(&desc->wait);
desc->wMaxCommand = maxcom;
/* this will be expanded and needed in hardware endianness */
desc->inum = cpu_to_le16((u16)intf->cur_altsetting->desc.bInterfaceNumber);
desc->intf = intf;
INIT_WORK(&desc->rxwork, wdm_rxwork);

iface = &intf->altsetting[0];
rv = -EINVAL;
iface = intf->cur_altsetting;
if (iface->desc.bNumEndpoints != 1)
goto err;
ep = &iface->endpoint[0].desc;
if (!ep || !usb_endpoint_is_int_in(ep)) {
rv = -EINVAL;
if (!ep || !usb_endpoint_is_int_in(ep))
goto err;
}

desc->wMaxPacketSize = le16_to_cpu(ep->wMaxPacketSize);
desc->bMaxPacketSize0 = udev->descriptor.bMaxPacketSize0;
Expand Down Expand Up @@ -711,12 +713,19 @@ static int wdm_probe(struct usb_interface *intf, const struct usb_device_id *id)

usb_set_intfdata(intf, desc);
rv = usb_register_dev(intf, &wdm_class);
dev_info(&intf->dev, "cdc-wdm%d: USB WDM device\n",
intf->minor - WDM_MINOR_BASE);
if (rv < 0)
goto err;
goto err3;
else
dev_info(&intf->dev, "cdc-wdm%d: USB WDM device\n",
intf->minor - WDM_MINOR_BASE);
out:
return rv;
err3:
usb_set_intfdata(intf, NULL);
usb_buffer_free(interface_to_usbdev(desc->intf),
desc->bMaxPacketSize0,
desc->inbuf,
desc->response->transfer_dma);
err2:
usb_buffer_free(interface_to_usbdev(desc->intf),
desc->wMaxPacketSize,
Expand Down
2 changes: 1 addition & 1 deletion drivers/usb/core/buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ void *hcd_buffer_alloc(
if (size <= pool_max [i])
return dma_pool_alloc(hcd->pool [i], mem_flags, dma);
}
return dma_alloc_coherent(hcd->self.controller, size, dma, 0);
return dma_alloc_coherent(hcd->self.controller, size, dma, mem_flags);
}

void hcd_buffer_free(
Expand Down
5 changes: 4 additions & 1 deletion drivers/usb/gadget/ci13xxx_udc.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
* - Gadget API (majority of optional features)
* - Suspend & Remote Wakeup
*/
#include <linux/delay.h>
#include <linux/device.h>
#include <linux/dmapool.h>
#include <linux/dma-mapping.h>
Expand Down Expand Up @@ -142,7 +143,7 @@ static struct {
#define CAP_DEVICEADDR (0x014UL)
#define CAP_ENDPTLISTADDR (0x018UL)
#define CAP_PORTSC (0x044UL)
#define CAP_DEVLC (0x0B4UL)
#define CAP_DEVLC (0x084UL)
#define CAP_USBMODE (hw_bank.lpm ? 0x0C8UL : 0x068UL)
#define CAP_ENDPTSETUPSTAT (hw_bank.lpm ? 0x0D8UL : 0x06CUL)
#define CAP_ENDPTPRIME (hw_bank.lpm ? 0x0DCUL : 0x070UL)
Expand Down Expand Up @@ -1986,6 +1987,8 @@ static int ep_enable(struct usb_ep *ep,
do {
dbg_event(_usb_addr(mEp), "ENABLE", 0);

mEp->qh[mEp->dir].ptr->cap = 0;

if (mEp->type == USB_ENDPOINT_XFER_CONTROL)
mEp->qh[mEp->dir].ptr->cap |= QH_IOS;
else if (mEp->type == USB_ENDPOINT_XFER_ISOC)
Expand Down
20 changes: 4 additions & 16 deletions drivers/usb/gadget/file_storage.c
Original file line number Diff line number Diff line change
Expand Up @@ -738,7 +738,6 @@ static struct fsg_dev *the_fsg;
static struct usb_gadget_driver fsg_driver;

static void close_backing_file(struct lun *curlun);
static void close_all_backing_files(struct fsg_dev *fsg);


/*-------------------------------------------------------------------------*/
Expand Down Expand Up @@ -3593,12 +3592,10 @@ static int fsg_main_thread(void *fsg_)
fsg->thread_task = NULL;
spin_unlock_irq(&fsg->lock);

/* In case we are exiting because of a signal, unregister the
* gadget driver and close the backing file. */
if (test_and_clear_bit(REGISTERED, &fsg->atomic_bitflags)) {
/* If we are exiting because of a signal, unregister the
* gadget driver. */
if (test_and_clear_bit(REGISTERED, &fsg->atomic_bitflags))
usb_gadget_unregister_driver(&fsg_driver);
close_all_backing_files(fsg);
}

/* Let the unbind and cleanup routines know the thread has exited */
complete_and_exit(&fsg->thread_notifier, 0);
Expand Down Expand Up @@ -3703,14 +3700,6 @@ static void close_backing_file(struct lun *curlun)
}
}

static void close_all_backing_files(struct fsg_dev *fsg)
{
int i;

for (i = 0; i < fsg->nluns; ++i)
close_backing_file(&fsg->luns[i]);
}


static ssize_t show_ro(struct device *dev, struct device_attribute *attr, char *buf)
{
Expand Down Expand Up @@ -3845,6 +3834,7 @@ static void /* __init_or_exit */ fsg_unbind(struct usb_gadget *gadget)
if (curlun->registered) {
device_remove_file(&curlun->dev, &dev_attr_ro);
device_remove_file(&curlun->dev, &dev_attr_file);
close_backing_file(curlun);
device_unregister(&curlun->dev);
curlun->registered = 0;
}
Expand Down Expand Up @@ -4190,7 +4180,6 @@ static int __init fsg_bind(struct usb_gadget *gadget)
out:
fsg->state = FSG_STATE_TERMINATED; // The thread is dead
fsg_unbind(gadget);
close_all_backing_files(fsg);
complete(&fsg->thread_notifier);
return rc;
}
Expand Down Expand Up @@ -4284,7 +4273,6 @@ static void __exit fsg_cleanup(void)
/* Wait for the thread to finish up */
wait_for_completion(&fsg->thread_notifier);

close_all_backing_files(fsg);
kref_put(&fsg->ref, fsg_release);
}
module_exit(fsg_cleanup);
3 changes: 1 addition & 2 deletions drivers/usb/gadget/omap_udc.c
Original file line number Diff line number Diff line change
Expand Up @@ -3104,7 +3104,6 @@ static int omap_udc_resume(struct platform_device *dev)
/*-------------------------------------------------------------------------*/

static struct platform_driver udc_driver = {
.probe = omap_udc_probe,
.remove = __exit_p(omap_udc_remove),
.suspend = omap_udc_suspend,
.resume = omap_udc_resume,
Expand All @@ -3122,7 +3121,7 @@ static int __init udc_init(void)
#endif
"%s\n", driver_desc,
use_dma ? " (dma)" : "");
return platform_driver_register(&udc_driver);
return platform_driver_probe(&udc_driver, omap_udc_probe);
}
module_init(udc_init);

Expand Down
2 changes: 1 addition & 1 deletion drivers/usb/host/ehci-sched.c
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ static int tt_available (
* already scheduled transactions
*/
if (125 < usecs) {
int ufs = (usecs / 125) - 1;
int ufs = (usecs / 125);
int i;
for (i = uframe; i < (uframe + ufs) && i < 8; i++)
if (0 < tt_usecs[i]) {
Expand Down
2 changes: 1 addition & 1 deletion drivers/usb/musb/musb_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -2191,7 +2191,7 @@ static int musb_resume_early(struct platform_device *pdev)

#else
#define musb_suspend NULL
#define musb_resume NULL
#define musb_resume_early NULL
#endif

static struct platform_driver musb_driver = {
Expand Down
1 change: 0 additions & 1 deletion drivers/usb/musb/omap2430.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
* Some code has been taken from tusb6010.c
* Copyrights for that are attributable to:
* Copyright (C) 2006 Nokia Corporation
* Jarkko Nikula <jarkko.nikula@nokia.com>
* Tony Lindgren <tony@atomide.com>
*
* This file is part of the Inventra Controller Driver for Linux.
Expand Down
1 change: 0 additions & 1 deletion drivers/usb/musb/tusb6010.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
* TUSB6010 USB 2.0 OTG Dual Role controller
*
* Copyright (C) 2006 Nokia Corporation
* Jarkko Nikula <jarkko.nikula@nokia.com>
* Tony Lindgren <tony@atomide.com>
*
* This program is free software; you can redistribute it and/or modify
Expand Down
1 change: 0 additions & 1 deletion drivers/usb/musb/tusb6010.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
* Definitions for TUSB6010 USB 2.0 OTG Dual Role controller
*
* Copyright (C) 2006 Nokia Corporation
* Jarkko Nikula <jarkko.nikula@nokia.com>
* Tony Lindgren <tony@atomide.com>
*
* This program is free software; you can redistribute it and/or modify
Expand Down
3 changes: 2 additions & 1 deletion drivers/usb/otg/otg.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ EXPORT_SYMBOL(otg_get_transceiver);
*/
void otg_put_transceiver(struct otg_transceiver *x)
{
put_device(x->dev);
if (x)
put_device(x->dev);
}
EXPORT_SYMBOL(otg_put_transceiver);

Expand Down
7 changes: 0 additions & 7 deletions drivers/usb/serial/cyberjack.c
Original file line number Diff line number Diff line change
Expand Up @@ -175,13 +175,6 @@ static int cyberjack_open(struct tty_struct *tty,
dbg("%s - usb_clear_halt", __func__);
usb_clear_halt(port->serial->dev, port->write_urb->pipe);

/* force low_latency on so that our tty_push actually forces
* the data through, otherwise it is scheduled, and with high
* data rates (like with OHCI) data can get lost.
*/
if (tty)
tty->low_latency = 1;

priv = usb_get_serial_port_data(port);
spin_lock_irqsave(&priv->lock, flags);
priv->rdtodo = 0;
Expand Down
4 changes: 0 additions & 4 deletions drivers/usb/serial/cypress_m8.c
Original file line number Diff line number Diff line change
Expand Up @@ -656,10 +656,6 @@ static int cypress_open(struct tty_struct *tty,
priv->rx_flags = 0;
spin_unlock_irqrestore(&priv->lock, flags);

/* setting to zero could cause data loss */
if (tty)
tty->low_latency = 1;

/* raise both lines and set termios */
spin_lock_irqsave(&priv->lock, flags);
priv->line_control = CONTROL_DTR | CONTROL_RTS;
Expand Down
6 changes: 0 additions & 6 deletions drivers/usb/serial/empeg.c
Original file line number Diff line number Diff line change
Expand Up @@ -478,12 +478,6 @@ static void empeg_set_termios(struct tty_struct *tty,
termios->c_cflag
|= CS8; /* character size 8 bits */

/*
* Force low_latency on; otherwise the pushes are scheduled;
* this is bad as it opens up the possibility of dropping bytes
* on the floor. We don't want to drop bytes on the floor. :)
*/
tty->low_latency = 1;
tty_encode_baud_rate(tty, 115200, 115200);
}

Expand Down
8 changes: 0 additions & 8 deletions drivers/usb/serial/garmin_gps.c
Original file line number Diff line number Diff line change
Expand Up @@ -973,14 +973,6 @@ static int garmin_open(struct tty_struct *tty,

dbg("%s - port %d", __func__, port->number);

/*
* Force low_latency on so that our tty_push actually forces the data
* through, otherwise it is scheduled, and with high data rates (like
* with OHCI) data can get lost.
*/
if (tty)
tty->low_latency = 1;

spin_lock_irqsave(&garmin_data_p->lock, flags);
garmin_data_p->mode = initial_mode;
garmin_data_p->count = 0;
Expand Down
6 changes: 0 additions & 6 deletions drivers/usb/serial/generic.c
Original file line number Diff line number Diff line change
Expand Up @@ -122,12 +122,6 @@ int usb_serial_generic_open(struct tty_struct *tty,

dbg("%s - port %d", __func__, port->number);

/* force low_latency on so that our tty_push actually forces the data
through, otherwise it is scheduled, and with high data rates (like
with OHCI) data can get lost. */
if (tty)
tty->low_latency = 1;

/* clear the throttle flags */
spin_lock_irqsave(&port->lock, flags);
port->throttled = 0;
Expand Down
8 changes: 0 additions & 8 deletions drivers/usb/serial/io_edgeport.c
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,6 @@ static const struct divisor_table_entry divisor_table[] = {
/* local variables */
static int debug;

static int low_latency = 1; /* tty low latency flag, on by default */

static atomic_t CmdUrbs; /* Number of outstanding Command Write Urbs */


Expand Down Expand Up @@ -867,9 +865,6 @@ static int edge_open(struct tty_struct *tty,
if (edge_port == NULL)
return -ENODEV;

if (tty)
tty->low_latency = low_latency;

/* see if we've set up our endpoint info yet (can't set it up
in edge_startup as the structures were not set up at that time.) */
serial = port->serial;
Expand Down Expand Up @@ -3299,6 +3294,3 @@ MODULE_FIRMWARE("edgeport/down2.fw");

module_param(debug, bool, S_IRUGO | S_IWUSR);
MODULE_PARM_DESC(debug, "Debug enabled or not");

module_param(low_latency, bool, S_IRUGO | S_IWUSR);
MODULE_PARM_DESC(low_latency, "Low latency enabled or not");
8 changes: 0 additions & 8 deletions drivers/usb/serial/io_ti.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ struct edgeport_uart_buf_desc {
#define EDGE_READ_URB_STOPPING 1
#define EDGE_READ_URB_STOPPED 2

#define EDGE_LOW_LATENCY 1
#define EDGE_CLOSING_WAIT 4000 /* in .01 sec */

#define EDGE_OUT_BUF_SIZE 1024
Expand Down Expand Up @@ -232,7 +231,6 @@ static unsigned short OperationalBuildNumber;

static int debug;

static int low_latency = EDGE_LOW_LATENCY;
static int closing_wait = EDGE_CLOSING_WAIT;
static int ignore_cpu_rev;
static int default_uart_mode; /* RS232 */
Expand Down Expand Up @@ -1850,9 +1848,6 @@ static int edge_open(struct tty_struct *tty,
if (edge_port == NULL)
return -ENODEV;

if (tty)
tty->low_latency = low_latency;

port_number = port->number - port->serial->minor;
switch (port_number) {
case 0:
Expand Down Expand Up @@ -3008,9 +3003,6 @@ MODULE_FIRMWARE("edgeport/down3.bin");
module_param(debug, bool, S_IRUGO | S_IWUSR);
MODULE_PARM_DESC(debug, "Debug enabled or not");

module_param(low_latency, bool, S_IRUGO | S_IWUSR);
MODULE_PARM_DESC(low_latency, "Low latency enabled or not");

module_param(closing_wait, int, S_IRUGO | S_IWUSR);
MODULE_PARM_DESC(closing_wait, "Maximum wait for data to drain, in .01 secs");

Expand Down
6 changes: 0 additions & 6 deletions drivers/usb/serial/ipaq.c
Original file line number Diff line number Diff line change
Expand Up @@ -631,13 +631,7 @@ static int ipaq_open(struct tty_struct *tty,
priv->free_len += PACKET_SIZE;
}

/*
* Force low latency on. This will immediately push data to the line
* discipline instead of queueing.
*/

if (tty) {
tty->low_latency = 1;
/* FIXME: These two are bogus */
tty->raw = 1;
tty->real_raw = 1;
Expand Down
3 changes: 0 additions & 3 deletions drivers/usb/serial/ipw.c
Original file line number Diff line number Diff line change
Expand Up @@ -207,9 +207,6 @@ static int ipw_open(struct tty_struct *tty,
if (!buf_flow_init)
return -ENOMEM;

if (tty)
tty->low_latency = 1;

/* --1: Tell the modem to initialize (we think) From sniffs this is
* always the first thing that gets sent to the modem during
* opening of the device */
Expand Down
1 change: 0 additions & 1 deletion drivers/usb/serial/iuu_phoenix.c
Original file line number Diff line number Diff line change
Expand Up @@ -1051,7 +1051,6 @@ static int iuu_open(struct tty_struct *tty,
tty->termios->c_oflag = 0;
tty->termios->c_iflag = 0;
priv->termios_initialized = 1;
tty->low_latency = 1;
priv->poll = 0;
}
spin_unlock_irqrestore(&priv->lock, flags);
Expand Down
Loading

0 comments on commit d72cd3a

Please sign in to comment.