linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Jérôme Pouiller" <jerome.pouiller@silabs.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org,
	outreachy@lists.linux.dev, Jaehee Park <jhpark1013@gmail.com>,
	Stefano Brivio <sbrivio@redhat.com>
Subject: Re: [PATCH V3] wfx: use container_of() to get vif
Date: Wed, 13 Apr 2022 09:26:45 +0200	[thread overview]
Message-ID: <2778504.mvXUDI8C0e@pc-42> (raw)
In-Reply-To: <20220412041218.GA2859599@jaehee-ThinkPad-X1-Extreme>

Hello Jaehee,

On Tuesday 12 April 2022 06:12:18 CEST Jaehee Park wrote:
> 
> Currently, upon virtual interface creation, wfx_add_interface() stores
> a reference to the corresponding struct ieee80211_vif in private data,
> for later usage. This is not needed when using the container_of
> construct. This construct already has all the info it needs to retrieve
> the reference to the corresponding struct from the offset that is
> already available, inherent in container_of(), between its type and
> member inputs (struct ieee80211_vif and drv_priv, respectively).
> Remove vif (which was previously storing the reference to the struct
> ieee80211_vif) from the struct wfx_vif, define a macro
> wvif_to_vif(wvif) for container_of(), and replace all wvif->vif with
> the newly defined container_of construct.
> 
> Signed-off-by: Jaehee Park <jhpark1013@gmail.com>
> ---
> 
> Changes in v3:
> - Made edits to the commit message.
> - Shortened the macro name from wvif_to_vif to to_vif.

hmm... wvif_to_vif() was fine for me (while to_vif() is a bit too
generic).

> - For functions that had more than one instance of vif, defined one
> reference vif at the beginning of the function and used that instead.

I suggest to declare a new variable even if there is only one instance
of vif. So:
  - the code is unified
  - it avoids the syntax foo(var)->bar

> - Broke the if-statements that ran long into two lines.
> (There are 3 lines that exceed 80 by less than 4 characters. Two of
> those lines of code could be shorted but it involved defining two more
> variables, and could potentially make the code less readable.)
> 
> Note: I will mail this patch to the wireless-next tree after testing.
> 
> 
>  drivers/staging/wfx/wfx.h     |  2 +-
>  drivers/staging/wfx/data_rx.c |  5 ++--
>  drivers/staging/wfx/data_tx.c |  2 +-
>  drivers/staging/wfx/key.c     |  2 +-
>  drivers/staging/wfx/queue.c   |  2 +-
>  drivers/staging/wfx/scan.c    | 10 +++++---
>  drivers/staging/wfx/sta.c     | 46 +++++++++++++++++++----------------
>  7 files changed, 38 insertions(+), 31 deletions(-)
> 
> diff --git a/drivers/staging/wfx/wfx.h b/drivers/staging/wfx/wfx.h
> index 78f2a416fe4f..a07baadc5e70 100644
> --- a/drivers/staging/wfx/wfx.h
> +++ b/drivers/staging/wfx/wfx.h
> @@ -25,7 +25,7 @@
>  #define USEC_PER_TXOP 32 /* see struct ieee80211_tx_queue_params */
>  #define USEC_PER_TU 1024
> 
> -#define wvif_to_vif(ptr)(container_of((void *)ptr, struct ieee80211_vif, drv_priv))
> +#define to_vif(wvif)container_of((void *)wvif, struct ieee80211_vif, drv_priv)

It seems you have stacked up this v3 on your v2. So this v3 does not apply
on any public tree. You have to merge your v2 and your v3.

> 
>  struct wfx_hwbus_ops;
> 
> diff --git a/drivers/staging/wfx/data_rx.c b/drivers/staging/wfx/data_rx.c
> index 98c2223089b8..3677b3431467 100644
> --- a/drivers/staging/wfx/data_rx.c
> +++ b/drivers/staging/wfx/data_rx.c

The wfx driver has moved, you have to rebase your work.

[...]

-- 
Jérôme Pouiller




  parent reply	other threads:[~2022-04-13  7:27 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-12  4:12 [PATCH V3] wfx: use container_of() to get vif Jaehee Park
2022-04-12  4:59 ` Greg Kroah-Hartman
2022-04-12  7:34 ` Dan Carpenter
2022-04-13  7:26 ` Jérôme Pouiller [this message]
2022-04-18  4:56   ` Jaehee Park

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=2778504.mvXUDI8C0e@pc-42 \
    --to=jerome.pouiller@silabs.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jhpark1013@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=outreachy@lists.linux.dev \
    --cc=sbrivio@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).