[ALSA] Repair snd-usb-usx2y for usb 2.6.18
authorKarsten Wiese <annabellesgarden@yahoo.de>
Wed, 4 Oct 2006 15:17:32 +0000 (17:17 +0200)
committerJaroslav Kysela <perex@suse.cz>
Fri, 6 Oct 2006 18:23:02 +0000 (20:23 +0200)
urb->start_frame rolls over beyond MAX_INT now.
This is for stable kernel and stable alsa.

Signed-off-by: Karsten Wiese <annabellesgarden@yahoo.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
sound/usb/usx2y/usbusx2yaudio.c
sound/usb/usx2y/usx2yhwdeppcm.c

index e662281a751aa726da42140264965c88cea03c7a..367f8a32a6657ed66324b69280b760d47d90c288 100644 (file)
@@ -322,7 +322,7 @@ static void i_usX2Y_urb_complete(struct urb *urb)
                usX2Y_error_urb_status(usX2Y, subs, urb);
                return;
        }
-       if (likely((0xFFFF & urb->start_frame) == usX2Y->wait_iso_frame))
+       if (likely(urb->start_frame == usX2Y->wait_iso_frame))
                subs->completed_urb = urb;
        else {
                usX2Y_error_sequence(usX2Y, subs, urb);
@@ -335,13 +335,9 @@ static void i_usX2Y_urb_complete(struct urb *urb)
                    atomic_read(&capsubs->state) >= state_PREPARED &&
                    (playbacksubs->completed_urb ||
                     atomic_read(&playbacksubs->state) < state_PREPARED)) {
-                       if (!usX2Y_usbframe_complete(capsubs, playbacksubs, urb->start_frame)) {
-                               if (nr_of_packs() <= urb->start_frame &&
-                                   urb->start_frame <= (2 * nr_of_packs() - 1))        // uhci and ohci
-                                       usX2Y->wait_iso_frame = urb->start_frame - nr_of_packs();
-                               else
-                                       usX2Y->wait_iso_frame +=  nr_of_packs();
-                       } else {
+                       if (!usX2Y_usbframe_complete(capsubs, playbacksubs, urb->start_frame))
+                               usX2Y->wait_iso_frame += nr_of_packs();
+                       else {
                                snd_printdd("\n");
                                usX2Y_clients_stop(usX2Y);
                        }
@@ -495,7 +491,6 @@ static int usX2Y_urbs_start(struct snd_usX2Y_substream *subs)
                if (subs != NULL && atomic_read(&subs->state) >= state_PREPARED)
                        goto start;
        }
-       usX2Y->wait_iso_frame = -1;
 
  start:
        usX2Y_subs_startup(subs);
@@ -516,10 +511,9 @@ static int usX2Y_urbs_start(struct snd_usX2Y_substream *subs)
                                snd_printk (KERN_ERR "cannot submit datapipe for urb %d, err = %d\n", i, err);
                                err = -EPIPE;
                                goto cleanup;
-                       } else {
-                               if (0 > usX2Y->wait_iso_frame)
+                       } else
+                               if (i == 0)
                                        usX2Y->wait_iso_frame = urb->start_frame;
-                       }
                        urb->transfer_flags = 0;
                } else {
                        atomic_set(&subs->state, state_STARTING1);
index 20708d2ffb6a35d7046bb725f43c9f1511d89c01..8f3e35e24e72ce5b46771609c2c1dfe694d5c841 100644 (file)
@@ -243,7 +243,7 @@ static void i_usX2Y_usbpcm_urb_complete(struct urb *urb)
                usX2Y_error_urb_status(usX2Y, subs, urb);
                return;
        }
-       if (likely((0xFFFF & urb->start_frame) == usX2Y->wait_iso_frame))
+       if (likely(urb->start_frame == usX2Y->wait_iso_frame))
                subs->completed_urb = urb;
        else {
                usX2Y_error_sequence(usX2Y, subs, urb);
@@ -256,13 +256,9 @@ static void i_usX2Y_usbpcm_urb_complete(struct urb *urb)
        if (capsubs->completed_urb && atomic_read(&capsubs->state) >= state_PREPARED &&
            (NULL == capsubs2 || capsubs2->completed_urb) &&
            (playbacksubs->completed_urb || atomic_read(&playbacksubs->state) < state_PREPARED)) {
-               if (!usX2Y_usbpcm_usbframe_complete(capsubs, capsubs2, playbacksubs, urb->start_frame)) {
-                       if (nr_of_packs() <= urb->start_frame &&
-                           urb->start_frame <= (2 * nr_of_packs() - 1))        // uhci and ohci
-                               usX2Y->wait_iso_frame = urb->start_frame - nr_of_packs();
-                       else
-                               usX2Y->wait_iso_frame +=  nr_of_packs();
-               } else {
+               if (!usX2Y_usbpcm_usbframe_complete(capsubs, capsubs2, playbacksubs, urb->start_frame))
+                       usX2Y->wait_iso_frame += nr_of_packs();
+               else {
                        snd_printdd("\n");
                        usX2Y_clients_stop(usX2Y);
                }
@@ -433,7 +429,6 @@ static int usX2Y_usbpcm_urbs_start(struct snd_usX2Y_substream *subs)
                if (subs != NULL && atomic_read(&subs->state) >= state_PREPARED)
                        goto start;
        }
-       usX2Y->wait_iso_frame = -1;
 
  start:
        usX2Y_usbpcm_subs_startup(subs);
@@ -459,7 +454,7 @@ static int usX2Y_usbpcm_urbs_start(struct snd_usX2Y_substream *subs)
                                                goto cleanup;
                                        }  else {
                                                snd_printdd("%i\n", urb->start_frame);
-                                               if (0 > usX2Y->wait_iso_frame)
+                                               if (u == 0)
                                                        usX2Y->wait_iso_frame = urb->start_frame;
                                        }
                                        urb->transfer_flags = 0;