Commit c1421735 authored by Linus Torvalds's avatar Linus Torvalds

Merge bk://linuxusb.bkbits.net/linus-2.5

into penguin.transmeta.com:/home/penguin/torvalds/repositories/kernel/linux
parents 7ad03e80 88b76130
......@@ -1734,6 +1734,14 @@ L: linux-usb-devel@lists.sourceforge.net
W: http://pegasus2.sourceforge.net/
S: Maintained
USB SCANNER DRIVER
P: Brian Beattie
M: beattie@beattie-home.net
L: linux-usb-users@lists.sourceforge.net
L: linux-usb-devel@lists.sourceforge.net
W: http://www.beattie-home.net/linux
S: Maintained
USB SE401 DRIVER
P: Jeroen Vreeken
M: pe1rxq@amsat.org
......
......@@ -163,6 +163,11 @@ static void cpia_usb_complete(struct urb *urb)
}
}
}
/* resubmit */
urb->dev = ucpia->dev;
if ((i = usb_submit_urb(urb, GFP_ATOMIC)) != 0)
printk(KERN_ERR __FUNCTION__ ": usb_submit_urb ret %d\n", i);
}
static int cpia_usb_open(void *privdata)
......@@ -200,7 +205,9 @@ static int cpia_usb_open(void *privdata)
ucpia->curbuff = ucpia->buffers[0];
ucpia->workbuff = ucpia->buffers[1];
/* We double buffer the Iso lists */
/* We double buffer the Iso lists, and also know the polling
* interval is every frame (1 == (1 << (bInterval -1))).
*/
urb = usb_alloc_urb(FRAMES_PER_DESC, GFP_KERNEL);
if (!urb) {
printk(KERN_ERR "cpia_init_isoc: usb_alloc_urb 0\n");
......@@ -216,6 +223,7 @@ static int cpia_usb_open(void *privdata)
urb->transfer_buffer = ucpia->sbuf[0].data;
urb->complete = cpia_usb_complete;
urb->number_of_packets = FRAMES_PER_DESC;
urb->interval = 1;
urb->transfer_buffer_length = FRAME_SIZE_PER_DESC * FRAMES_PER_DESC;
for (fx = 0; fx < FRAMES_PER_DESC; fx++) {
urb->iso_frame_desc[fx].offset = FRAME_SIZE_PER_DESC * fx;
......@@ -237,15 +245,14 @@ static int cpia_usb_open(void *privdata)
urb->transfer_buffer = ucpia->sbuf[1].data;
urb->complete = cpia_usb_complete;
urb->number_of_packets = FRAMES_PER_DESC;
urb->interval = 1;
urb->transfer_buffer_length = FRAME_SIZE_PER_DESC * FRAMES_PER_DESC;
for (fx = 0; fx < FRAMES_PER_DESC; fx++) {
urb->iso_frame_desc[fx].offset = FRAME_SIZE_PER_DESC * fx;
urb->iso_frame_desc[fx].length = FRAME_SIZE_PER_DESC;
}
ucpia->sbuf[1].urb->next = ucpia->sbuf[0].urb;
ucpia->sbuf[0].urb->next = ucpia->sbuf[1].urb;
/* queue the ISO urbs, and resubmit in the completion handler */
err = usb_submit_urb(ucpia->sbuf[0].urb, GFP_KERNEL);
if (err) {
printk(KERN_ERR "cpia_init_isoc: usb_submit_urb 0 ret %d\n",
......
......@@ -1221,6 +1221,7 @@ static int usbout_prepare_desc(struct usbout *u, struct urb *urb)
offs += cnt;
cp += cnt;
}
urb->interval = 1;
if (err)
u->dma.error++;
if (u->dma.mapped) {
......@@ -1291,6 +1292,7 @@ static int usbout_sync_prepare_desc(struct usbout *u, struct urb *urb)
urb->iso_frame_desc[i].length = 3;
urb->iso_frame_desc[i].offset = offs;
}
urb->interval = 1;
return 0;
}
......
......@@ -892,7 +892,6 @@ static int proc_submiturb(struct dev_state *ps, void *arg)
free_async(as);
return -ENOMEM;
}
as->urb->next = NULL;
as->urb->dev = ps->dev;
as->urb->pipe = (uurb.type << 30) | __create_pipe(ps->dev, uurb.endpoint & 0xf) | (uurb.endpoint & USB_DIR_IN);
as->urb->transfer_flags = uurb.flags;
......
......@@ -1407,11 +1407,6 @@ static int hcd_submit_urb (struct urb *urb, int mem_flags)
if (urb->transfer_buffer_length < 0)
return -EINVAL;
if (urb->next) {
warn ("use explicit queuing not urb->next");
return -EINVAL;
}
#ifdef DEBUG
/* stuff that drivers shouldn't do, but which shouldn't
* cause problems in HCDs if they get it wrong.
......@@ -1785,10 +1780,6 @@ static void hcd_irq (int irq, void *__hcd, struct pt_regs * r)
* HCDs must not use this for periodic URBs that are still scheduled
* and will be reissued. They should just call their completion handlers
* until the urb is returned to the device driver by unlinking.
*
* NOTE that no urb->next processing is done, even for isochronous URBs.
* ISO streaming functionality can be achieved by having completion handlers
* re-queue URBs. Such explicit queuing doesn't discard error reports.
*/
void usb_hcd_giveback_urb (struct usb_hcd *hcd, struct urb *urb)
{
......
......@@ -184,7 +184,6 @@ void usb_show_string(struct usb_device *dev, char *id, int index)
void usb_dump_urb (struct urb *urb)
{
printk ("urb :%p\n", urb);
printk ("next :%p\n", urb->next);
printk ("dev :%p\n", urb->dev);
printk ("pipe :%08X\n", urb->pipe);
printk ("status :%d\n", urb->status);
......
......@@ -10,12 +10,12 @@ fi
if [ "$CONFIG_USB_UHCI_HCD" != "y" ]; then
dep_tristate ' UHCI HCD Alternate (most Intel and VIA) support (EXPERIMENTAL)' CONFIG_USB_UHCI_HCD_ALT $CONFIG_USB $CONFIG_EXPERIMENTAL
fi
if [ "$CONFIG_USB_UHCI_ALT" != "y" ]; then
dep_tristate ' UHCI (Intel PIIX4, VIA, ...) support' CONFIG_USB_UHCI $CONFIG_USB
fi
if [ "$CONFIG_USB_UHCI" != "y" ]; then
dep_tristate ' UHCI Alternate Driver (JE) support' CONFIG_USB_UHCI_ALT $CONFIG_USB
else
define_bool CONFIG_USB_UHCI_ALT n
fi
#if [ "$CONFIG_USB_UHCI_ALT" != "y" ]; then
# dep_tristate ' UHCI (Intel PIIX4, VIA, ...) support' CONFIG_USB_UHCI $CONFIG_USB
#fi
#if [ "$CONFIG_USB_UHCI" != "y" ]; then
# dep_tristate ' UHCI Alternate Driver (JE) support' CONFIG_USB_UHCI_ALT $CONFIG_USB
#else
# define_bool CONFIG_USB_UHCI_ALT n
#fi
#dep_tristate ' OHCI (Compaq, iMacs, OPTi, SiS, ALi, ...) support' CONFIG_USB_OHCI $CONFIG_USB
......@@ -964,15 +964,6 @@ static int itd_submit (struct ehci_hcd *ehci, struct urb *urb, int mem_flags)
if (urb->iso_frame_desc [0].offset != 0)
return -EINVAL;
/*
* NOTE doing this for now, anticipating periodic URB models
* get updated to be "explicit resubmit".
*/
if (urb->next) {
dbg ("use explicit resubmit for ISO");
return -EINVAL;
}
/* allocate ITDs w/o locking anything */
status = itd_urb_transaction (ehci, urb, mem_flags);
if (status < 0)
......
......@@ -106,8 +106,6 @@ static void wakeup_hc(struct uhci *uhci);
/* to make sure it doesn't hog all of the bandwidth */
#define DEPTH_INTERVAL 5
#define MAX_URB_LOOP 2048 /* Maximum number of linked URB's */
/*
* Technically, updating td->status here is a race, but it's not really a
* problem. The worst that can happen is that we set the IOC bit again
......@@ -2296,8 +2294,7 @@ static void uhci_call_completion(struct urb *urb)
struct urb_priv *urbp;
struct usb_device *dev = urb->dev;
struct uhci *uhci = (struct uhci *)dev->bus->hcpriv;
int is_ring = 0, killed, resubmit_interrupt, status;
struct urb *nurb;
int killed, resubmit_interrupt, status;
unsigned long flags;
spin_lock_irqsave(&urb->lock, flags);
......@@ -2313,29 +2310,6 @@ static void uhci_call_completion(struct urb *urb)
resubmit_interrupt = (usb_pipetype(urb->pipe) == PIPE_INTERRUPT &&
urb->interval);
nurb = urb->next;
if (nurb && !killed) {
int count = 0;
while (nurb && nurb != urb && count < MAX_URB_LOOP) {
if (nurb->status == -ENOENT ||
nurb->status == -ECONNABORTED ||
nurb->status == -ECONNRESET) {
killed = 1;
break;
}
nurb = nurb->next;
count++;
}
if (count == MAX_URB_LOOP)
err("uhci_call_completion: too many linked URB's, loop? (first loop)");
/* Check to see if chain is a ring */
is_ring = (nurb == urb);
}
if (urbp->transfer_buffer_dma_handle)
pci_dma_sync_single(uhci->dev, urbp->transfer_buffer_dma_handle,
urb->transfer_buffer_length, usb_pipein(urb->pipe) ?
......@@ -2370,15 +2344,10 @@ static void uhci_call_completion(struct urb *urb)
urb->dev = dev;
uhci_reset_interrupt(urb);
} else {
if (is_ring && !killed) {
urb->dev = dev;
uhci_submit_urb(urb, GFP_ATOMIC);
} else {
/* We decrement the usage count after we're done */
/* with everything */
usb_put_dev(dev);
usb_put_urb(urb);
}
/* We decrement the usage count after we're done */
/* with everything */
usb_put_dev(dev);
usb_put_urb(urb);
}
}
......
......@@ -100,9 +100,6 @@
// NO serviceable parts below!
/*--------------------------------------------------------------------------*/
// How much URBs with ->next are walked
#define MAX_NEXT_COUNT 2048
static struct uhci *devs = NULL;
/* used by userspace UHCI data structure dumper */
......
......@@ -1215,10 +1215,9 @@ static int process_iso (struct uhci_hcd *uhci, struct urb *urb, int mode)
// called with urb_list_lock set
static int process_urb (struct uhci_hcd *uhci, struct list_head *p)
{
struct urb *urb, *urbt;
struct usb_device *usb_dev;
struct urb *urb;
urb_priv_t *priv;
int type, n, ret = 0;
int type, ret = 0;
priv=list_entry (p, urb_priv_t, urb_list);
urb=priv->urb;
......@@ -1251,40 +1250,11 @@ static int process_urb (struct uhci_hcd *uhci, struct list_head *p)
uhci_free_priv(uhci, urb, urb->hcpriv);
if (type != PIPE_INTERRUPT) { // process_interrupt does completion on its own
// FIXME: How to detect killed URBs in a ring?
if (type == PIPE_ISOCHRONOUS) {
for (n=0, urbt = urb->next; urbt && (urbt != urb) && (n<MAX_NEXT_COUNT); urbt = urbt->next, n++)
continue;
if (urbt && (n<MAX_NEXT_COUNT)) {
usb_dev=urb->dev;
urb->dev = NULL;
spin_unlock(&uhci->urb_list_lock);
if (urb->complete)
urb->complete (urb);
urb->dev=usb_dev;
uhci_urb_enqueue(&uhci->hcd, urb, GFP_ATOMIC); // FIXME memflags!
spin_lock(&uhci->urb_list_lock);
}
else {
spin_unlock(&uhci->urb_list_lock);
dbg("giveback iso urb %p, status %i, length %i\n",
urb, urb->status, urb->transfer_buffer_length);
usb_hcd_giveback_urb(&uhci->hcd, urb);
spin_lock(&uhci->urb_list_lock);
}
}
else {
spin_unlock(&uhci->urb_list_lock);
dbg("giveback urb %p, status %i, length %i\n",
urb, urb->status, urb->transfer_buffer_length);
usb_hcd_giveback_urb(&uhci->hcd, urb);
spin_lock(&uhci->urb_list_lock);
}
spin_unlock(&uhci->urb_list_lock);
dbg("giveback urb %p, status %i, length %i\n",
urb, urb->status, urb->transfer_buffer_length);
usb_hcd_giveback_urb(&uhci->hcd, urb);
spin_lock(&uhci->urb_list_lock);
}
}
return ret;
......
......@@ -125,9 +125,6 @@ _static int process_transfer (uhci_t *s, struct urb *urb, int mode);
_static int process_interrupt (uhci_t *s, struct urb *urb);
_static int process_iso (uhci_t *s, struct urb *urb, int force);
// How much URBs with ->next are walked
#define MAX_NEXT_COUNT 2048
static uhci_t *devs = NULL;
/* used by userspace UHCI data structure dumper */
......@@ -2662,78 +2659,12 @@ _static int process_urb (uhci_t *s, struct list_head *p)
#endif
if ((usb_pipetype (urb->pipe) != PIPE_INTERRUPT)) { // process_interrupt does completion on its own
struct urb *next_urb = urb->next;
int is_ring = 0;
int contains_killed = 0;
int loop_count=0;
if (next_urb) {
// Find out if the URBs are linked to a ring
while (next_urb != NULL && next_urb != urb && loop_count < MAX_NEXT_COUNT) {
if (next_urb->status == -ENOENT) {// killed URBs break ring structure & resubmission
contains_killed = 1;
break;
}
next_urb = next_urb->next;
loop_count++;
}
if (loop_count == MAX_NEXT_COUNT)
err("process_urb: Too much linked URBs in ring detection!");
if (next_urb == urb)
is_ring=1;
}
// Submit idle/non-killed URBs linked with urb->next
// Stop before the current URB
next_urb = urb->next;
if (next_urb && !contains_killed) {
int ret_submit;
next_urb = urb->next;
loop_count=0;
while (next_urb != NULL && next_urb != urb && loop_count < MAX_NEXT_COUNT) {
if (next_urb->status != -EINPROGRESS) {
if (next_urb->status == -ENOENT)
break;
spin_unlock(&s->urb_list_lock);
// FIXME!!!
// We need to know the real state, so
// GFP_ATOMIC is probably not correct
ret_submit=uhci_submit_urb(next_urb, GFP_ATOMIC);
spin_lock(&s->urb_list_lock);
if (ret_submit)
break;
}
loop_count++;
next_urb = next_urb->next;
}
if (loop_count == MAX_NEXT_COUNT)
err("process_urb: Too much linked URBs in resubmission!");
}
// Completion
if (urb->complete) {
int was_unlinked = (urb->status == -ENOENT);
urb->dev = NULL;
spin_unlock(&s->urb_list_lock);
urb->complete ((struct urb *) urb);
// Re-submit the URB if ring-linked
if (is_ring && !was_unlinked && !contains_killed) {
urb->dev=usb_dev;
// FIXME!!!
// We need to know the real state, so
// GFP_ATOMIC is probably not correct
uhci_submit_urb (urb, GFP_ATOMIC);
}
spin_lock(&s->urb_list_lock);
}
......
......@@ -300,6 +300,8 @@
* Frank Zago <fzago@greshamstorage.com> and
* Oliver Neukum <520047054719-0001@t-online.de> for reviewing/testing.
*
* 05/21/02 Currently maintained by Brian Beattie <beattie@beattie-home.net>
*
* TODO
* - Performance
* - Select/poll methods
......
......@@ -19,6 +19,9 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* 05/21/02 Currently maintained by Brian Beattie <beattie@beattie-home.net>
*
*
*/
#include <linux/module.h>
......
......@@ -632,7 +632,6 @@ static int se401_stop_stream(struct usb_se401 *se401)
se401_sndctrl(1, se401, SE401_REQ_CAMERA_POWER, 0, NULL, 0);
for (i=0; i<SE401_NUMSBUF; i++) if (se401->urb[i]) {
se401->urb[i]->next=NULL;
usb_unlink_urb(se401->urb[i]);
usb_free_urb(se401->urb[i]);
se401->urb[i]=NULL;
......@@ -1506,7 +1505,6 @@ static inline void usb_se401_remove_disconnected (struct usb_se401 *se401)
wake_up_interruptible(&se401->wq);
for (i=0; i<SE401_NUMSBUF; i++) if (se401->urb[i]) {
se401->urb[i]->next = NULL;
usb_unlink_urb(se401->urb[i]);
usb_free_urb(se401->urb[i]);
se401->urb[i] = NULL;
......
......@@ -799,7 +799,6 @@ static int stv680_stop_stream (struct usb_stv *stv680)
for (i = 0; i < STV680_NUMSBUF; i++)
if (stv680->urb[i]) {
stv680->urb[i]->next = NULL;
usb_unlink_urb (stv680->urb[i]);
usb_free_urb (stv680->urb[i]);
stv680->urb[i] = NULL;
......@@ -1516,7 +1515,6 @@ static inline void usb_stv680_remove_disconnected (struct usb_stv *stv680)
for (i = 0; i < STV680_NUMSBUF; i++)
if (stv680->urb[i]) {
stv680->urb[i]->next = NULL;
usb_unlink_urb (stv680->urb[i]);
usb_free_urb (stv680->urb[i]);
stv680->urb[i] = NULL;
......
......@@ -767,7 +767,6 @@ typedef void (*usb_complete_t)(struct urb *);
/**
* struct urb - USB Request Block
* @urb_list: For use by current owner of the URB.
* @next: Used to link ISO requests into rings.
* @pipe: Holds endpoint number, direction, type, and max packet size.
* Create these values with the eight macros available;
* usb_{snd,rcv}TYPEpipe(dev,endpoint), where the type is "ctrl"
......@@ -827,7 +826,7 @@ typedef void (*usb_complete_t)(struct urb *);
*
* Initialization:
*
* All URBs submitted must initialize dev, pipe, next (may be null),
* All URBs submitted must initialize dev, pipe,
* transfer_flags (may be zero), complete, timeout (may be zero).
* The USB_ASYNC_UNLINK transfer flag affects later invocations of
* the usb_unlink_urb() routine.
......@@ -873,7 +872,9 @@ typedef void (*usb_complete_t)(struct urb *);
* the quality of service is only "best effort". Callers provide specially
* allocated URBs, with number_of_packets worth of iso_frame_desc structures
* at the end. Each such packet is an individual ISO transfer. Isochronous
* URBs are normally submitted with urb->next fields set up as a ring, so
* URBs are normally queued (no flag like USB_BULK_QUEUE is needed) so that
* transfers are at least double buffered, and then explicitly resubmitted
* in completion handlers, so
* that data (such as audio or video) streams at as constant a rate as the
* host controller scheduler can support.
*
......@@ -891,14 +892,15 @@ typedef void (*usb_complete_t)(struct urb *);
* When completion callback is invoked for non-isochronous URBs, the
* actual_length field tells how many bytes were transferred.
*
* For interrupt and isochronous URBs, the URB provided to the callback
* For interrupt URBs, the URB provided to the callback
* function is still "owned" by the USB core subsystem unless the status
* indicates that the URB has been unlinked. Completion handlers should
* not modify such URBs until they have been unlinked.
*
* ISO transfer status is reported in the status and actual_length fields
* of the iso_frame_desc array, and the number of errors is reported in
* error_count.
* error_count. Completion callbacks for ISO transfers will normally
* (re)submit URBs to ensure a constant transfer rate.
*/
struct urb
{
......@@ -906,7 +908,6 @@ struct urb
atomic_t count; /* reference count of the URB */
void *hcpriv; /* private data for host controller */
struct list_head urb_list; /* list pointer to all active urbs */
struct urb *next; /* (in) pointer to next URB */
struct usb_device *dev; /* (in) pointer to associated device */
unsigned int pipe; /* (in) pipe information */
int status; /* (return) non-ISO status */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment