aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Rorvick <chris@rorvick.com>2015-02-07 11:43:17 -0500
committerTakashi Iwai <tiwai@suse.de>2015-02-08 03:05:56 -0500
commit89444601e5878042812e33da0c17807197c2669c (patch)
tree97d4b8730a2c8fffc3f747b815694810c61ce1de
parent9b6ff3fb9644b962b39816c571e38ddc1412fea0 (diff)
ALSA: line6: Add toneport_has_source_select()
Add a predicate for testing if the device supports source selection to make the conditional logic around this a bit cleaner. Signed-off-by: Chris Rorvick <chris@rorvick.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r--sound/usb/line6/toneport.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/sound/usb/line6/toneport.c b/sound/usb/line6/toneport.c
index b107cf481819..6dd6d4f41310 100644
--- a/sound/usb/line6/toneport.c
+++ b/sound/usb/line6/toneport.c
@@ -343,6 +343,20 @@ static void toneport_remove_leds(struct usb_line6_toneport *toneport)
343 } 343 }
344} 344}
345 345
346static bool toneport_has_source_select(struct usb_line6_toneport *toneport)
347{
348 switch (toneport->type) {
349 case LINE6_TONEPORT_UX1:
350 case LINE6_TONEPORT_UX2:
351 case LINE6_PODSTUDIO_UX1:
352 case LINE6_PODSTUDIO_UX2:
353 return true;
354
355 default:
356 return false;
357 }
358}
359
346/* 360/*
347 Setup Toneport device. 361 Setup Toneport device.
348*/ 362*/
@@ -360,17 +374,10 @@ static void toneport_setup(struct usb_line6_toneport *toneport)
360 toneport_send_cmd(usbdev, 0x0301, 0x0000); 374 toneport_send_cmd(usbdev, 0x0301, 0x0000);
361 375
362 /* initialize source select: */ 376 /* initialize source select: */
363 switch (toneport->type) { 377 if (toneport_has_source_select(toneport))
364 case LINE6_TONEPORT_UX1:
365 case LINE6_TONEPORT_UX2:
366 case LINE6_PODSTUDIO_UX1:
367 case LINE6_PODSTUDIO_UX2:
368 toneport_send_cmd(usbdev, 378 toneport_send_cmd(usbdev,
369 toneport_source_info[toneport->source].code, 379 toneport_source_info[toneport->source].code,
370 0x0000); 380 0x0000);
371 default:
372 break;
373 }
374 381
375 if (toneport_has_led(toneport->type)) 382 if (toneport_has_led(toneport->type))
376 toneport_update_led(toneport); 383 toneport_update_led(toneport);
@@ -421,20 +428,13 @@ static int toneport_init(struct usb_line6 *line6,
421 return err; 428 return err;
422 429
423 /* register source select control: */ 430 /* register source select control: */
424 switch (toneport->type) { 431 if (toneport_has_source_select(toneport)) {
425 case LINE6_TONEPORT_UX1:
426 case LINE6_TONEPORT_UX2:
427 case LINE6_PODSTUDIO_UX1:
428 case LINE6_PODSTUDIO_UX2:
429 err = 432 err =
430 snd_ctl_add(line6->card, 433 snd_ctl_add(line6->card,
431 snd_ctl_new1(&toneport_control_source, 434 snd_ctl_new1(&toneport_control_source,
432 line6->line6pcm)); 435 line6->line6pcm));
433 if (err < 0) 436 if (err < 0)
434 return err; 437 return err;
435
436 default:
437 break;
438 } 438 }
439 439
440 line6_read_serial_number(line6, &toneport->serial_number); 440 line6_read_serial_number(line6, &toneport->serial_number);