From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D851371 for ; Sun, 11 Apr 2021 10:10:18 +0000 (UTC) IronPort-HdrOrdr: =?us-ascii?q?A9a23=3A2MK58Kx3yaGu9Fy5jZ9dKrPwlr1zdoIgy1kn?= =?us-ascii?q?xilNYDZSddGVkN3roeQD2XbP+VEscVwDufTFF6mEXH/GnKQe3aA9H5eHGDPntm?= =?us-ascii?q?yhMZ144eLZrgHINiXi+odmtJtIXLN5DLTLbWRSqebfzE2GH807wN+BmZrY4dv2?= =?us-ascii?q?63t2VwllZ+VBwm5Ce2SmO3Z7TgVHGpY1faD0jqEqyQaIQ2gdbciwGxA+Lo3+ju?= =?us-ascii?q?DLj57vbFonABMq+WC1/EqVwYP6CBSR01MiVSpOy94ZgBD4ujH+j5/T0M2T+1v5?= =?us-ascii?q?32/X448+oqqG9vJzQPONkdQObg/nggGuaIkJYdK/gAw=3D?= X-IronPort-AV: E=Sophos;i="5.82,214,1613430000"; d="scan'208";a="502615288" Received: from 173.121.68.85.rev.sfr.net (HELO hadrien) ([85.68.121.173]) by mail2-relais-roc.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Apr 2021 12:10:17 +0200 Date: Sun, 11 Apr 2021 12:10:17 +0200 (CEST) From: Julia Lawall X-X-Sender: jll@hadrien To: "Fabio M. De Francesco" cc: Greg KH , 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 In-Reply-To: <3322597.vpUxb0oOqP@localhost.localdomain> Message-ID: References: <20210411082908.31876-1-fmdefrancesco@gmail.com> <2796632.fryDJISotm@localhost.localdomain> <3322597.vpUxb0oOqP@localhost.localdomain> User-Agent: Alpine 2.22 (DEB 394 2020-01-19) X-Mailing-List: linux-staging@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII On Sun, 11 Apr 2021, Fabio M. De Francesco wrote: > 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 > > > > > --- > > > > > > > > > > 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. Not sure I was clear. This driver seems to be very enthusiastic about parenttheses. But perhaps check in other more mature parts of the kernel. julia > > 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. > > > > > From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 6949457058068430848 X-Received: by 2002:adf:cd8c:: with SMTP id q12mr2708612wrj.328.1618135819292; Sun, 11 Apr 2021 03:10:19 -0700 (PDT) X-BeenThere: outreachy-kernel@googlegroups.com Received: by 2002:a5d:5348:: with SMTP id t8ls2508169wrv.2.gmail; Sun, 11 Apr 2021 03:10:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy/KtcD87kq4EO1mHf8CPfr8k/BHD6fRkJFpiF8fDv0dzwQuJeZWYt2+3+/sSOERt9uEdmz X-Received: by 2002:a05:6000:18cd:: with SMTP id w13mr25892339wrq.20.1618135817750; Sun, 11 Apr 2021 03:10:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618135817; cv=none; d=google.com; s=arc-20160816; b=RjZVO5focEt62/Ie50Um+89imbuklpoGzFJ8ITvMYKyVlOWqzdf1gAConVAoj6Ttl0 1jylSwGisp4SewM8LHPFZG4S+dWT/SNmb0Sl3DUrCyW1mwnilEnUYlAdTI1l2/UElLab NCsVAhJKHSho2q0dIRCPqoal8DDvZHpvWHBTF9nwVHIt6UMuUbMUZFi3pR3wC8fXGZLH DU19GUkb6J5FA2Nc63BXC3iC4mkDfULy7LfvGnMNxKfF52U8kL16UmdMtKUrKw4V9ODk Qf3mnTPDdxJzsLiPknIdHPAJ0bA3LjZpPEFkYMiNUSJakeVLOjo6PAgjSsoGCUosZz9P bhNg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:user-agent:references:message-id:in-reply-to:subject :cc:to:from:date:ironport-hdrordr; bh=B0MeFDQzDQxet4ElteY0m3TY0phM7YniBr83cL3udvA=; b=FOcAMQK7+x8BnBL1CO6BAOS40EBvpISu23Cz1eSS1yYAR2HltXsZchINXjAZ/MGkes qNUQxVxLVmMPL7eiic+d95lNXhEa75w7krKeW/sgTFHpO/rZaxijLPNzN4cIVaKvXELW aDIPOJ4jW2BZIImb2fj0duPIcaptsrjkA78AWrrN0YB1zwIwnG2/INpmsV5xNJ5ND+QS cCq1KWptEbPP+5RrC+DbjUuvGsm9+pGQspkz8EyjIiqvHvaef6YWa82QlxJOHLEKJz6D 5eUbs6DODhWbbX4RgYPj8bzOcgzb8rY/O4Ej9+WXDRwNcVyEAbz3XbPg3WyYM+j2DmZ/ 74hw== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of julia.lawall@inria.fr designates 192.134.164.83 as permitted sender) smtp.mailfrom=julia.lawall@inria.fr Return-Path: Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr. [192.134.164.83]) by gmr-mx.google.com with ESMTPS id t124si1081419wmb.3.2021.04.11.03.10.17 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 11 Apr 2021 03:10:17 -0700 (PDT) Received-SPF: pass (google.com: domain of julia.lawall@inria.fr designates 192.134.164.83 as permitted sender) client-ip=192.134.164.83; Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of julia.lawall@inria.fr designates 192.134.164.83 as permitted sender) smtp.mailfrom=julia.lawall@inria.fr IronPort-HdrOrdr: =?us-ascii?q?A9a23=3A2MK58Kx3yaGu9Fy5jZ9dKrPwlr1zdoIgy1kn?= =?us-ascii?q?xilNYDZSddGVkN3roeQD2XbP+VEscVwDufTFF6mEXH/GnKQe3aA9H5eHGDPntm?= =?us-ascii?q?yhMZ144eLZrgHINiXi+odmtJtIXLN5DLTLbWRSqebfzE2GH807wN+BmZrY4dv2?= =?us-ascii?q?63t2VwllZ+VBwm5Ce2SmO3Z7TgVHGpY1faD0jqEqyQaIQ2gdbciwGxA+Lo3+ju?= =?us-ascii?q?DLj57vbFonABMq+WC1/EqVwYP6CBSR01MiVSpOy94ZgBD4ujH+j5/T0M2T+1v5?= =?us-ascii?q?32/X448+oqqG9vJzQPONkdQObg/nggGuaIkJYdK/gAw=3D?= X-IronPort-AV: E=Sophos;i="5.82,214,1613430000"; d="scan'208";a="502615288" Received: from 173.121.68.85.rev.sfr.net (HELO hadrien) ([85.68.121.173]) by mail2-relais-roc.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Apr 2021 12:10:17 +0200 Date: Sun, 11 Apr 2021 12:10:17 +0200 (CEST) From: Julia Lawall X-X-Sender: jll@hadrien To: "Fabio M. De Francesco" cc: Greg KH , 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 In-Reply-To: <3322597.vpUxb0oOqP@localhost.localdomain> Message-ID: References: <20210411082908.31876-1-fmdefrancesco@gmail.com> <2796632.fryDJISotm@localhost.localdomain> <3322597.vpUxb0oOqP@localhost.localdomain> User-Agent: Alpine 2.22 (DEB 394 2020-01-19) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII On Sun, 11 Apr 2021, Fabio M. De Francesco wrote: > 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 > > > > > --- > > > > > > > > > > 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. Not sure I was clear. This driver seems to be very enthusiastic about parenttheses. But perhaps check in other more mature parts of the kernel. julia > > 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. > > > > >