Skip to content

Commit

Permalink
Merge master.kernel.org:/pub/scm/linux/kernel/git/gregkh/usb-2.6
Browse files Browse the repository at this point in the history
* master.kernel.org:/pub/scm/linux/kernel/git/gregkh/usb-2.6: (23 commits)
  USB Elan FTDI: check for workqueue creation
  USB: fix spinlock recursion in cdc-acm.c
  USB: fix Unaligned access in EHCI driver
  USB: Product ID for FT232RL in ftdi_sio
  USBNET: DM9501: Add Corega FEther USB-TXC support.
  USB: ipaq.c: Additional devices
  USB: further fix for usb-serial
  USB: fix usb-serial device naming bug
  USB: RTS/DTR signal patch for airprime driver
  USB: ftdi_sio: use port_probe / port_remove thereby fixing access to the latency_timer
  usb-serial: fix shutdown / device_unregister order
  USB: add Additional PIDs in ftdi_sio
  USB: add QL355P power supply ids to fdti_sio
  USB: New device IDs for cp2101 driver
  USB: kill dead code from hub.c
  USB: ratelimit debounce error messages
  USB: pxa2xx_udc: fix hardcoded irq number
  UHCI: fix port resume problem
  USB: set the correct interval for interrupt URBs
  USB: goku_udc: Remove crude cache coherency code
  ...
  • Loading branch information
Linus Torvalds committed Mar 10, 2007
2 parents 63e34ca + ee17b28 commit 2695cf4
Show file tree
Hide file tree
Showing 18 changed files with 186 additions and 127 deletions.
8 changes: 4 additions & 4 deletions drivers/usb/class/cdc-acm.c
Original file line number Diff line number Diff line change
Expand Up @@ -332,9 +332,9 @@ static void acm_rx_tasklet(unsigned long _acm)
if (!ACM_READY(acm))
return;

spin_lock(&acm->throttle_lock);
spin_lock_irqsave(&acm->throttle_lock, flags);
throttled = acm->throttle;
spin_unlock(&acm->throttle_lock);
spin_unlock_irqrestore(&acm->throttle_lock, flags);
if (throttled)
return;

Expand All @@ -352,9 +352,9 @@ static void acm_rx_tasklet(unsigned long _acm)
dbg("acm_rx_tasklet: procesing buf 0x%p, size = %d", buf, buf->size);

