[PATCH] Staging: fix coding style in rtl8188eu/core

Joe Perches joe at perches.com
Tue Feb 2 21:14:25 UTC 2016


On Tue, 2016-02-02 at 21:57 +0100, Colin Vidal wrote:
> Set constant on the left of the test, and jump a new line to avoid to
> exceed the 80 char length limit.
[]
> diff --git a/drivers/staging/rtl8188eu/core/rtw_iol.c b/drivers/staging/rtl8188eu/core/rtw_iol.c
[]
> @@ -22,10 +22,11 @@
>  
>  bool rtw_IOL_applied(struct adapter  *adapter)
>  {
> -	if (1 == adapter->registrypriv.fw_iol)
> +	if (adapter->registrypriv.fw_iol == 1)
>  		return true;
>  
> -	if ((2 == adapter->registrypriv.fw_iol) && (!adapter_to_dvobj(adapter)->ishighspeed))
> +	if ((adapter->registrypriv.fw_iol == 2)
> +	    && (!adapter_to_dvobj(adapter)->ishighspeed))
>  		return true;
>  	return false;
>  }

Please review your patches with scripts/checkpatch.pl

Perhaps this is better as:

bool rtw_IOL_applied(struct adapter *adapter)
{
	if (adapter->registrypriv.fw_iol == 1)
		return true;

	if (adapter->registrypriv.fw_iol == 2 &&
	    !adapter_to_dvobj(adapter)->ishighspeed)
		return true;

	return false;
}

or maybe even

bool rtw_IOL_applied(struct adapter *adapter)
{
	return adapter->registrypriv.fw_iol == 1 ||
	       (adapter->registrypriv.fw_iol == 2 &&
		!adapter_to_dvobj(adapter)->ishighspeed);
}



More information about the devel mailing list