Skip to content

Commit

Permalink
Merge branch 'usb-linus' of git://git.kernel.org/pub/scm/linux/kernel…
Browse files Browse the repository at this point in the history
…/git/gregkh/usb-2.6

* 'usb-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb-2.6: (28 commits)
  Revert "USB: xhci: Use GFP_ATOMIC under spin_lock"
  USB: ohci-jz4740: Fix spelling in MODULE_ALIAS
  UWB: Return UWB_RSV_ALLOC_NOT_FOUND rather than crashing on NULL dereference if kzalloc fails
  usb: core: fix information leak to userland
  usb: misc: iowarrior: fix information leak to userland
  usb: misc: sisusbvga: fix information leak to userland
  usb: subtle increased memory usage in u_serial
  USB: option: fix when the driver is loaded incorrectly for some Huawei devices.
  USB: xhci: Use GFP_ATOMIC under spin_lock
  usb: gadget: goku_udc: add registered flag bit, fixing build
  USB: ehci/mxc: compile fix
  USB: Fix FSL USB driver on non Open Firmware systems
  USB: the development of the usb tree is now in git
  usb: musb: fail unaligned DMA transfers on v1.8 and above
  USB: ftdi_sio: add device IDs for Milkymist One JTAG/serial
  usb.h: fix ioctl kernel-doc info
  usb: musb: gadget: kill duplicate code in musb_gadget_queue()
  usb: musb: Fix handling of spurious SESSREQ
  usb: musb: fix kernel oops when loading musb_hdrc module for the 2nd time
  USB: musb: blackfin: push clkin value to platform resources
  ...
  • Loading branch information
Linus Torvalds committed Nov 13, 2010
2 parents edaa4d6 + 8687197 commit 00dad7f
Show file tree
Hide file tree
Showing 22 changed files with 188 additions and 99 deletions.
2 changes: 1 addition & 1 deletion MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -6233,7 +6233,7 @@ USB SUBSYSTEM
M: Greg Kroah-Hartman <gregkh@suse.de>
L: linux-usb@vger.kernel.org
W: http://www.linux-usb.org
T: quilt kernel.org/pub/linux/kernel/people/gregkh/gregkh-2.6/
T: git git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb-2.6.git
S: Supported
F: Documentation/usb/
F: drivers/net/usb/
Expand Down
7 changes: 4 additions & 3 deletions drivers/usb/core/devio.c
Original file line number Diff line number Diff line change
Expand Up @@ -965,10 +965,11 @@ static int proc_getdriver(struct dev_state *ps, void __user *arg)

