All of lore.kernel.org
 help / color / mirror / Atom feed
From: Julia Lawall <julia.lawall@inria.fr>
To: "Fabio M. De Francesco" <fmdefrancesco@gmail.com>
Cc: gregkh@linuxfoundation.org, outreachy-kernel@googlegroups.com
Subject: Re: [Outreachy kernel] [PATCH 4/4] staging: rtl8723bs: Change the type and use of a variable
Date: Sat, 10 Apr 2021 12:36:17 +0200 (CEST)	[thread overview]
Message-ID: <alpine.DEB.2.22.394.2104101231450.2975@hadrien> (raw)
In-Reply-To: <2763621.eYLsMQpWYC@localhost.localdomain>



On Sat, 10 Apr 2021, Fabio M. De Francesco wrote:

> On Saturday, April 10, 2021 12:03:14 PM CEST you wrote:
> > On Sat, 10 Apr 2021, Julia Lawall wrote:
> > > On Sat, 10 Apr 2021, Greg KH wrote:
> > > > On Sat, Apr 10, 2021 at 11:22:32AM +0200, Fabio M. De Francesco
> wrote:
> > > > > Change the type of fw_current_in_ps_mode from u8 to bool, because
> > > > > it is used everywhere as a bool and, accordingly, it should be
> > > > > declared as a bool. Shorten the controlling
> > > > > expression of an 'if' statement.
> > > > >
> > > > > Signed-off-by: Fabio M. De Francesco <fmdefrancesco@gmail.com>
> > > > > ---
> > > > >
> > > > >  drivers/staging/rtl8723bs/hal/hal_intf.c        | 2 +-
> > > > >  drivers/staging/rtl8723bs/include/rtw_pwrctrl.h | 2 +-
> > > > >  2 files changed, 2 insertions(+), 2 deletions(-)
> > > > >
> > > > > diff --git a/drivers/staging/rtl8723bs/hal/hal_intf.c
> > > > > b/drivers/staging/rtl8723bs/hal/hal_intf.c index
> > > > > 96fe172ced8d..8dc4dd8c6d4c 100644
> > > > > --- a/drivers/staging/rtl8723bs/hal/hal_intf.c
> > > > > +++ b/drivers/staging/rtl8723bs/hal/hal_intf.c
> > > > > @@ -348,7 +348,7 @@ void rtw_hal_dm_watchdog(struct adapter
> > > > > *padapter)
> > > > >
> > > > >  void rtw_hal_dm_watchdog_in_lps(struct adapter *padapter)
> > > > >  {
> > > > >
> > > > > -	if (adapter_to_pwrctl(padapter)->fw_current_in_ps_mode ==
> true) {
> > > > > +	if (adapter_to_pwrctl(padapter)->fw_current_in_ps_mode) {
> > > > >
> > > > >  		if (padapter->HalFunc.hal_dm_watchdog_in_lps)
> > > > >
> > > > >  			padapter-
> >HalFunc.hal_dm_watchdog_in_lps(padapter); /* this
> > > > >  			function caller is in interrupt context
> */> > >
> > > > >  	}
> > > > >
> > > > > diff --git a/drivers/staging/rtl8723bs/include/rtw_pwrctrl.h
> > > > > b/drivers/staging/rtl8723bs/include/rtw_pwrctrl.h index
> > > > > 0a48f1653be5..0767dbb84199 100644
> > > > > --- a/drivers/staging/rtl8723bs/include/rtw_pwrctrl.h
> > > > > +++ b/drivers/staging/rtl8723bs/include/rtw_pwrctrl.h
> > > > > @@ -203,7 +203,7 @@ struct pwrctrl_priv {
> > > > >
> > > > >  	u8 LpsIdleCount;
> > > > >  	u8 power_mgnt;
> > > > >  	u8 org_power_mgnt;
> > > > >
> > > > > -	u8 fw_current_in_ps_mode;
> > > > > +	bool fw_current_in_ps_mode;
> > > > >
> > > > >  	unsigned long	DelayLPSLastTimeStamp;
> > > > >  	s32		pnp_current_pwr_state;
> > > > >  	u8 pnp_bstop_trx;
> > > >
> > > > If this is only checked, how can it ever be true?  Who ever sets this
> > > > value?
> > >
> > > I think it's already updated everywhere with true and false, so there
> > > is
> > > nothing to change.  But it would be good to make that clear in the log
> > > message.
> >
> > Oops, I was thinking of the field, not the local variable.
> > If the field is never set, that seems like a big problem...
> >
> > julia
> >
> >
> Julia, I'm a bit confused...
>
> I've anew examined that line and noticed that fw_current_in_ps_mode is
> referenced by through a pointer returned by adapter_to_pwrctl(padapter).
> padapter is a pointer set in other files of the driver.
>
> To me it seems that is perfectly reasonable that, as a result,
> fw_current_in_ps_mode could be set (externally) either with true or false.
>
> I'm sure I'm missing something, since both you and Greg have a larger
> experience than I could ever have. Can you please elaborate this topic a
> bit more in order to make me understand whatever I can't see?

OK, I was just following my recollection of the code.  It seems that the
only thing that is needed is to explain in the log message how the
variable is initialized and why changing the type doesn't mean that you
have to change the initializations.  A weakness of the patch notation is
that you only see what changed, and not all of the code that is actually
relevant.  So if there is something that is not visible and that is
important to convince the reader that the change is correct, then it
should be mentioned in the log message.

Again, not having looked at the code, but does this pointer already have a
bool type?  Or does it have a u8 type?  Perhaps the pointer has to be
changed too?

julia


      reply	other threads:[~2021-04-10 10:36 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-10  9:22 [Outreachy kernel] [PATCH 0/4] staging: rtl8723bs: Change several files of the driver Fabio M. De Francesco
2021-04-10  9:22 ` [Outreachy kernel] [PATCH v7 1/3] staging: rtl8723bs: Remove camelcase in several files Fabio M. De Francesco
2021-04-10  9:32   ` Greg KH
2021-04-10  9:45     ` Fabio M. De Francesco
2021-04-10 10:32       ` Greg KH
2021-04-10  9:22 ` [Outreachy kernel] [PATCH 2/4] staging: rtl8723bs: include: Fix misspelled words in comments Fabio M. De Francesco
2021-04-10  9:22 ` [Outreachy kernel] [PATCH 3/4] staging: rtl8723bs: core: Remove an unused variable Fabio M. De Francesco
2021-04-10  9:22 ` [Outreachy kernel] [PATCH 4/4] staging: rtl8723bs: Change the type and use of a variable Fabio M. De Francesco
2021-04-10  9:31   ` Greg KH
2021-04-10  9:56     ` Fabio M. De Francesco
2021-04-10 10:31       ` Greg KH
2021-04-10 10:58         ` Fabio M. De Francesco
2021-04-10 11:03           ` Greg KH
2021-04-10 11:23             ` Fabio M. De Francesco
2021-04-10 11:33               ` Greg KH
2021-04-10 11:37               ` Julia Lawall
2021-04-10 11:37                 ` Julia Lawall
2021-04-10 12:01                 ` Fabio M. De Francesco
2021-04-10 12:12                   ` Julia Lawall
2021-04-10 12:12                     ` Julia Lawall
2021-04-10 13:02                     ` Fabio M. De Francesco
2021-04-10 13:24                       ` Julia Lawall
2021-04-10 13:24                         ` Julia Lawall
2021-04-10 13:53                         ` Fabio M. De Francesco
2021-04-10 13:55                           ` Greg KH
2021-04-10 14:01                           ` Julia Lawall
2021-04-10 14:01                             ` Julia Lawall
2021-04-10 10:02     ` Julia Lawall
2021-04-10 10:02       ` Julia Lawall
2021-04-10 10:03       ` Julia Lawall
2021-04-10 10:03         ` Julia Lawall
2021-04-10 10:30         ` Fabio M. De Francesco
2021-04-10 10:36           ` Julia Lawall [this message]

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=alpine.DEB.2.22.394.2104101231450.2975@hadrien \
    --to=julia.lawall@inria.fr \
    --cc=fmdefrancesco@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --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.