From: Chris Rorvick <chris@rorvick.com>
To: Takashi Iwai <tiwai@suse.de>
Cc: Chris Rorvick <chris@rorvick.com>,
alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org,
Stefan Hajnoczi <stefanha@gmail.com>
Subject: [PATCH v2 1/3] ALSA: line6: Add toneport_has_source_select()
Date: Sat, 7 Feb 2015 10:43:17 -0600 [thread overview]
Message-ID: <1423327399-12619-2-git-send-email-chris@rorvick.com> (raw)
In-Reply-To: <1423327399-12619-1-git-send-email-chris@rorvick.com>
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>
---
sound/usb/line6/toneport.c | 32 ++++++++++++++++----------------
1 file changed, 16 insertions(+), 16 deletions(-)
diff --git a/sound/usb/line6/toneport.c b/sound/usb/line6/toneport.c
index b107cf4..6dd6d4f 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)
}
}
+static bool toneport_has_source_select(struct usb_line6_toneport *toneport)
+{
+ switch (toneport->type) {
+ case LINE6_TONEPORT_UX1:
+ case LINE6_TONEPORT_UX2:
+ case LINE6_PODSTUDIO_UX1:
+ case LINE6_PODSTUDIO_UX2:
+ return true;
+
+ default:
+ return false;
+ }
+}
+
/*
Setup Toneport device.
*/
@@ -360,17 +374,10 @@ static void toneport_setup(struct usb_line6_toneport *toneport)
toneport_send_cmd(usbdev, 0x0301, 0x0000);
/* initialize source select: */
- switch (toneport->type) {
- case LINE6_TONEPORT_UX1:
- case LINE6_TONEPORT_UX2:
- case LINE6_PODSTUDIO_UX1:
- case LINE6_PODSTUDIO_UX2:
+ if (toneport_has_source_select(toneport))
toneport_send_cmd(usbdev,
toneport_source_info[toneport->source].code,
0x0000);
- default:
- break;
- }
if (toneport_has_led(toneport->type))
toneport_update_led(toneport);
@@ -421,20 +428,13 @@ static int toneport_init(struct usb_line6 *line6,
return err;
/* register source select control: */
- switch (toneport->type) {
- case LINE6_TONEPORT_UX1:
- case LINE6_TONEPORT_UX2:
- case LINE6_PODSTUDIO_UX1:
- case LINE6_PODSTUDIO_UX2:
+ if (toneport_has_source_select(toneport)) {
err =
snd_ctl_add(line6->card,
snd_ctl_new1(&toneport_control_source,
line6->line6pcm));
if (err < 0)
return err;
-
- default:
- break;
}
line6_read_serial_number(line6, &toneport->serial_number);
--
2.1.0
next prev parent reply other threads:[~2015-02-07 16:44 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-07 16:43 [PATCH v2 0/3] More Line 6 cleanup Chris Rorvick
2015-02-07 16:43 ` Chris Rorvick [this message]
2015-02-07 16:43 ` [PATCH v2 2/3] ALSA: line6: Pass toneport pointer to toneport_has_led() Chris Rorvick
2015-02-07 16:43 ` [PATCH v2 3/3] ALSA: line6: Pass driver name to line6_probe() Chris Rorvick
2015-02-08 8:08 ` [PATCH v2 0/3] More Line 6 cleanup Takashi Iwai
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1423327399-12619-2-git-send-email-chris@rorvick.com \
--to=chris@rorvick.com \
--cc=alsa-devel@alsa-project.org \
--cc=linux-kernel@vger.kernel.org \
--cc=stefanha@gmail.com \
--cc=tiwai@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®