diff options
author | Takashi Iwai <tiwai@suse.de> | 2015-01-23 09:08:40 -0500 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2015-01-28 01:21:06 -0500 |
commit | 9fb754b79e536eb35d69a4678687addff589e45b (patch) | |
tree | 5cbe5201e93281325d61c9899759b72a3275ff52 /sound/usb | |
parent | f2a76225b962f00642002fb109aee2e5b0dc4259 (diff) |
ALSA: line6: Use incremental loop
Using a decremental loop without particular reasons worsens the
readability a lot. Use incremental loops instead.
Tested-by: Chris Rorvick <chris@rorvick.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/usb')
-rw-r--r-- | sound/usb/line6/capture.c | 4 | ||||
-rw-r--r-- | sound/usb/line6/pcm.c | 6 | ||||
-rw-r--r-- | sound/usb/line6/playback.c | 12 |
3 files changed, 11 insertions, 11 deletions
diff --git a/sound/usb/line6/capture.c b/sound/usb/line6/capture.c index 5a010ba163fa..97283e631e45 100644 --- a/sound/usb/line6/capture.c +++ b/sound/usb/line6/capture.c | |||
@@ -91,7 +91,7 @@ void line6_unlink_audio_in_urbs(struct snd_line6_pcm *line6pcm) | |||
91 | { | 91 | { |
92 | unsigned int i; | 92 | unsigned int i; |
93 | 93 | ||
94 | for (i = LINE6_ISO_BUFFERS; i--;) { | 94 | for (i = 0; i < LINE6_ISO_BUFFERS; i++) { |
95 | if (test_bit(i, &line6pcm->active_urb_in)) { | 95 | if (test_bit(i, &line6pcm->active_urb_in)) { |
96 | if (!test_and_set_bit(i, &line6pcm->unlink_urb_in)) { | 96 | if (!test_and_set_bit(i, &line6pcm->unlink_urb_in)) { |
97 | struct urb *u = line6pcm->urb_audio_in[i]; | 97 | struct urb *u = line6pcm->urb_audio_in[i]; |
@@ -114,7 +114,7 @@ void line6_wait_clear_audio_in_urbs(struct snd_line6_pcm *line6pcm) | |||
114 | 114 | ||
115 | do { | 115 | do { |
116 | alive = 0; | 116 | alive = 0; |
117 | for (i = LINE6_ISO_BUFFERS; i--;) { | 117 | for (i = 0; i < LINE6_ISO_BUFFERS; i++) { |
118 | if (test_bit(i, &line6pcm->active_urb_in)) | 118 | if (test_bit(i, &line6pcm->active_urb_in)) |
119 | alive++; | 119 | alive++; |
120 | } | 120 | } |
diff --git a/sound/usb/line6/pcm.c b/sound/usb/line6/pcm.c index adbcac46b785..43474c4ebb6b 100644 --- a/sound/usb/line6/pcm.c +++ b/sound/usb/line6/pcm.c | |||
@@ -273,7 +273,7 @@ static int snd_line6_control_playback_get(struct snd_kcontrol *kcontrol, | |||
273 | int i; | 273 | int i; |
274 | struct snd_line6_pcm *line6pcm = snd_kcontrol_chip(kcontrol); | 274 | struct snd_line6_pcm *line6pcm = snd_kcontrol_chip(kcontrol); |
275 | 275 | ||
276 | for (i = 2; i--;) | 276 | for (i = 0; i < 2; i++) |
277 | ucontrol->value.integer.value[i] = line6pcm->volume_playback[i]; | 277 | ucontrol->value.integer.value[i] = line6pcm->volume_playback[i]; |
278 | 278 | ||
279 | return 0; | 279 | return 0; |
@@ -286,7 +286,7 @@ static int snd_line6_control_playback_put(struct snd_kcontrol *kcontrol, | |||
286 | int i, changed = 0; | 286 | int i, changed = 0; |
287 | struct snd_line6_pcm *line6pcm = snd_kcontrol_chip(kcontrol); | 287 | struct snd_line6_pcm *line6pcm = snd_kcontrol_chip(kcontrol); |
288 | 288 | ||
289 | for (i = 2; i--;) | 289 | for (i = 0; i < 2; i++) |
290 | if (line6pcm->volume_playback[i] != | 290 | if (line6pcm->volume_playback[i] != |
291 | ucontrol->value.integer.value[i]) { | 291 | ucontrol->value.integer.value[i]) { |
292 | line6pcm->volume_playback[i] = | 292 | line6pcm->volume_playback[i] = |
@@ -330,7 +330,7 @@ static void line6_cleanup_pcm(struct snd_pcm *pcm) | |||
330 | int i; | 330 | int i; |
331 | struct snd_line6_pcm *line6pcm = snd_pcm_chip(pcm); | 331 | struct snd_line6_pcm *line6pcm = snd_pcm_chip(pcm); |
332 | 332 | ||
333 | for (i = LINE6_ISO_BUFFERS; i--;) { | 333 | for (i = 0; i < LINE6_ISO_BUFFERS; i++) { |
334 | if (line6pcm->urb_audio_out[i]) { | 334 | if (line6pcm->urb_audio_out[i]) { |
335 | usb_kill_urb(line6pcm->urb_audio_out[i]); | 335 | usb_kill_urb(line6pcm->urb_audio_out[i]); |
336 | usb_free_urb(line6pcm->urb_audio_out[i]); | 336 | usb_free_urb(line6pcm->urb_audio_out[i]); |
diff --git a/sound/usb/line6/playback.c b/sound/usb/line6/playback.c index 1c9f95a370ff..ab9a83f0f864 100644 --- a/sound/usb/line6/playback.c +++ b/sound/usb/line6/playback.c | |||
@@ -297,7 +297,7 @@ void line6_unlink_audio_out_urbs(struct snd_line6_pcm *line6pcm) | |||
297 | { | 297 | { |
298 | unsigned int i; | 298 | unsigned int i; |
299 | 299 | ||
300 | for (i = LINE6_ISO_BUFFERS; i--;) { | 300 | for (i = 0; i < LINE6_ISO_BUFFERS; i++) { |
301 | if (test_bit(i, &line6pcm->active_urb_out)) { | 301 | if (test_bit(i, &line6pcm->active_urb_out)) { |
302 | if (!test_and_set_bit(i, &line6pcm->unlink_urb_out)) { | 302 | if (!test_and_set_bit(i, &line6pcm->unlink_urb_out)) { |
303 | struct urb *u = line6pcm->urb_audio_out[i]; | 303 | struct urb *u = line6pcm->urb_audio_out[i]; |
@@ -320,7 +320,7 @@ void line6_wait_clear_audio_out_urbs(struct snd_line6_pcm *line6pcm) | |||
320 | 320 | ||
321 | do { | 321 | do { |
322 | alive = 0; | 322 | alive = 0; |
323 | for (i = LINE6_ISO_BUFFERS; i--;) { | 323 | for (i = 0; i < LINE6_ISO_BUFFERS; i++) { |
324 | if (test_bit(i, &line6pcm->active_urb_out)) | 324 | if (test_bit(i, &line6pcm->active_urb_out)) |
325 | alive++; | 325 | alive++; |
326 | } | 326 | } |
@@ -366,14 +366,14 @@ static void audio_out_callback(struct urb *urb) | |||
366 | line6pcm->last_frame_out = urb->start_frame; | 366 | line6pcm->last_frame_out = urb->start_frame; |
367 | 367 | ||
368 | /* find index of URB */ | 368 | /* find index of URB */ |
369 | for (index = LINE6_ISO_BUFFERS; index--;) | 369 | for (index = 0; index < LINE6_ISO_BUFFERS; index++) |
370 | if (urb == line6pcm->urb_audio_out[index]) | 370 | if (urb == line6pcm->urb_audio_out[index]) |
371 | break; | 371 | break; |
372 | 372 | ||
373 | if (index < 0) | 373 | if (index >= LINE6_ISO_BUFFERS) |
374 | return; /* URB has been unlinked asynchronously */ | 374 | return; /* URB has been unlinked asynchronously */ |
375 | 375 | ||
376 | for (i = LINE6_ISO_PACKETS; i--;) | 376 | for (i = 0; i < LINE6_ISO_PACKETS; i++) |
377 | length += urb->iso_frame_desc[i].length; | 377 | length += urb->iso_frame_desc[i].length; |
378 | 378 | ||
379 | spin_lock_irqsave(&line6pcm->lock_audio_out, flags); | 379 | spin_lock_irqsave(&line6pcm->lock_audio_out, flags); |
@@ -390,7 +390,7 @@ static void audio_out_callback(struct urb *urb) | |||
390 | 390 | ||
391 | clear_bit(index, &line6pcm->active_urb_out); | 391 | clear_bit(index, &line6pcm->active_urb_out); |
392 | 392 | ||
393 | for (i = LINE6_ISO_PACKETS; i--;) | 393 | for (i = 0; i < LINE6_ISO_PACKETS; i++) |
394 | if (urb->iso_frame_desc[i].status == -EXDEV) { | 394 | if (urb->iso_frame_desc[i].status == -EXDEV) { |
395 | shutdown = 1; | 395 | shutdown = 1; |
396 | break; | 396 | break; |