diff options
author | Chris Rorvick <chris@rorvick.com> | 2015-02-07 11:43:18 -0500 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2015-02-08 03:06:08 -0500 |
commit | f2bd242fa114df07ab8ed0d2f445a9a313e3aaa1 (patch) | |
tree | a62e742f7e13a6ad8df987b55095a2b8e6ffab3d | |
parent | 89444601e5878042812e33da0c17807197c2669c (diff) |
ALSA: line6: Pass toneport pointer to toneport_has_led()
It is unlikely this function would ever be used in a context without a
pointer to a `struct usb_line6_toneport', so grab the device type from
it rather than having the caller do it.
Signed-off-by: Chris Rorvick <chris@rorvick.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r-- | sound/usb/line6/toneport.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/sound/usb/line6/toneport.c b/sound/usb/line6/toneport.c index 6dd6d4f41310..2420d2fc8aa2 100644 --- a/sound/usb/line6/toneport.c +++ b/sound/usb/line6/toneport.c | |||
@@ -278,12 +278,17 @@ static struct snd_kcontrol_new toneport_control_source = { | |||
278 | (void cmd_0x02(byte red, byte green) | 278 | (void cmd_0x02(byte red, byte green) |
279 | */ | 279 | */ |
280 | 280 | ||
281 | static bool toneport_has_led(enum line6_device_type type) | 281 | static bool toneport_has_led(struct usb_line6_toneport *toneport) |
282 | { | 282 | { |
283 | return | 283 | switch (toneport->type) { |
284 | (type == LINE6_GUITARPORT) || | 284 | case LINE6_GUITARPORT: |
285 | (type == LINE6_TONEPORT_GX); | 285 | case LINE6_TONEPORT_GX: |
286 | /* add your device here if you are missing support for the LEDs */ | 286 | /* add your device here if you are missing support for the LEDs */ |
287 | return true; | ||
288 | |||
289 | default: | ||
290 | return false; | ||
291 | } | ||
287 | } | 292 | } |
288 | 293 | ||
289 | static const char * const led_colors[2] = { "red", "green" }; | 294 | static const char * const led_colors[2] = { "red", "green" }; |
@@ -379,7 +384,7 @@ static void toneport_setup(struct usb_line6_toneport *toneport) | |||
379 | toneport_source_info[toneport->source].code, | 384 | toneport_source_info[toneport->source].code, |
380 | 0x0000); | 385 | 0x0000); |
381 | 386 | ||
382 | if (toneport_has_led(toneport->type)) | 387 | if (toneport_has_led(toneport)) |
383 | toneport_update_led(toneport); | 388 | toneport_update_led(toneport); |
384 | 389 | ||
385 | mod_timer(&toneport->timer, jiffies + TONEPORT_PCM_DELAY * HZ); | 390 | mod_timer(&toneport->timer, jiffies + TONEPORT_PCM_DELAY * HZ); |
@@ -395,7 +400,7 @@ static void line6_toneport_disconnect(struct usb_line6 *line6) | |||
395 | 400 | ||
396 | del_timer_sync(&toneport->timer); | 401 | del_timer_sync(&toneport->timer); |
397 | 402 | ||
398 | if (toneport_has_led(toneport->type)) | 403 | if (toneport_has_led(toneport)) |
399 | toneport_remove_leds(toneport); | 404 | toneport_remove_leds(toneport); |
400 | } | 405 | } |
401 | 406 | ||
@@ -440,7 +445,7 @@ static int toneport_init(struct usb_line6 *line6, | |||
440 | line6_read_serial_number(line6, &toneport->serial_number); | 445 | line6_read_serial_number(line6, &toneport->serial_number); |
441 | line6_read_data(line6, 0x80c2, &toneport->firmware_version, 1); | 446 | line6_read_data(line6, 0x80c2, &toneport->firmware_version, 1); |
442 | 447 | ||
443 | if (toneport_has_led(toneport->type)) { | 448 | if (toneport_has_led(toneport)) { |
444 | err = toneport_init_leds(toneport); | 449 | err = toneport_init_leds(toneport); |
445 | if (err < 0) | 450 | if (err < 0) |
446 | return err; | 451 | return err; |