static int proc_connectinfo(struct dev_state *ps, void __user *arg)
{
struct usbdevfs_connectinfo ci;
struct usbdevfs_connectinfo ci = {
.devnum = ps->dev->devnum,
.slow = ps->dev->speed == USB_SPEED_LOW
};

ci.devnum = ps->dev->devnum;
ci.slow = ps->dev->speed == USB_SPEED_LOW;
if (copy_to_user(arg, &ci, sizeof(ci)))
return -EFAULT;
return 0;
Expand Down
2 changes: 1 addition & 1 deletion drivers/usb/gadget/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ config USB_GADGET_FSL_USB2
boolean "Freescale Highspeed USB DR Peripheral Controller"
depends on FSL_SOC || ARCH_MXC
select USB_GADGET_DUALSPEED
select USB_FSL_MPH_DR_OF
select USB_FSL_MPH_DR_OF if OF
help
Some of Freescale PowerPC processors have a High Speed
Dual-Role(DR) USB controller, which supports device mode.
Expand Down
3 changes: 2 additions & 1 deletion drivers/usb/gadget/goku_udc.h
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,8 @@ struct goku_udc {
got_region:1,
req_config:1,
configured:1,
enabled:1;
enabled:1,
registered:1;

/* pci state used to access those endpoints */
struct pci_dev *pdev;
Expand Down
54 changes: 40 additions & 14 deletions drivers/usb/gadget/u_serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,15 @@ struct gs_port {
wait_queue_head_t close_wait; /* wait for last close */

struct list_head read_pool;
int read_started;
int read_allocated;
struct list_head read_queue;
unsigned n_read;
struct tasklet_struct push;

struct list_head write_pool;
int write_started;
int write_allocated;
struct gs_buf port_write_buf;
wait_queue_head_t drain_wait; /* wait while writes drain */

Expand Down Expand Up @@ -363,6 +367,9 @@ __acquires(&port->port_lock)
struct usb_request *req;
int len;

if (port->write_started >= QUEUE_SIZE)
break;

req = list_entry(pool->next, struct usb_request, list);
len = gs_send_packet(port, req->buf, in->maxpacket);
if (len == 0) {
Expand Down Expand Up @@ -397,6 +404,8 @@ __acquires(&port->port_lock)
break;
}

port->write_started++;

/* abort immediately after disconnect */
if (!port->port_usb)
break;
Expand All @@ -418,7 +427,6 @@ __acquires(&port->port_lock)
{
struct list_head *pool = &port->read_pool;
struct usb_ep *out = port->port_usb->out;
unsigned started = 0;

while (!list_empty(pool)) {
struct usb_request *req;
Expand All @@ -430,6 +438,9 @@ __acquires(&port->port_lock)
if (!tty)
break;

if (port->read_started >= QUEUE_SIZE)
break;

req = list_entry(pool->next, struct usb_request, list);
list_del(&req->list);
req->length = out->maxpacket;
Expand All @@ -447,13 +458,13 @@ __acquires(&port->port_lock)
list_add(&req->list, pool);
break;
}
started++;
port->read_started++;

/* abort immediately after disconnect */
if (!port->port_usb)
break;
}
return started;
return port->read_started;
}

/*
Expand Down Expand Up @@ -535,6 +546,7 @@ static void gs_rx_push(unsigned long _port)
}
recycle:
list_move(&req->list, &port->read_pool);
port->read_started--;
}

/* Push from tty to ldisc; without low_latency set this is handled by
Expand Down Expand Up @@ -587,6 +599,7 @@ static void gs_write_complete(struct usb_ep *ep, struct usb_request *req)

spin_lock(&port->port_lock);
list_add(&req->list, &port->write_pool);
port->write_started--;

switch (req->status) {
default:
Expand All @@ -608,33 +621,40 @@ static void gs_write_complete(struct usb_ep *ep, struct usb_request *req)
spin_unlock(&port->port_lock);
}

static void gs_free_requests(struct usb_ep *ep, struct list_head *head)
static void gs_free_requests(struct usb_ep *ep, struct list_head *head,
int *allocated)
{
struct usb_request *req;

while (!list_empty(head)) {
req = list_entry(head->next, struct usb_request, list);
list_del(&req->list);
gs_free_req(ep, req);
if (allocated)
(*allocated)--;
}
}

static int gs_alloc_requests(struct usb_ep *ep, struct list_head *head,
void (*fn)(struct usb_ep *, struct usb_request *))
void (*fn)(struct usb_ep *, struct usb_request *),
int *allocated)
{
int i;
struct usb_request *req;
int n = allocated ? QUEUE_SIZE - *allocated : QUEUE_SIZE;

/* Pre-allocate up to QUEUE_SIZE transfers, but if we can't
* do quite that many this time, don't fail ... we just won't
* be as speedy as we might otherwise be.
*/
for (i = 0; i < QUEUE_SIZE; i++) {
for (i = 0; i < n; i++) {
req = gs_alloc_req(ep, ep->maxpacket, GFP_ATOMIC);
if (!req)
return list_empty(head) ? -ENOMEM : 0;
req->complete = fn;
list_add_tail(&req->list, head);
if (allocated)
(*allocated)++;
}
return 0;
}
Expand All @@ -661,14 +681,15 @@ static int gs_start_io(struct gs_port *port)
* configurations may use different endpoints with a given port;
* and high speed vs full speed changes packet sizes too.
*/
status = gs_alloc_requests(ep, head, gs_read_complete);
status = gs_alloc_requests(ep, head, gs_read_complete,
&port->read_allocated);
if (status)
return status;

status = gs_alloc_requests(port->port_usb->in, &port->write_pool,
gs_write_complete);
gs_write_complete, &port->write_allocated);
if (status) {
gs_free_requests(ep, head);
gs_free_requests(ep, head, &port->read_allocated);
return status;
}

Expand All @@ -680,8 +701,9 @@ static int gs_start_io(struct gs_port *port)
if (started) {
tty_wakeup(port->port_tty);
} else {
gs_free_requests(ep, head);
gs_free_requests(port->port_usb->in, &port->write_pool);
gs_free_requests(ep, head, &port->read_allocated);
gs_free_requests(port->port_usb->in, &port->write_pool,
&port->write_allocated);
status = -EIO;
}

Expand Down Expand Up @@ -1315,8 +1337,12 @@ void gserial_disconnect(struct gserial *gser)
spin_lock_irqsave(&port->port_lock, flags);
if (port->open_count == 0 && !port->openclose)
gs_buf_free(&port->port_write_buf);
gs_free_requests(gser->out, &port->read_pool);
gs_free_requests(gser->out, &port->read_queue);
gs_free_requests(gser->in, &port->write_pool);
gs_free_requests(gser->out, &port->read_pool, NULL);
gs_free_requests(gser->out, &port->read_queue, NULL);
gs_free_requests(gser->in, &port->write_pool, NULL);

port->read_allocated = port->read_started =
port->write_allocated = port->write_started = 0;

spin_unlock_irqrestore(&port->port_lock, flags);
}
2 changes: 1 addition & 1 deletion drivers/usb/host/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ config USB_EHCI_FSL
bool "Support for Freescale on-chip EHCI USB controller"
depends on USB_EHCI_HCD && FSL_SOC
select USB_EHCI_ROOT_HUB_TT
select USB_FSL_MPH_DR_OF
select USB_FSL_MPH_DR_OF if OF
---help---
Variation of ARC USB block used in some Freescale chips.

