Re: [PATCH v3 3/3] Staging: rtl8188eu: Bool tests don't need comparisons

From: Julia Lawall
Date: Sun Sep 13 2015 - 01:33:35 EST




On Sun, 13 Sep 2015, Shraddha Barke wrote:

>
>
> On Sat, Sep 12, 2015 at 11:07 PM, Julia Lawall <julia.lawall@xxxxxxx>
> wrote:
>
>
> On Sat, 12 Sep 2015, Shraddha Barke wrote:
>
> > This patch removes comparisons to true/false values on bool
> variables.
> >
> > Changes in v3-
> >Â Fix made manually
> >
> > Signed-off-by: Shraddha Barke <shraddha.6596@xxxxxxxxx>
> > ---
> > drivers/staging/rtl8188eu/core/rtw_cmd.c   Â| 12
> +++++------
> >Â drivers/staging/rtl8188eu/core/rtw_ioctl_set.c | 28
> +++++++++++++-------------
> >Â 2 files changed, 20 insertions(+), 20 deletions(-)
> >
> > diff --git a/drivers/staging/rtl8188eu/core/rtw_cmd.c
> b/drivers/staging/rtl8188eu/core/rtw_cmd.c
> > index 001a2f3..591ac5d 100644
> > --- a/drivers/staging/rtl8188eu/core/rtw_cmd.c
> > +++ b/drivers/staging/rtl8188eu/core/rtw_cmd.c
> > @@ -272,7 +272,7 @@ u8 rtw_sitesurvey_cmd(struct adapterÂ
> *padapter, struct ndis_802_11_ssid *ssid,
> >   Âstruct cmd_priv    Â*pcmdpriv = &padapter->cmdpriv;
> >   Âstruct mlme_priv    *pmlmepriv =
> &padapter->mlmepriv;
> >
> > -Â Â Âif (check_fwstate(pmlmepriv, _FW_LINKED) == true)
> > +Â Â Âif (check_fwstate(pmlmepriv, _FW_LINKED))
> >Â Â Â Â Â Â Â Ârtw_lps_ctrl_wk_cmd(padapter, LPS_CTRL_SCAN,
> 1);
> >
> >Â Â Â Âph2c = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC);
> > @@ -903,7 +903,7 @@ static void dynamic_chk_wk_hdl(struct
> adapter *padapter, u8 *pbuf, int sz)
> >Â Â Â Âpmlmepriv = &(padapter->mlmepriv);
> >
> >Â #ifdef CONFIG_88EU_AP_MODE
> > -Â Â Âif (check_fwstate(pmlmepriv, WIFI_AP_STATE) == true)
> > +Â Â Âif (check_fwstate(pmlmepriv, WIFI_AP_STATE))
> >Â Â Â Â Â Â Â Âexpire_timeout_chk(padapter);
> >Â #endif
> >
> > @@ -920,13 +920,13 @@ static void lps_ctrl_wk_hdl(struct
> adapter *padapter, u8 lps_ctrl_type)
> >Â Â Â Âu8Â Â Â mstatus;
> >
> >
> > -Â Â Âif ((check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE)
> == true) ||
> > -Â Â Â Â Â(check_fwstate(pmlmepriv, WIFI_ADHOC_STATE) ==
> true))
> > +Â Â Âif ((check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE))
> ||
> > +Â Â Â Â Â(check_fwstate(pmlmepriv, WIFI_ADHOC_STATE)))
>
> You don't need to keep the parentheses.
>
> julia
>
> I don't see extra parentheses. Aren't all of them needed to improve
> readability?

You have basically ((foo(1,2,3)) || (foo(4,5,6)))

I don't think that is more readable than (foo(1,2,3) || foo(4,5,6))

Actually, the parentheses weren't really needed before, but they are even
less useful now.

julia