linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] usb: clock.c : usb true/false for bool return type
@ 2019-10-29  8:35 Saurav Girepunje
  2019-10-29  9:03 ` Takashi Iwai
  0 siblings, 1 reply; 2+ messages in thread
From: Saurav Girepunje @ 2019-10-29  8:35 UTC (permalink / raw)
  To: perex, tiwai, rfontana, saurav.girepunje, gregkh, allison, tglx,
	alsa-devel, linux-kernel
  Cc: saurav.girepunje

Use true/false for bool type return in uac_clock_source_is_valid().

Signed-off-by: Saurav Girepunje <saurav.girepunje@gmail.com>
---
 sound/usb/clock.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/sound/usb/clock.c b/sound/usb/clock.c
index 6b8c14f9b5d4..8b8ab83fac0d 100644
--- a/sound/usb/clock.c
+++ b/sound/usb/clock.c
@@ -165,21 +165,21 @@ static bool uac_clock_source_is_valid(struct snd_usb_audio *chip,
 			snd_usb_find_clock_source_v3(chip->ctrl_intf, source_id);
 
 		if (!cs_desc)
-			return 0;
+			return false;
 		bmControls = le32_to_cpu(cs_desc->bmControls);
 	} else { /* UAC_VERSION_1/2 */
 		struct uac_clock_source_descriptor *cs_desc =
 			snd_usb_find_clock_source(chip->ctrl_intf, source_id);
 
 		if (!cs_desc)
-			return 0;
+			return false;
 		bmControls = cs_desc->bmControls;
 	}
 
 	/* If a clock source can't tell us whether it's valid, we assume it is */
 	if (!uac_v2v3_control_is_readable(bmControls,
 				      UAC2_CS_CONTROL_CLOCK_VALID))
-		return 1;
+		return true;
 
 	err = snd_usb_ctl_msg(dev, usb_rcvctrlpipe(dev, 0), UAC2_CS_CUR,
 			      USB_TYPE_CLASS | USB_RECIP_INTERFACE | USB_DIR_IN,
@@ -191,10 +191,10 @@ static bool uac_clock_source_is_valid(struct snd_usb_audio *chip,
 		dev_warn(&dev->dev,
 			 "%s(): cannot get clock validity for id %d\n",
 			   __func__, source_id);
-		return 0;
+		return false;
 	}
 
-	return !!data;
+	return !!data ? true :  false;
 }
 
 static int __uac_clock_find_source(struct snd_usb_audio *chip, int entity_id,
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] usb: clock.c : usb true/false for bool return type
  2019-10-29  8:35 [PATCH] usb: clock.c : usb true/false for bool return type Saurav Girepunje
@ 2019-10-29  9:03 ` Takashi Iwai
  0 siblings, 0 replies; 2+ messages in thread
From: Takashi Iwai @ 2019-10-29  9:03 UTC (permalink / raw)
  To: Saurav Girepunje
  Cc: perex, tiwai, rfontana, gregkh, allison, tglx, alsa-devel,
	linux-kernel, saurav.girepunje

On Tue, 29 Oct 2019 09:35:11 +0100,
Saurav Girepunje wrote:
> 
> Use true/false for bool type return in uac_clock_source_is_valid().
> 
> Signed-off-by: Saurav Girepunje <saurav.girepunje@gmail.com>
> ---
>  sound/usb/clock.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/sound/usb/clock.c b/sound/usb/clock.c
> index 6b8c14f9b5d4..8b8ab83fac0d 100644
> --- a/sound/usb/clock.c
> +++ b/sound/usb/clock.c
> @@ -165,21 +165,21 @@ static bool uac_clock_source_is_valid(struct snd_usb_audio *chip,
>  			snd_usb_find_clock_source_v3(chip->ctrl_intf, source_id);
>  
>  		if (!cs_desc)
> -			return 0;
> +			return false;
>  		bmControls = le32_to_cpu(cs_desc->bmControls);
>  	} else { /* UAC_VERSION_1/2 */
>  		struct uac_clock_source_descriptor *cs_desc =
>  			snd_usb_find_clock_source(chip->ctrl_intf, source_id);
>  
>  		if (!cs_desc)
> -			return 0;
> +			return false;
>  		bmControls = cs_desc->bmControls;
>  	}
>  
>  	/* If a clock source can't tell us whether it's valid, we assume it is */
>  	if (!uac_v2v3_control_is_readable(bmControls,
>  				      UAC2_CS_CONTROL_CLOCK_VALID))
> -		return 1;
> +		return true;
>  
>  	err = snd_usb_ctl_msg(dev, usb_rcvctrlpipe(dev, 0), UAC2_CS_CUR,
>  			      USB_TYPE_CLASS | USB_RECIP_INTERFACE | USB_DIR_IN,
> @@ -191,10 +191,10 @@ static bool uac_clock_source_is_valid(struct snd_usb_audio *chip,
>  		dev_warn(&dev->dev,
>  			 "%s(): cannot get clock validity for id %d\n",
>  			   __func__, source_id);
> -		return 0;
> +		return false;
>  	}
>  
> -	return !!data;
> +	return !!data ? true :  false;

This doesn't need the ternary operator here.  Or drop "!!".

(Actually it would work just return data without "!!" for bool type,
 but maybe it's still clearer to have it.)

Also, please align the subject line with other commits.  For
USB-audio, it's "ALSA: usb-audio: Subject..."


thanks,

Takashi

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-10-29  9:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-29  8:35 [PATCH] usb: clock.c : usb true/false for bool return type Saurav Girepunje
2019-10-29  9:03 ` Takashi Iwai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).