Expand Down
14 changes: 9 additions & 5 deletions drivers/usb/host/ehci-mxc.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ struct ehci_mxc_priv {
static int ehci_mxc_setup(struct usb_hcd *hcd)
{
struct ehci_hcd *ehci = hcd_to_ehci(hcd);
struct device *dev = hcd->self.controller;
struct mxc_usbh_platform_data *pdata = dev_get_platdata(dev);
int retval;

/* EHCI registers start at offset 0x100 */
Expand Down Expand Up @@ -63,6 +65,12 @@ static int ehci_mxc_setup(struct usb_hcd *hcd)

ehci_reset(ehci);

/* set up the PORTSCx register */
ehci_writel(ehci, pdata->portsc, &ehci->regs->port_status[0]);

/* is this really needed? */
msleep(10);

ehci_port_power(ehci, 0);
return 0;
}
Expand Down Expand Up @@ -114,7 +122,7 @@ static int ehci_mxc_drv_probe(struct platform_device *pdev)
struct mxc_usbh_platform_data *pdata = pdev->dev.platform_data;
struct usb_hcd *hcd;
struct resource *res;
int irq, ret, temp;
int irq, ret;
struct ehci_mxc_priv *priv;
struct device *dev = &pdev->dev;

Expand Down Expand Up @@ -188,10 +196,6 @@ static int ehci_mxc_drv_probe(struct platform_device *pdev)
clk_enable(priv->ahbclk);
}

/* set up the PORTSCx register */
ehci_writel(ehci, pdata->portsc, &ehci->regs->port_status[0]);
mdelay(10);

/* setup specific usb hw */
ret = mxc_initialize_usb_hw(pdev->id, pdata->flags);
if (ret < 0)
Expand Down
2 changes: 1 addition & 1 deletion drivers/usb/host/ohci-jz4740.c
Original file line number Diff line number Diff line change
Expand Up @@ -273,4 +273,4 @@ static struct platform_driver ohci_hcd_jz4740_driver = {
},
};

MODULE_ALIAS("platfrom:jz4740-ohci");
MODULE_ALIAS("platform:jz4740-ohci");
1 change: 1 addition & 0 deletions drivers/usb/misc/iowarrior.c
Original file line number Diff line number Diff line change
Expand Up @@ -553,6 +553,7 @@ static long iowarrior_ioctl(struct file *file, unsigned int cmd,
/* needed for power consumption */
struct usb_config_descriptor *cfg_descriptor = &dev->udev->actconfig->desc;

memset(&info, 0, sizeof(info));
/* directly from the descriptor */
info.vendor = le16_to_cpu(dev->udev->descriptor.idVendor);
info.product = dev->product_id;
Expand Down
1 change: 1 addition & 0 deletions drivers/usb/misc/sisusbvga/sisusb.c
Original file line number Diff line number Diff line change
Expand Up @@ -3008,6 +3008,7 @@ sisusb_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
#else
x.sisusb_conactive = 0;
#endif
memset(x.sisusb_reserved, 0, sizeof(x.sisusb_reserved));

if (copy_to_user((void __user *)arg, &x, sizeof(x)))
retval = -EFAULT;
Expand Down
Loading

0 comments on commit 00dad7f

Please sign in to comment.