Re: [PATCH 05/21] staging: ks7010: change if-else condition assignment to use ternary operator

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Apr 19, 2018 at 07:07:59AM +0200, Sergio Paracuellos wrote:
> This commit changes an if-else block used to just assign a
> variable to use a ternary operator to do the same improving
> readability.
> 
> Signed-off-by: Sergio Paracuellos <sergio.paracuellos@xxxxxxxxx>
> ---
>  drivers/staging/ks7010/ks_wlan_net.c | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/drivers/staging/ks7010/ks_wlan_net.c b/drivers/staging/ks7010/ks_wlan_net.c
> index af42cf6..53b580e 100644
> --- a/drivers/staging/ks7010/ks_wlan_net.c
> +++ b/drivers/staging/ks7010/ks_wlan_net.c
> @@ -673,10 +673,7 @@ static int ks_wlan_get_rate(struct net_device *dev,
>  		ks_wlan_update_phy_information(priv);
>  
>  	vwrq->value = ((priv->current_rate) & RATE_MASK) * 500000;
> -	if (priv->reg.tx_rate == TX_RATE_FIXED)
> -		vwrq->fixed = 1;
> -	else
> -		vwrq->fixed = 0;
> +	vwrq->fixed = (priv->reg.tx_rate == TX_RATE_FIXED) ? 1 : 0;

I noticed from earliyer patches that you're are a huge fan of ternaries.
To me it's basically the same readability before and after...  Maybe:

	vwrq->fixed = (priv->reg.tx_rate == TX_RATE_FIXED);

regards,
dan carpenter

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel



[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux