All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mike Rapoport <mike.rapoport@gmail.com>
To: Karolina Drobnik <karolinadrobnik@gmail.com>
Cc: Greg KH <gregkh@linuxfoundation.org>,
	Julia Lawall <julia.lawall@inria.fr>,
	outreachy-kernel@googlegroups.com,
	"forest@alittletooquiet.net" <forest@alittletooquiet.net>
Subject: Re: [Outreachy kernel] Re: [PATCH] staging: vt6655: Rename byPreambleType field
Date: Fri, 15 Oct 2021 11:52:57 +0300	[thread overview]
Message-ID: <YWlBadCKQ7mEnXJx@kernel.org> (raw)
In-Reply-To: <db3c6775c578eb0fc34726e7bfaa89b4267e30a9.camel@gmail.com>

On Fri, Oct 15, 2021 at 09:32:17AM +0100, Karolina Drobnik wrote:
> On Thu, 2021-10-14 at 19:53 +0200, Greg KH wrote:
> > Each patch should only do one logical thing.  And every "thing" you
> > do, has to be described in the changelog text.
> 
> Ah, I see. If this is the case, I'll leave tidying the comments up
> until the end of the cleanup work and make a patch of it.
> 
> 
> On Thu, 2021-10-14 at 20:40 +0200, Julia Lawall wrote:
> > > I saw that functions and parameters use it[1] so I deduced that
> > > "by" might stand for byte.
> >
> > OK, I see your point.  I originally thought that doing something by
> > the preamble type might be true or false.
> 
> Agree, in such case that would be a well-named variable.
> 
> > But it looks like the developers
> > have considered the use of booleans and that is not what they are�
> > using here, so it seems that my original idea was off the mark.
> 
> I read through the code and it looks like indeed the developers
> intended to use it as a boolean but this "by" didn't mean to mark it as
> a predicate (if that makes sense).
> 
> > There is also this code:
> >
> > vt6655/rxtx.c:          priv->byPreambleType = PREAMBLE_SHORT;
> > vt6655/rxtx.c:          priv->byPreambleType = PREAMBLE_LONG;
> >
> > PREAMBLE_SHORT seems to be 3, which is not a boolean.
> 
> Not sure how I missed that, thanks for digging it out.�
> Hmm, but in baseband.h they are defined as 1 and 0:
> 
> ```
> #define PREAMBLE_LONG   0
> #define PREAMBLE_SHORT  1
> ```
> 
> Or am I looking at the wrong definition?
> 
> > There is also
> > vt6655/rxtx.c:  return cpu_to_le16(wTimeStampOff[priv->byPreambleType
> > % 2]
> > which also makes no sense for a boolean.
> 
> `wTimeStampOff`, defined in rxtx.c, line 57, stores two arrays of
> shorts, first for the long preamble and second for the short one. That
> modulo confuses me because if we were to take these values as they are,
> we'd get the right array anyway. Or maybe there's something more to
> it/I am misreading it.
> 
> It looks like there are two issues here:
> 1) Probably we're dealing with a predicate so "byPreableType" can keep
> its "by" prefix
> 2) This variable is not defined as a boolean but it looks like it
> should
> 
> For this patch, I think I can add `by` back, so `byPreambleType`
> becomes `by_preamble_type` and exclude the space change pointed out by
> Greg. After doing this, I can take a look and try to define this member
> as a boolean. To be honest, I'm worried of doing so as there's no way
> for me to test it.
> 
> What do you think about this?

AFAIU, this variable defines what type of a preamble will a packet have and
its value determined by a bit in WiFi packet header. In a sense it's a
boolean, but it's perfectly fine to use u8 and 0 and 1 for it.

I'd say keep it u8 and rename byPreambleType to preamble_type.

-- 
Sincerely yours,
Mike.


  parent reply	other threads:[~2021-10-15  8:53 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-14 15:15 [PATCH] staging: vt6655: Rename byPreambleType field Karolina Drobnik
2021-10-14 15:26 ` [Outreachy kernel] " Julia Lawall
2021-10-14 17:45   ` Karolina Drobnik
2021-10-14 18:40     ` Julia Lawall
2021-10-14 15:36 ` Greg KH
2021-10-14 17:47   ` Karolina Drobnik
2021-10-14 17:53     ` Greg KH
2021-10-15  8:32       ` Karolina Drobnik
2021-10-15  8:48         ` Julia Lawall
2021-10-15  8:52         ` Mike Rapoport [this message]
2021-10-15  9:32           ` [Outreachy kernel] " Karolina Drobnik
2021-10-15  9:33             ` 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=YWlBadCKQ7mEnXJx@kernel.org \
    --to=mike.rapoport@gmail.com \
    --cc=forest@alittletooquiet.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=julia.lawall@inria.fr \
    --cc=karolinadrobnik@gmail.com \
    --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.