[alsa-devel] [PATCH 2/4] ALSA: line6: Pass toneport pointer to toneport_has_led()

Takashi Iwai tiwai at suse.de
Fri Feb 6 15:56:27 CET 2015


At Fri,  6 Feb 2015 08:51:10 -0600,
Chris Rorvick wrote:
> 
> 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 at rorvick.com>
> ---
>  sound/usb/line6/toneport.c | 19 ++++++++++++-------
>  1 file changed, 12 insertions(+), 7 deletions(-)
> 
> diff --git a/sound/usb/line6/toneport.c b/sound/usb/line6/toneport.c
> index de56180a..b2c0b2c 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 = {
>  	(void cmd_0x02(byte red, byte green)
>  */
>  
> -static bool toneport_has_led(enum line6_device_type type)
> +static bool toneport_has_led(struct usb_line6_toneport *toneport)
>  {
> -	return
> -	    (type == LINE6_GUITARPORT) ||
> -	    (type == LINE6_TONEPORT_GX);
> +	switch (toneport->type) {
> +	case LINE6_GUITARPORT:
> +	case LINE6_TONEPORT_GX:
>  	/* add your device here if you are missing support for the LEDs */
> +		return 1;
> +
> +	default:
> +		return 0;

Please use true and false.


Takashi


More information about the Alsa-devel mailing list