tty_buffer_request_room(tty, buf->size);
spin_lock(&acm->throttle_lock);
spin_lock_irqsave(&acm->throttle_lock, flags);
throttled = acm->throttle;
spin_unlock(&acm->throttle_lock);
spin_unlock_irqrestore(&acm->throttle_lock, flags);
if (!throttled)
tty_insert_flip_string(tty, buf->base, buf->size);
tty_flip_buffer_push(tty);
Expand Down
13 changes: 6 additions & 7 deletions drivers/usb/core/devio.c
Original file line number Diff line number Diff line change
Expand Up @@ -912,7 +912,7 @@ static int proc_do_submiturb(struct dev_state *ps, struct usbdevfs_urb *uurb,
struct async *as;
struct usb_ctrlrequest *dr = NULL;
unsigned int u, totlen, isofrmlen;
int ret, interval = 0, ifnum = -1;
int ret, ifnum = -1;

if (uurb->flags & ~(USBDEVFS_URB_ISO_ASAP|USBDEVFS_URB_SHORT_NOT_OK|
URB_NO_FSBR|URB_ZERO_PACKET))
Expand Down Expand Up @@ -992,7 +992,6 @@ static int proc_do_submiturb(struct dev_state *ps, struct usbdevfs_urb *uurb,
if ((ep->desc.bmAttributes & USB_ENDPOINT_XFERTYPE_MASK)
!= USB_ENDPOINT_XFER_ISOC)
return -EINVAL;
interval = 1 << min (15, ep->desc.bInterval - 1);
isofrmlen = sizeof(struct usbdevfs_iso_packet_desc) * uurb->number_of_packets;
if (!(isopkt = kmalloc(isofrmlen, GFP_KERNEL)))
return -ENOMEM;
Expand Down Expand Up @@ -1021,10 +1020,6 @@ static int proc_do_submiturb(struct dev_state *ps, struct usbdevfs_urb *uurb,
if ((ep->desc.bmAttributes & USB_ENDPOINT_XFERTYPE_MASK)
!= USB_ENDPOINT_XFER_INT)
return -EINVAL;
if (ps->dev->speed == USB_SPEED_HIGH)
interval = 1 << min (15, ep->desc.bInterval - 1);
else
interval = ep->desc.bInterval;
if (uurb->buffer_length > MAX_USBFS_BUFFER_SIZE)
return -EINVAL;
if (!access_ok((uurb->endpoint & USB_DIR_IN) ? VERIFY_WRITE : VERIFY_READ, uurb->buffer, uurb->buffer_length))
Expand Down Expand Up @@ -1053,7 +1048,11 @@ static int proc_do_submiturb(struct dev_state *ps, struct usbdevfs_urb *uurb,
as->urb->setup_packet = (unsigned char*)dr;
as->urb->start_frame = uurb->start_frame;
as->urb->number_of_packets = uurb->number_of_packets;
as->urb->interval = interval;
if (uurb->type == USBDEVFS_URB_TYPE_ISO ||
ps->dev->speed == USB_SPEED_HIGH)
as->urb->interval = 1 << min(15, ep->desc.bInterval - 1);
else
as->urb->interval = ep->desc.bInterval;
as->urb->context = as;
as->urb->complete = async_completed;
for (totlen = u = 0; u < uurb->number_of_packets; u++) {
Expand Down
9 changes: 1 addition & 8 deletions drivers/usb/core/hub.c
Original file line number Diff line number Diff line change
Expand Up @@ -1281,12 +1281,6 @@ int usb_new_device(struct usb_device *udev)
{
int err;

/* Lock ourself into memory in order to keep a probe sequence
* sleeping in a new thread from allowing us to be unloaded.
*/
if (!try_module_get(THIS_MODULE))
return -EINVAL;

/* Determine quirks */
usb_detect_quirks(udev);

Expand Down Expand Up @@ -1390,7 +1384,6 @@ int usb_new_device(struct usb_device *udev)
usb_autoresume_device(udev->parent);

exit:
module_put(THIS_MODULE);
return err;

fail:
Expand Down Expand Up @@ -2443,7 +2436,7 @@ static void hub_port_connect_change(struct usb_hub *hub, int port1,

if (portchange & USB_PORT_STAT_C_CONNECTION) {
status = hub_port_debounce(hub, port1);
if (status < 0) {
if (status < 0 && printk_ratelimit()) {
dev_err (hub_dev,
"connect-debounce failed, port %d disabled\n",
port1);
Expand Down
9 changes: 7 additions & 2 deletions drivers/usb/core/message.c
Original file line number Diff line number Diff line change
Expand Up @@ -221,10 +221,15 @@ int usb_bulk_msg(struct usb_device *usb_dev, unsigned int pipe,

if ((ep->desc.bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
USB_ENDPOINT_XFER_INT) {
int interval;

if (usb_dev->speed == USB_SPEED_HIGH)
interval = 1 << min(15, ep->desc.bInterval - 1);
else
interval = ep->desc.bInterval;
pipe = (pipe & ~(3 << 30)) | (PIPE_INTERRUPT << 30);
usb_fill_int_urb(urb, usb_dev, pipe, data, len,
usb_api_blocking_completion, NULL,
ep->desc.bInterval);
usb_api_blocking_completion, NULL, interval);
} else
usb_fill_bulk_urb(urb, usb_dev, pipe, data, len,
usb_api_blocking_completion, NULL);
Expand Down
6 changes: 3 additions & 3 deletions drivers/usb/gadget/at91_udc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1835,7 +1835,7 @@ static int at91udc_resume(struct platform_device *pdev)
#define at91udc_resume NULL
#endif

static struct platform_driver at91_udc = {
static struct platform_driver at91_udc_driver = {
.remove = __exit_p(at91udc_remove),
.shutdown = at91udc_shutdown,
.suspend = at91udc_suspend,
Expand All @@ -1848,13 +1848,13 @@ static struct platform_driver at91_udc = {

static int __init udc_init_module(void)
{
return platform_driver_probe(&at91_udc, at91udc_probe);
return platform_driver_probe(&at91_udc_driver, at91udc_probe);
}
module_init(udc_init_module);

static void __exit udc_exit_module(void)
{
platform_driver_unregister(&at91_udc);
platform_driver_unregister(&at91_udc_driver);
}
module_exit(udc_exit_module);

Expand Down
29 changes: 0 additions & 29 deletions drivers/usb/gadget/goku_udc.c
Original file line number Diff line number Diff line change
Expand Up @@ -297,27 +297,6 @@ goku_free_request(struct usb_ep *_ep, struct usb_request *_req)

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

#undef USE_KMALLOC

/* many common platforms have dma-coherent caches, which means that it's
* safe to use kmalloc() memory for all i/o buffers without using any
* cache flushing calls. (unless you're trying to share cache lines
* between dma and non-dma activities, which is a slow idea in any case.)
*
* other platforms need more care, with 2.6 having a moderately general
* solution except for the common "buffer is smaller than a page" case.
*/
#if defined(CONFIG_X86)
#define USE_KMALLOC

#elif defined(CONFIG_MIPS) && !defined(CONFIG_DMA_NONCOHERENT)
#define USE_KMALLOC

#elif defined(CONFIG_PPC) && !defined(CONFIG_NOT_COHERENT_CACHE)
#define USE_KMALLOC

#endif

/* allocating buffers this way eliminates dma mapping overhead, which
* on some platforms will mean eliminating a per-io buffer copy. with
* some kinds of system caches, further tweaks may still be needed.
Expand All @@ -334,11 +313,6 @@ goku_alloc_buffer(struct usb_ep *_ep, unsigned bytes,
return NULL;
*dma = DMA_ADDR_INVALID;

#if defined(USE_KMALLOC)
retval = kmalloc(bytes, gfp_flags);
if (retval)
*dma = virt_to_phys(retval);
#else
if (ep->dma) {
/* the main problem with this call is that it wastes memory
* on typical 1/N page allocations: it allocates 1-N pages.
Expand All @@ -348,15 +322,13 @@ goku_alloc_buffer(struct usb_ep *_ep, unsigned bytes,
bytes, dma, gfp_flags);
} else
retval = kmalloc(bytes, gfp_flags);
#endif
return retval;
}

static void
goku_free_buffer(struct usb_ep *_ep, void *buf, dma_addr_t dma, unsigned bytes)
{
/* free memory into the right allocator */
#ifndef USE_KMALLOC
if (dma != DMA_ADDR_INVALID) {
struct goku_ep *ep;

Expand All @@ -365,7 +337,6 @@ goku_free_buffer(struct usb_ep *_ep, void *buf, dma_addr_t dma, unsigned bytes)
return;
dma_free_coherent(&ep->dev->pdev->dev, bytes, buf, dma);
} else
#endif
kfree (buf);
}

Expand Down
2 changes: 1 addition & 1 deletion drivers/usb/gadget/pxa2xx_udc.c
Original file line number Diff line number Diff line change
Expand Up @@ -2616,7 +2616,7 @@ static int __init pxa2xx_udc_probe(struct platform_device *pdev)
if (retval != 0) {
printk(KERN_ERR "%s: can't get irq %i, err %d\n",
driver_name, vbus_irq, retval);
free_irq(IRQ_USB, dev);
free_irq(irq, dev);
return -EBUSY;
}
}
Expand Down
3 changes: 1 addition & 2 deletions drivers/usb/host/ehci-hub.c
Original file line number Diff line number Diff line change
Expand Up @@ -653,8 +653,7 @@ static int ehci_hub_control (
if (status & ~0xffff) /* only if wPortChange is interesting */
#endif
dbg_port (ehci, "GetStatus", wIndex + 1, temp);
// we "know" this alignment is good, caller used kmalloc()...
*((__le32 *) buf) = cpu_to_le32 (status);
put_unaligned(cpu_to_le32 (status), (__le32 *) buf);
break;
case SetHubFeature:
switch (wValue) {
Expand Down
11 changes: 7 additions & 4 deletions drivers/usb/host/uhci-hub.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ static __u8 root_hub_hub_des[] =
/* status change bits: nonzero writes will clear */
#define RWC_BITS (USBPORTSC_OCC | USBPORTSC_PEC | USBPORTSC_CSC)

/* suspend/resume bits: port suspended or port resuming */
#define SUSPEND_BITS (USBPORTSC_SUSP | USBPORTSC_RD)

/* A port that either is connected or has a changed-bit set will prevent
* us from AUTO_STOPPING.
*/
Expand Down Expand Up @@ -96,8 +99,8 @@ static void uhci_finish_suspend(struct uhci_hcd *uhci, int port,
int status;
int i;

if (inw(port_addr) & (USBPORTSC_SUSP | USBPORTSC_RD)) {
CLR_RH_PORTSTAT(USBPORTSC_SUSP | USBPORTSC_RD);
if (inw(port_addr) & SUSPEND_BITS) {
CLR_RH_PORTSTAT(SUSPEND_BITS);
if (test_bit(port, &uhci->resuming_ports))
set_bit(port, &uhci->port_c_suspend);

Expand All @@ -107,7 +110,7 @@ static void uhci_finish_suspend(struct uhci_hcd *uhci, int port,
* Experiments show that some controllers take longer, so
* we'll poll for completion. */
for (i = 0; i < 10; ++i) {
if (!(inw(port_addr) & USBPORTSC_RD))
if (!(inw(port_addr) & SUSPEND_BITS))
break;
udelay(1);
}
Expand Down Expand Up @@ -289,7 +292,7 @@ static int uhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
wPortStatus |= USB_PORT_STAT_CONNECTION;
if (status & USBPORTSC_PE) {
wPortStatus |= USB_PORT_STAT_ENABLE;
if (status & (USBPORTSC_SUSP | USBPORTSC_RD))
if (status & SUSPEND_BITS)
wPortStatus |= USB_PORT_STAT_SUSPEND;
}
if (status & USBPORTSC_OC)
Expand Down
18 changes: 16 additions & 2 deletions drivers/usb/misc/ftdi-elan.c
Original file line number Diff line number Diff line change
Expand Up @@ -2905,17 +2905,31 @@ static int __init ftdi_elan_init(void)
{
int result;
printk(KERN_INFO "driver %s built at %s on %s\n", ftdi_elan_driver.name,
__TIME__, __DATE__);
__TIME__, __DATE__);
init_MUTEX(&ftdi_module_lock);
INIT_LIST_HEAD(&ftdi_static_list);
status_queue = create_singlethread_workqueue("ftdi-status-control");
if (!status_queue)
goto err1;
command_queue = create_singlethread_workqueue("ftdi-command-engine");
if (!command_queue)
goto err2;
respond_queue = create_singlethread_workqueue("ftdi-respond-engine");
if (!respond_queue)
goto err3;
result = usb_register(&ftdi_elan_driver);
if (result)
printk(KERN_ERR "usb_register failed. Error number %d\n",
result);
result);
return result;

err3:
destroy_workqueue(command_queue);
err2:
destroy_workqueue(status_queue);
err1:
printk(KERN_ERR "%s couldn't create workqueue\n", ftdi_elan_driver.name);
return -ENOMEM;
}

static void __exit ftdi_elan_exit(void)
Expand Down
4 changes: 4 additions & 0 deletions drivers/usb/net/dm9601.c
Original file line number Diff line number Diff line change
Expand Up @@ -570,6 +570,10 @@ static const struct driver_info dm9601_info = {
};

static const struct usb_device_id products[] = {
{
USB_DEVICE(0x07aa, 0x9601), /* Corega FEther USB-TXC */
.driver_info = (unsigned long)&dm9601_info,
},
{
USB_DEVICE(0x0a46, 0x9601), /* Davicom USB-100 */
.driver_info = (unsigned long)&dm9601_info,
Expand Down
47 changes: 47 additions & 0 deletions drivers/usb/serial/airprime.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,43 @@ struct airprime_private {
int outstanding_urbs;
int throttled;
struct urb *read_urbp[NUM_READ_URBS];

/* Settings for the port */
int rts_state; /* Handshaking pins (outputs) */
int dtr_state;
int cts_state; /* Handshaking pins (inputs) */
int dsr_state;
int dcd_state;
int ri_state;
};

static int airprime_send_setup(struct usb_serial_port *port)
{
struct usb_serial *serial = port->serial;
struct airprime_private *priv;

dbg("%s", __FUNCTION__);

if (port->number != 0)
return 0;

priv = usb_get_serial_port_data(port);

if (port->tty) {
int val = 0;
if (priv->dtr_state)
val |= 0x01;
if (priv->rts_state)
val |= 0x02;

return usb_control_msg(serial->dev,
usb_rcvctrlpipe(serial->dev, 0),
0x22,0x21,val,0,NULL,0,USB_CTRL_SET_TIMEOUT);
}

return 0;
}

static void airprime_read_bulk_callback(struct urb *urb)
{
struct usb_serial_port *port = urb->context;
Expand Down Expand Up @@ -118,6 +153,10 @@ static int airprime_open(struct usb_serial_port *port, struct file *filp)
usb_set_serial_port_data(port, priv);
}

/* Set some sane defaults */
priv->rts_state = 1;
priv->dtr_state = 1;

for (i = 0; i < NUM_READ_URBS; ++i) {
buffer = kmalloc(buffer_size, GFP_KERNEL);
if (!buffer) {
Expand Down Expand Up @@ -151,6 +190,9 @@ static int airprime_open(struct usb_serial_port *port, struct file *filp)
/* remember this urb so we can kill it when the port is closed */
priv->read_urbp[i] = urb;
}

airprime_send_setup(port);

goto out;

errout:
Expand All @@ -176,6 +218,11 @@ static void airprime_close(struct usb_serial_port *port, struct file * filp)

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

priv->rts_state = 0;
priv->dtr_state = 0;

airprime_send_setup(port);

for (i = 0; i < NUM_READ_URBS; ++i) {
usb_kill_urb (priv->read_urbp[i]);
kfree (priv->read_urbp[i]->transfer_buffer);
Expand Down
2 changes: 2 additions & 0 deletions drivers/usb/serial/cp2101.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ static struct usb_device_id id_table [] = {
{ USB_DEVICE(0x10C4, 0x80CA) }, /* Degree Controls Inc */
{ USB_DEVICE(0x10C4, 0x80F6) }, /* Suunto sports instrument */
{ USB_DEVICE(0x10C4, 0x813D) }, /* Burnside Telecom Deskmobile */
{ USB_DEVICE(0x10C4, 0x814A) }, /* West Mountain Radio RIGblaster P&P */
{ USB_DEVICE(0x10C4, 0x814B) }, /* West Mountain Radio RIGtalk */
{ USB_DEVICE(0x10C4, 0x815E) }, /* Helicomm IP-Link 1220-DVM */
{ USB_DEVICE(0x10C4, 0x81C8) }, /* Lipowsky Industrie Elektronik GmbH, Baby-JTAG */
{ USB_DEVICE(0x10C4, 0x81E2) }, /* Lipowsky Industrie Elektronik GmbH, Baby-LIN */
Expand Down
Loading

0 comments on commit 2695cf4

Please sign in to comment.