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

On Saturday, April 10, 2021 3:24:43 PM CEST Julia Lawall wrote:
> On Sat, 10 Apr 2021, Fabio M. De Francesco wrote:
> > On Saturday, April 10, 2021 2:12:28 PM CEST Julia Lawall wrote:
> > > On Sat, 10 Apr 2021, Fabio M. De Francesco wrote:
> > > > On Saturday, April 10, 2021 1:37:30 PM CEST Julia Lawall wrote:
> > > > > > That variable has global scope and is assigned at least in:
> > > > > What do you mean by global scope?  None of the following look
> > > > > like
> > > > > references to global variables.
> > > > > 
> > > > > julia
> > > > 
> > > > I just mean that fw_current_in_ps_mode is a field of a struct in a
> > > > .h
> > > > file included everywhere in this driver and that the functions whom
> > > > the following assignments belong to have not the "static" type
> > > > modifier.
> > > 
> > > OK, but a field in a structure is not a variable, and this is not
> > > what
> > > scope means.
> > 
> > You're right, a field in a structure is not a variable.
> > 
> > > int x;
> > > 
> > > outside of anything is a global variable (global scope).
> > > 
> > > int foo() {
> > > 
> > >   int x;
> > >   ...
> > > 
> > > }
> > > 
> > > Here x is a local variable.  Its scope is the body of the function.
> > > 
> > > int foo() {
> > > 
> > >   if (abc) {
> > >   
> > >     int x;
> > >     ...
> > >   
> > >   }
> > > 
> > > }
> > > 
> > > Here x is a local variable, but its scope is only in the if branch.
> > 
> > And you're right again: I needed a little refresh of my knowledge of C.
> > 
> > I've searched again in the code for the purpose of finding out if that
> > struct is initialized with global scope but I didn't find anything. I
> > didn't even find any dynamic allocation within functions that returns
> > pointers to that struct.
> > 
> > Therefore, according to Greg's request, I'll delete that stupid 'if'
> > statement in the patch series v2 that I'm about to submit.
> 
> I'm really not clear on why the if should be deleted.
> 
> julia
>
I'm supposed to delete it because of the review made by Greg. In a couple 
of previous messages he wrote:

"If this is only checked, how can it ever be true?  Who ever sets this 
value?"

and then:

"Just delete the variable from the structure entirely and when it is
used.".

However, like you, I'm not sure yet.

Thanks,

Fabio
> 
> > I've really appreciated your help.
> > 
> > Thanks,
> > 
> > Fabio
> > 
> > > julia
> > > 
> > > > Thanks,
> > > > 
> > > > Fabio
> > > > 
> > > > > > drivers/staging/rtl8723bs/core/rtw_pwrctrl.c:368:
> > > > > > pwrpriv->fw_current_in_ps_mode = false;
> > > > > > 
> > > > > > drivers/staging/rtl8723bs/core/rtw_pwrctrl.c:380:
> > > > > > pwrpriv->fw_current_in_ps_mode = true;
> > > > > > 
> > > > > > drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c:433:
> > > > > > adapter_to_pwrctl(padapter)->fw_current_in_ps_mode = false;
> > > > > > 
> > > > > > drivers/staging/rtl8723bs/core/rtw_pwrctrl.c:981:
> > > > > > pwrctrlpriv->fw_current_in_ps_mode = false;





  reply	other threads:[~2021-04-10 13:53 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 [this message]
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

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=3114102.qbl0ZuBMXl@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.