Skip to content

Commit

Permalink
staging: line6: eliminate useless index_out variable
Browse files Browse the repository at this point in the history
Playback urbs use the index_out counter to decide which part of the
playback buffer to use.  Since the urb already has a unique index in
range [0, LINE6_ISO_BUFFERS) there is no need to keep a separate
counter.

Use the urb index instead.  This also eliminates the possibility of two
urbs using the same playback buffer space if they ever complete
out-of-order for some reason.

Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
Signed-off-by: Markus Grabner <grabner@icg.tugraz.at>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Stefan Hajnoczi authored and Greg Kroah-Hartman committed Dec 10, 2011
1 parent 2f637ee commit 153e387
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 9 deletions.
5 changes: 0 additions & 5 deletions drivers/staging/line6/pcm.h
Original file line number Diff line number Diff line change
Expand Up @@ -145,11 +145,6 @@ struct snd_line6_pcm {
*/
unsigned char *buffer_in;

/**
Temporary buffer index for playback.
*/
int index_out;

/**
Previously captured frame (for software monitoring).
*/
Expand Down
5 changes: 1 addition & 4 deletions drivers/staging/line6/playback.c
Original file line number Diff line number Diff line change
Expand Up @@ -192,13 +192,10 @@ static int submit_audio_out_urb(struct snd_line6_pcm *line6pcm)
urb_frames = urb_size / bytes_per_frame;
urb_out->transfer_buffer =
line6pcm->buffer_out +
LINE6_ISO_PACKETS * line6pcm->max_packet_size * line6pcm->index_out;
index * LINE6_ISO_PACKETS * line6pcm->max_packet_size;
urb_out->transfer_buffer_length = urb_size;
urb_out->context = line6pcm;

if (++line6pcm->index_out == LINE6_ISO_BUFFERS)
line6pcm->index_out = 0;

if (test_bit(BIT_PCM_ALSA_PLAYBACK, &line6pcm->flags) &&
!test_bit(BIT_PAUSE_PLAYBACK, &line6pcm->flags)) {
struct snd_pcm_runtime *runtime =
Expand Down

0 comments on commit 153e387

Please sign in to comment.