From: "Fabio M. De Francesco" <fmdefrancesco@gmail.com>
To: Julia Lawall <julia.lawall@inria.fr>
Cc: Julia Lawall <julia.lawall@inria.fr>,
Greg KH <gregkh@linuxfoundation.org>,
outreachy-kernel@googlegroups.com, linux-staging@lists.linux.dev,
linux-kernel@vger.kernel.org
Subject: Re: [Outreachy kernel] [PATCH v3 4/4] staging: rtl8723bs: core: Change a controlling expression
Date: Sun, 11 Apr 2021 12:08:56 +0200 [thread overview]
Message-ID: <3322597.vpUxb0oOqP@localhost.localdomain> (raw)
In-Reply-To: <alpine.DEB.2.22.394.2104111150010.2854@hadrien>
On Sunday, April 11, 2021 11:51:32 AM CEST Julia Lawall wrote:
> On Sun, 11 Apr 2021, Fabio M. De Francesco wrote:
> > On Sunday, April 11, 2021 11:26:41 AM CEST Julia Lawall wrote:
> > > On Sun, 11 Apr 2021, Fabio M. De Francesco wrote:
> > > > Change a controlling expression within an 'if' statement: don't
> > > > compare
> > > > with 'true'.
> > > >
> > > > Signed-off-by: Fabio M. De Francesco <fmdefrancesco@gmail.com>
> > > > ---
> > > >
> > > > Changes from v2: Rewrite subject in patch 0/4; remove a patch from
> > > > the
> > > > series because it had already been applied (rtl8723bs: core: Remove
> > > > an
> > > > unused variable). Changes from v1: Fix a typo in subject of patch
> > > > 1/5,
> > > > add patch 5/5.>
> > > >
> > > > drivers/staging/rtl8723bs/core/rtw_cmd.c | 2 +-
> > > > 1 file changed, 1 insertion(+), 1 deletion(-)
> > > >
> > > > diff --git a/drivers/staging/rtl8723bs/core/rtw_cmd.c
> > > > b/drivers/staging/rtl8723bs/core/rtw_cmd.c index
> > > > 32079e0f71d5..600366cb1aeb 100644
> > > > --- a/drivers/staging/rtl8723bs/core/rtw_cmd.c
> > > > +++ b/drivers/staging/rtl8723bs/core/rtw_cmd.c
> > > > @@ -1507,7 +1507,7 @@ static void rtw_lps_change_dtim_hdl(struct
> > > > adapter *padapter, u8 dtim)>
> > > >
> > > > if (pwrpriv->dtim != dtim)
> > > >
> > > > pwrpriv->dtim = dtim;
> > > >
> > > > - if ((pwrpriv->fw_current_in_ps_mode == true) && (pwrpriv-
> > >
> > >pwr_mode >
> > >
> > > > PS_MODE_ACTIVE)) { + if ((pwrpriv->fw_current_in_ps_mode) &&
> > > > (pwrpriv->pwr_mode > PS_MODE_ACTIVE)) {
> > >
> > > The parentheses in the left argument of && can be dropped as well.
> >
> > What about the parentheses of the right argument? I'm not sure: does
> > '>'
> > have precedence over '&&'? Doesn't it?
>
> On the right they are not actually needed either:
>
So, I remembered well :)
>
> https://en.cppreference.com/w/c/language/operator_precedence
>
Very nice table. Thanks for the link.
>
> But you could look around in the code and see what people typically do.
> Perhaps one might find the parentheses more clear when there is a binary
> operator. But when there is no binary operator, they could be more
> confusing than useful.
>
When I look around in the code I see a lot of unnecessary parentheses.
What people typically do is not always the right thing. I prefer to remove
parentheses where they are redundant.
Thanks for your kind help,
Fabio
>
> julia
>
> > Thanks,
> >
> > Fabio
> >
> > > julia
> > >
> > > > u8 ps_mode = pwrpriv->pwr_mode;
> > > >
> > > > rtw_hal_set_hwreg(padapter, HW_VAR_H2C_FW_PWRMODE,
> >
> > (u8
> >
> > > > *)(&ps_mode));
> > > >
> > > > --
> > > > 2.31.1
> > > >
> > > > --
> > > > You received this message because you are subscribed to the Google
> > > > Groups "outreachy-kernel" group. To unsubscribe from this group and
> > > > stop receiving emails from it, send an email to
> > > > outreachy-kernel+unsubscribe@googlegroups.com. To view this
> > > > discussion
> > > > on the web visit
> > > > https://groups.google.com/d/msgid/outreachy-kernel/20210411082908.3
> > > > 187
> > > > 6-5-fmdefrancesco%40gmail.com.
next prev parent reply other threads:[~2021-04-11 10:08 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-11 8:29 [Outreachy kernel] [PATCH v3 0/4] staging: rtl8723bs: Change several files of the driver Fabio M. De Francesco
2021-04-11 8:29 ` [Outreachy kernel] [PATCH v3 1/4] staging: rtl8723bs: Remove camelcase in several files Fabio M. De Francesco
2021-04-11 8:29 ` [Outreachy kernel] [PATCH v3 2/4] staging: rtl8723bs: include: Fix misspelled words in comments Fabio M. De Francesco
2021-04-11 8:29 ` [Outreachy kernel] [PATCH v3 3/4] staging: rtl8723bs: Change the type and use of a variable Fabio M. De Francesco
2021-04-11 8:39 ` Greg KH
2021-04-11 8:29 ` [Outreachy kernel] [PATCH v3 4/4] staging: rtl8723bs: core: Change a controlling expression Fabio M. De Francesco
2021-04-11 9:26 ` Julia Lawall
2021-04-11 9:47 ` Fabio M. De Francesco
2021-04-11 9:51 ` Julia Lawall
2021-04-11 10:08 ` Fabio M. De Francesco [this message]
2021-04-11 10:10 ` Julia Lawall
2021-04-11 10:30 ` Fabio M. De Francesco
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3322597.vpUxb0oOqP@localhost.localdomain \
--to=fmdefrancesco@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=julia.lawall@inria.fr \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
--cc=outreachy-kernel@googlegroups.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.