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: (103 commits)
  usbcore: remove unused argument in autosuspend
  USB: keep count of unsuspended children
  USB hub: simplify remote-wakeup handling
  USB: struct usb_device: change flag to bitflag
  OHCI: make autostop conditional on CONFIG_PM
  USB: Add autosuspend support to the hub driver
  EHCI: Fix root-hub and port suspend/resume problems
  USB: create a new thread for every USB device found during the probe sequence
  USB: add driver for the USB debug devices
  USB: added dynamic major number for USB endpoints
  USB: pegasus error path not resetting task's state
  USB: endianness fix for asix.c
  USB: build the appledisplay driver
  USB serial: replace kmalloc+memset with kzalloc
  USB: hid-core: canonical defines for Apple USB device IDs
  USB: idmouse cleanup
  USB: make drivers/usb/core/driver.c:usb_device_match() static
  USB: lh7a40x_udc remove double declaration
  USB: pxa2xx_udc recognizes ixp425 rev b0 chip
  usbtouchscreen: add support for DMC TSC-10/25 devices
  ...
  • Loading branch information
Linus Torvalds committed Dec 2, 2006
2 parents 72a73a6 + 94fcda1 commit 9641219
Show file tree
Hide file tree
Showing 98 changed files with 1,264 additions and 851 deletions.
3 changes: 1 addition & 2 deletions Documentation/DocBook/writing_usb_driver.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -345,8 +345,7 @@ static inline void skel_delete (struct usb_skel *dev)
usb_buffer_free (dev->udev, dev->bulk_out_size,
dev->bulk_out_buffer,
dev->write_urb->transfer_dma);
if (dev->write_urb != NULL)
usb_free_urb (dev->write_urb);
usb_free_urb (dev->write_urb);
kfree (dev);
}
</programlisting>
Expand Down
3 changes: 1 addition & 2 deletions drivers/char/watchdog/pcwd_usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -561,8 +561,7 @@ static struct notifier_block usb_pcwd_notifier = {
*/
static inline void usb_pcwd_delete (struct usb_pcwd_private *usb_pcwd)
{
if (usb_pcwd->intr_urb != NULL)
usb_free_urb (usb_pcwd->intr_urb);
usb_free_urb(usb_pcwd->intr_urb);
if (usb_pcwd->intr_buffer != NULL)
usb_buffer_free(usb_pcwd->udev, usb_pcwd->intr_size,
usb_pcwd->intr_buffer, usb_pcwd->intr_dma);
Expand Down
6 changes: 3 additions & 3 deletions drivers/input/joystick/iforce/iforce-usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -178,9 +178,9 @@ static int iforce_usb_probe(struct usb_interface *intf,

fail:
if (iforce) {
if (iforce->irq) usb_free_urb(iforce->irq);
if (iforce->out) usb_free_urb(iforce->out);
if (iforce->ctrl) usb_free_urb(iforce->ctrl);
usb_free_urb(iforce->irq);
usb_free_urb(iforce->out);
usb_free_urb(iforce->ctrl);
kfree(iforce);
}

Expand Down
15 changes: 5 additions & 10 deletions drivers/isdn/gigaset/usb-gigaset.c
Original file line number Diff line number Diff line change
Expand Up @@ -815,14 +815,11 @@ static int gigaset_probe(struct usb_interface *interface,
return 0;

error:
if (ucs->read_urb)
usb_kill_urb(ucs->read_urb);
usb_kill_urb(ucs->read_urb);
kfree(ucs->bulk_out_buffer);
if (ucs->bulk_out_urb != NULL)
usb_free_urb(ucs->bulk_out_urb);
usb_free_urb(ucs->bulk_out_urb);
kfree(cs->inbuf[0].rcvbuf);
if (ucs->read_urb != NULL)
usb_free_urb(ucs->read_urb);
usb_free_urb(ucs->read_urb);
usb_set_intfdata(interface, NULL);
ucs->read_urb = ucs->bulk_out_urb = NULL;
cs->inbuf[0].rcvbuf = ucs->bulk_out_buffer = NULL;
Expand Down Expand Up @@ -850,11 +847,9 @@ static void gigaset_disconnect(struct usb_interface *interface)
usb_kill_urb(ucs->bulk_out_urb); /* FIXME: only if active? */

kfree(ucs->bulk_out_buffer);
if (ucs->bulk_out_urb != NULL)
usb_free_urb(ucs->bulk_out_urb);
usb_free_urb(ucs->bulk_out_urb);
kfree(cs->inbuf[0].rcvbuf);
if (ucs->read_urb != NULL)
usb_free_urb(ucs->read_urb);
usb_free_urb(ucs->read_urb);
ucs->read_urb = ucs->bulk_out_urb = NULL;
cs->inbuf[0].rcvbuf = ucs->bulk_out_buffer = NULL;

Expand Down
6 changes: 2 additions & 4 deletions drivers/media/dvb/cinergyT2/cinergyT2.c
Original file line number Diff line number Diff line change
Expand Up @@ -275,8 +275,7 @@ static void cinergyt2_free_stream_urbs (struct cinergyt2 *cinergyt2)
int i;

for (i=0; i<STREAM_URB_COUNT; i++)
if (cinergyt2->stream_urb[i])
usb_free_urb(cinergyt2->stream_urb[i]);
usb_free_urb(cinergyt2->stream_urb[i]);

usb_buffer_free(cinergyt2->udev, STREAM_URB_COUNT*STREAM_BUF_SIZE,
cinergyt2->streambuf, cinergyt2->streambuf_dmahandle);
Expand Down Expand Up @@ -320,8 +319,7 @@ static void cinergyt2_stop_stream_xfer (struct cinergyt2 *cinergyt2)
cinergyt2_control_stream_transfer(cinergyt2, 0);

for (i=0; i<STREAM_URB_COUNT; i++)
if (cinergyt2->stream_urb[i])
usb_kill_urb(cinergyt2->stream_urb[i]);
usb_kill_urb(cinergyt2->stream_urb[i]);
}

static int cinergyt2_start_stream_xfer (struct cinergyt2 *cinergyt2)
Expand Down
3 changes: 1 addition & 2 deletions drivers/media/dvb/ttusb-dec/ttusb_dec.c
Original file line number Diff line number Diff line change
Expand Up @@ -1135,8 +1135,7 @@ static void ttusb_dec_free_iso_urbs(struct ttusb_dec *dec)
dprintk("%s\n", __FUNCTION__);

for (i = 0; i < ISO_BUF_COUNT; i++)
if (dec->iso_urb[i])
usb_free_urb(dec->iso_urb[i]);
usb_free_urb(dec->iso_urb[i]);

pci_free_consistent(NULL,
ISO_FRAME_SIZE * (FRAMES_PER_ISO_BUF *
Expand Down
10 changes: 4 additions & 6 deletions drivers/media/video/pvrusb2/pvrusb2-hdw.c
Original file line number Diff line number Diff line change
Expand Up @@ -1953,8 +1953,8 @@ struct pvr2_hdw *pvr2_hdw_create(struct usb_interface *intf,
return hdw;
fail:
if (hdw) {
if (hdw->ctl_read_urb) usb_free_urb(hdw->ctl_read_urb);
if (hdw->ctl_write_urb) usb_free_urb(hdw->ctl_write_urb);
usb_free_urb(hdw->ctl_read_urb);
usb_free_urb(hdw->ctl_write_urb);
if (hdw->ctl_read_buffer) kfree(hdw->ctl_read_buffer);
if (hdw->ctl_write_buffer) kfree(hdw->ctl_write_buffer);
if (hdw->controls) kfree(hdw->controls);
Expand Down Expand Up @@ -2575,12 +2575,10 @@ static void pvr2_ctl_timeout(unsigned long data)
struct pvr2_hdw *hdw = (struct pvr2_hdw *)data;
if (hdw->ctl_write_pend_flag || hdw->ctl_read_pend_flag) {
hdw->ctl_timeout_flag = !0;
if (hdw->ctl_write_pend_flag && hdw->ctl_write_urb) {
if (hdw->ctl_write_pend_flag)
usb_unlink_urb(hdw->ctl_write_urb);
}
if (hdw->ctl_read_pend_flag && hdw->ctl_read_urb) {
if (hdw->ctl_read_pend_flag)
usb_unlink_urb(hdw->ctl_read_urb);
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion drivers/media/video/pvrusb2/pvrusb2-io.c
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ static void pvr2_buffer_done(struct pvr2_buffer *bp)
pvr2_buffer_set_none(bp);
bp->signature = 0;
bp->stream = NULL;
if (bp->purb) usb_free_urb(bp->purb);
usb_free_urb(bp->purb);
pvr2_trace(PVR2_TRACE_BUF_POOL,"/*---TRACE_FLOW---*/"
" bufferDone %p",bp);
}
Expand Down
6 changes: 2 additions & 4 deletions drivers/media/video/pwc/pwc-if.c
Original file line number Diff line number Diff line change
Expand Up @@ -866,11 +866,9 @@ int pwc_isoc_init(struct pwc_device *pdev)
}
if (ret) {
/* De-allocate in reverse order */
while (i >= 0) {
if (pdev->sbuf[i].urb != NULL)
usb_free_urb(pdev->sbuf[i].urb);
while (i--) {
usb_free_urb(pdev->sbuf[i].urb);
pdev->sbuf[i].urb = NULL;
i--;
}
return ret;
}
Expand Down
2 changes: 1 addition & 1 deletion drivers/media/video/sn9c102/sn9c102_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -775,7 +775,7 @@ static int sn9c102_start_transfer(struct sn9c102_device* cam)
return 0;

free_urbs:
for (i = 0; (i < SN9C102_URBS) && cam->urb[i]; i++)
for (i = 0; i < SN9C102_URBS; i++)
usb_free_urb(cam->urb[i]);

free_buffers:
Expand Down
3 changes: 1 addition & 2 deletions drivers/media/video/usbvideo/quickcam_messenger.c
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,7 @@ static int qcm_alloc_int_urb(struct qcm *cam)

static void qcm_free_int(struct qcm *cam)
{
if (cam->button_urb)
usb_free_urb(cam->button_urb);
usb_free_urb(cam->button_urb);
}
#endif /* CONFIG_INPUT */

Expand Down
2 changes: 1 addition & 1 deletion drivers/media/video/zc0301/zc0301_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ static int zc0301_start_transfer(struct zc0301_device* cam)
return 0;

free_urbs:
for (i = 0; (i < ZC0301_URBS) && cam->urb[i]; i++)
for (i = 0; i < ZC0301_URBS; i++)
usb_free_urb(cam->urb[i]);

free_buffers:
Expand Down
6 changes: 2 additions & 4 deletions drivers/net/irda/irda-usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -1793,10 +1793,8 @@ static int irda_usb_probe(struct usb_interface *intf,
err_out_2:
usb_free_urb(self->tx_urb);
err_out_1:
for (i = 0; i < self->max_rx_urb; i++) {
if (self->rx_urb[i])
usb_free_urb(self->rx_urb[i]);
}
for (i = 0; i < self->max_rx_urb; i++)
usb_free_urb(self->rx_urb[i]);
free_netdev(net);
err_out:
return ret;
Expand Down
6 changes: 2 additions & 4 deletions drivers/net/wireless/zd1201.c
Original file line number Diff line number Diff line change
Expand Up @@ -1828,10 +1828,8 @@ static int zd1201_probe(struct usb_interface *interface,
/* Leave the device in reset state */
zd1201_docmd(zd, ZD1201_CMDCODE_INIT, 0, 0, 0);
err_zd:
if (zd->tx_urb)
usb_free_urb(zd->tx_urb);
if (zd->rx_urb)
usb_free_urb(zd->rx_urb);
usb_free_urb(zd->tx_urb);
usb_free_urb(zd->rx_urb);
kfree(zd);
return err;
}
Expand Down
4 changes: 2 additions & 2 deletions drivers/usb/atm/speedtch.c
Original file line number Diff line number Diff line change
Expand Up @@ -834,8 +834,8 @@ static int speedtch_bind(struct usbatm_data *usbatm,
const struct usb_endpoint_descriptor *endpoint_desc = &desc->endpoint[i].desc;

if ((endpoint_desc->bEndpointAddress == target_address)) {
use_isoc = (endpoint_desc->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
USB_ENDPOINT_XFER_ISOC;
use_isoc =
usb_endpoint_xfer_isoc(endpoint_desc);
break;
}
}
Expand Down
10 changes: 3 additions & 7 deletions drivers/usb/atm/ueagle-atm.c
Original file line number Diff line number Diff line change
Expand Up @@ -401,9 +401,8 @@ static int uea_send_modem_cmd(struct usb_device *usb,
int ret = -ENOMEM;
u8 *xfer_buff;

xfer_buff = kmalloc(size, GFP_KERNEL);
xfer_buff = kmemdup(buff, size, GFP_KERNEL);
if (xfer_buff) {
memcpy(xfer_buff, buff, size);
ret = usb_control_msg(usb,
usb_sndctrlpipe(usb, 0),
LOAD_INTERNAL,
Expand Down Expand Up @@ -595,14 +594,12 @@ static int uea_idma_write(struct uea_softc *sc, void *data, u32 size)
u8 *xfer_buff;
int bytes_read;

xfer_buff = kmalloc(size, GFP_KERNEL);
xfer_buff = kmemdup(data, size, GFP_KERNEL);
if (!xfer_buff) {
uea_err(INS_TO_USBDEV(sc), "can't allocate xfer_buff\n");
return ret;
}

memcpy(xfer_buff, data, size);

ret = usb_bulk_msg(sc->usb_dev,
usb_sndbulkpipe(sc->usb_dev, UEA_IDMA_PIPE),
xfer_buff, size, &bytes_read, BULK_TIMEOUT);
Expand Down Expand Up @@ -765,12 +762,11 @@ static int uea_request(struct uea_softc *sc,
u8 *xfer_buff;
int ret = -ENOMEM;

xfer_buff = kmalloc(size, GFP_KERNEL);
xfer_buff = kmemdup(data, size, GFP_KERNEL);
if (!xfer_buff) {
uea_err(INS_TO_USBDEV(sc), "can't allocate xfer_buff\n");
return ret;
}
memcpy(xfer_buff, data, size);

ret = usb_control_msg(sc->usb_dev, usb_sndctrlpipe(sc->usb_dev, 0),
UCDC_SEND_ENCAPSULATED_COMMAND,
Expand Down
2 changes: 1 addition & 1 deletion drivers/usb/class/cdc-acm.c
Original file line number Diff line number Diff line change
Expand Up @@ -892,7 +892,7 @@ static int acm_probe (struct usb_interface *intf,


/* workaround for switched endpoints */
if ((epread->bEndpointAddress & USB_DIR_IN) != USB_DIR_IN) {
if (!usb_endpoint_dir_in(epread)) {
/* descriptors are swapped */
struct usb_endpoint_descriptor *t;
dev_dbg(&intf->dev,"The data interface has switched endpoints");
Expand Down
15 changes: 15 additions & 0 deletions drivers/usb/core/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,21 @@ config USB_SUSPEND

If you are unsure about this, say N here.

config USB_MULTITHREAD_PROBE
bool "USB Multi-threaded probe (EXPERIMENTAL)"
depends on USB && EXPERIMENTAL
default n
help
Say Y here if you want the USB core to spawn a new thread for
every USB device that is probed. This can cause a small speedup
in boot times on systems with a lot of different USB devices.

This option should be safe to enable, but if any odd probing
problems are found, please disable it, or dynamically turn it
off in the /sys/module/usbcore/parameters/multithread_probe
file

When in doubt, say N.

config USB_OTG
bool
Expand Down
9 changes: 5 additions & 4 deletions drivers/usb/core/devices.c
Original file line number Diff line number Diff line change
Expand Up @@ -175,12 +175,13 @@ static char *usb_dump_endpoint_descriptor (
)
{
char dir, unit, *type;
unsigned interval, in, bandwidth = 1;
unsigned interval, bandwidth = 1;

if (start > end)
return start;
in = (desc->bEndpointAddress & USB_DIR_IN);
dir = in ? 'I' : 'O';

dir = usb_endpoint_dir_in(desc) ? 'I' : 'O';

if (speed == USB_SPEED_HIGH) {
switch (le16_to_cpu(desc->wMaxPacketSize) & (0x03 << 11)) {
case 1 << 11: bandwidth = 2; break;
Expand All @@ -204,7 +205,7 @@ static char *usb_dump_endpoint_descriptor (
break;
case USB_ENDPOINT_XFER_BULK:
type = "Bulk";
if (speed == USB_SPEED_HIGH && !in) /* uframes per NAK */
if (speed == USB_SPEED_HIGH && dir == 'O') /* uframes per NAK */
interval = desc->bInterval;
else
interval = 0;
Expand Down
4 changes: 2 additions & 2 deletions drivers/usb/core/devio.c
Original file line number Diff line number Diff line change
Expand Up @@ -561,7 +561,7 @@ static int usbdev_open(struct inode *inode, struct file *file)
dev = inode->i_private;
if (!dev)
goto out;
ret = usb_autoresume_device(dev, 1);
ret = usb_autoresume_device(dev);
if (ret)
goto out;

Expand Down Expand Up @@ -609,7 +609,7 @@ static int usbdev_release(struct inode *inode, struct file *file)
releaseintf(ps, ifnum);
}
destroy_all_async(ps);
usb_autosuspend_device(dev, 1);
usb_autosuspend_device(dev);
usb_unlock_device(dev);
usb_put_dev(dev);
put_pid(ps->disc_pid);
Expand Down
Loading

0 comments on commit 9641219

Please sign in to comment.