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

From: Colin Vidal
Date: Tue Feb 02 2016 - 16:28:44 EST


On Tue, 2016-02-02 at 13:14 -0800, Joe Perches wrote:
> 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);
> }
>

Oh, yeah, the second one is obviously finer. If I'm right, I should
resend a new patch with a subject which looks something like "[PATCH
v2] ... " ?Â

Thanks