Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

staging: line6: eliminate useless index_out variable

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>

authored by

Stefan Hajnoczi and committed by
Greg Kroah-Hartman
153e3876 2f637ee4

+1 -9
-5
drivers/staging/line6/pcm.h
··· 146 146 unsigned char *buffer_in; 147 147 148 148 /** 149 - Temporary buffer index for playback. 150 - */ 151 - int index_out; 152 - 153 - /** 154 149 Previously captured frame (for software monitoring). 155 150 */ 156 151 unsigned char *prev_fbuf;
+1 -4
drivers/staging/line6/playback.c
··· 192 192 urb_frames = urb_size / bytes_per_frame; 193 193 urb_out->transfer_buffer = 194 194 line6pcm->buffer_out + 195 - LINE6_ISO_PACKETS * line6pcm->max_packet_size * line6pcm->index_out; 195 + index * LINE6_ISO_PACKETS * line6pcm->max_packet_size; 196 196 urb_out->transfer_buffer_length = urb_size; 197 197 urb_out->context = line6pcm; 198 - 199 - if (++line6pcm->index_out == LINE6_ISO_BUFFERS) 200 - line6pcm->index_out = 0; 201 198 202 199 if (test_bit(BIT_PCM_ALSA_PLAYBACK, &line6pcm->flags) && 203 200 !test_bit(BIT_PAUSE_PLAYBACK, &line6pcm->flags)) {