Commit 45f08385 authored by Karsten Wiese's avatar Karsten Wiese Committed by Chris Wright

[PATCH] ALSA: Repair snd-usb-usx2y for usb 2.6.18

ALSA: Repair snd-usb-usx2y for usb 2.6.18

urb->start_frame rolls over beyond MAX_INT now.
This is for stable kernel and stable alsa.

From: Karsten Wiese <annabellesgarden@yahoo.de>
Signed-off-by: default avatarKarsten Wiese <annabellesgarden@yahoo.de>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: default avatarChris Wright <chrisw@sous-sol.org>
parent 0e98aebf
...@@ -322,7 +322,7 @@ static void i_usX2Y_urb_complete(struct urb *urb, struct pt_regs *regs) ...@@ -322,7 +322,7 @@ static void i_usX2Y_urb_complete(struct urb *urb, struct pt_regs *regs)
usX2Y_error_urb_status(usX2Y, subs, urb); usX2Y_error_urb_status(usX2Y, subs, urb);
return; return;
} }
if (likely((0xFFFF & urb->start_frame) == usX2Y->wait_iso_frame)) if (likely(urb->start_frame == usX2Y->wait_iso_frame))
subs->completed_urb = urb; subs->completed_urb = urb;
else { else {
usX2Y_error_sequence(usX2Y, subs, urb); usX2Y_error_sequence(usX2Y, subs, urb);
...@@ -335,13 +335,9 @@ static void i_usX2Y_urb_complete(struct urb *urb, struct pt_regs *regs) ...@@ -335,13 +335,9 @@ static void i_usX2Y_urb_complete(struct urb *urb, struct pt_regs *regs)
atomic_read(&capsubs->state) >= state_PREPARED && atomic_read(&capsubs->state) >= state_PREPARED &&
(playbacksubs->completed_urb || (playbacksubs->completed_urb ||
atomic_read(&playbacksubs->state) < state_PREPARED)) { atomic_read(&playbacksubs->state) < state_PREPARED)) {
if (!usX2Y_usbframe_complete(capsubs, playbacksubs, urb->start_frame)) { if (!usX2Y_usbframe_complete(capsubs, playbacksubs, urb->start_frame))
if (nr_of_packs() <= urb->start_frame && usX2Y->wait_iso_frame += nr_of_packs();
urb->start_frame <= (2 * nr_of_packs() - 1)) // uhci and ohci else {
usX2Y->wait_iso_frame = urb->start_frame - nr_of_packs();
else
usX2Y->wait_iso_frame += nr_of_packs();
} else {
snd_printdd("\n"); snd_printdd("\n");
usX2Y_clients_stop(usX2Y); usX2Y_clients_stop(usX2Y);
} }
...@@ -495,7 +491,6 @@ static int usX2Y_urbs_start(struct snd_usX2Y_substream *subs) ...@@ -495,7 +491,6 @@ static int usX2Y_urbs_start(struct snd_usX2Y_substream *subs)
if (subs != NULL && atomic_read(&subs->state) >= state_PREPARED) if (subs != NULL && atomic_read(&subs->state) >= state_PREPARED)
goto start; goto start;
} }
usX2Y->wait_iso_frame = -1;
start: start:
usX2Y_subs_startup(subs); usX2Y_subs_startup(subs);
...@@ -516,10 +511,9 @@ static int usX2Y_urbs_start(struct snd_usX2Y_substream *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); snd_printk (KERN_ERR "cannot submit datapipe for urb %d, err = %d\n", i, err);
err = -EPIPE; err = -EPIPE;
goto cleanup; goto cleanup;
} else { } else
if (0 > usX2Y->wait_iso_frame) if (i == 0)
usX2Y->wait_iso_frame = urb->start_frame; usX2Y->wait_iso_frame = urb->start_frame;
}
urb->transfer_flags = 0; urb->transfer_flags = 0;
} else { } else {
atomic_set(&subs->state, state_STARTING1); atomic_set(&subs->state, state_STARTING1);
......
...@@ -243,7 +243,7 @@ static void i_usX2Y_usbpcm_urb_complete(struct urb *urb, struct pt_regs *regs) ...@@ -243,7 +243,7 @@ static void i_usX2Y_usbpcm_urb_complete(struct urb *urb, struct pt_regs *regs)
usX2Y_error_urb_status(usX2Y, subs, urb); usX2Y_error_urb_status(usX2Y, subs, urb);
return; return;
} }
if (likely((0xFFFF & urb->start_frame) == usX2Y->wait_iso_frame)) if (likely(urb->start_frame == usX2Y->wait_iso_frame))
subs->completed_urb = urb; subs->completed_urb = urb;
else { else {
usX2Y_error_sequence(usX2Y, subs, urb); usX2Y_error_sequence(usX2Y, subs, urb);
...@@ -256,13 +256,9 @@ static void i_usX2Y_usbpcm_urb_complete(struct urb *urb, struct pt_regs *regs) ...@@ -256,13 +256,9 @@ static void i_usX2Y_usbpcm_urb_complete(struct urb *urb, struct pt_regs *regs)
if (capsubs->completed_urb && atomic_read(&capsubs->state) >= state_PREPARED && if (capsubs->completed_urb && atomic_read(&capsubs->state) >= state_PREPARED &&
(NULL == capsubs2 || capsubs2->completed_urb) && (NULL == capsubs2 || capsubs2->completed_urb) &&
(playbacksubs->completed_urb || atomic_read(&playbacksubs->state) < state_PREPARED)) { (playbacksubs->completed_urb || atomic_read(&playbacksubs->state) < state_PREPARED)) {
if (!usX2Y_usbpcm_usbframe_complete(capsubs, capsubs2, playbacksubs, urb->start_frame)) { if (!usX2Y_usbpcm_usbframe_complete(capsubs, capsubs2, playbacksubs, urb->start_frame))
if (nr_of_packs() <= urb->start_frame && usX2Y->wait_iso_frame += nr_of_packs();
urb->start_frame <= (2 * nr_of_packs() - 1)) // uhci and ohci else {
usX2Y->wait_iso_frame = urb->start_frame - nr_of_packs();
else
usX2Y->wait_iso_frame += nr_of_packs();
} else {
snd_printdd("\n"); snd_printdd("\n");
usX2Y_clients_stop(usX2Y); usX2Y_clients_stop(usX2Y);
} }
...@@ -433,7 +429,6 @@ static int usX2Y_usbpcm_urbs_start(struct snd_usX2Y_substream *subs) ...@@ -433,7 +429,6 @@ static int usX2Y_usbpcm_urbs_start(struct snd_usX2Y_substream *subs)
if (subs != NULL && atomic_read(&subs->state) >= state_PREPARED) if (subs != NULL && atomic_read(&subs->state) >= state_PREPARED)
goto start; goto start;
} }
usX2Y->wait_iso_frame = -1;
start: start:
usX2Y_usbpcm_subs_startup(subs); usX2Y_usbpcm_subs_startup(subs);
...@@ -459,7 +454,7 @@ static int usX2Y_usbpcm_urbs_start(struct snd_usX2Y_substream *subs) ...@@ -459,7 +454,7 @@ static int usX2Y_usbpcm_urbs_start(struct snd_usX2Y_substream *subs)
goto cleanup; goto cleanup;
} else { } else {
snd_printdd("%i\n", urb->start_frame); snd_printdd("%i\n", urb->start_frame);
if (0 > usX2Y->wait_iso_frame) if (u == 0)
usX2Y->wait_iso_frame = urb->start_frame; usX2Y->wait_iso_frame = urb->start_frame;
} }
urb->transfer_flags = 0; urb->transfer_flags = 0;
......
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