On Tuesday 3 May 2022 20:21:46 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 function
> wvif_to_vif(wvif) for container_of(), and replace all wvif->vif with
> the newly defined container_of construct.
>
> Signed-off-by: Jaehee Park <[email protected]>
> ---
> v2
> - Sequenced the wfx.h file (with the new defines) to show up first on
> the diff, which makes the ordering of the diff more logical.
>
> v3
> - Made edits to the commit message.
> - Shortened the macro name from wvif_to_vif to to_vif.
> - For functions that had more than one instance of vif, defined one
> reference vif at the beginning of the function and used that instead.
> - Broke the if-statements that ran long into two lines.
>
> v4
> - Changed macro into function and named it back to wvif_to_vif
> - Fit all lines in patch to 80 columns
> - Decared a reference to vif at the beginning of all the functions
> where it's being used
>
> v5
> - Placed longest declarations first
>
>
> drivers/net/wireless/silabs/wfx/wfx.h | 6 +-
> drivers/net/wireless/silabs/wfx/data_rx.c | 5 +-
> drivers/net/wireless/silabs/wfx/data_tx.c | 3 +-
> drivers/net/wireless/silabs/wfx/key.c | 4 +-
> drivers/net/wireless/silabs/wfx/queue.c | 3 +-
> drivers/net/wireless/silabs/wfx/scan.c | 11 ++--
> drivers/net/wireless/silabs/wfx/sta.c | 71 ++++++++++++++---------
> 7 files changed, 65 insertions(+), 38 deletions(-)
>
[...]
> diff --git a/drivers/net/wireless/silabs/wfx/sta.c b/drivers/net/wireless/silabs/wfx/sta.c
> index 3297d73c327a..040d1f9fb03a 100644
> --- a/drivers/net/wireless/silabs/wfx/sta.c
> +++ b/drivers/net/wireless/silabs/wfx/sta.c
> @@ -101,6 +101,7 @@ void wfx_configure_filter(struct ieee80211_hw *hw, unsigned int changed_flags,
> struct wfx_vif *wvif = NULL;
> struct wfx_dev *wdev = hw->priv;
> bool filter_bssid, filter_prbreq, filter_beacon;
> + struct ieee80211_vif *vif = wvif_to_vif(wvif);
wvif is modified later in the function, so this one is not correct.
--
J?r?me Pouiller
On Wed, May 04, 2022 at 09:21:21AM +0200, J?r?me Pouiller wrote:
> On Tuesday 3 May 2022 20:21:46 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 function
> > wvif_to_vif(wvif) for container_of(), and replace all wvif->vif with
> > the newly defined container_of construct.
> >
> > Signed-off-by: Jaehee Park <[email protected]>
> > ---
> > v2
> > - Sequenced the wfx.h file (with the new defines) to show up first on
> > the diff, which makes the ordering of the diff more logical.
> >
> > v3
> > - Made edits to the commit message.
> > - Shortened the macro name from wvif_to_vif to to_vif.
> > - For functions that had more than one instance of vif, defined one
> > reference vif at the beginning of the function and used that instead.
> > - Broke the if-statements that ran long into two lines.
> >
> > v4
> > - Changed macro into function and named it back to wvif_to_vif
> > - Fit all lines in patch to 80 columns
> > - Decared a reference to vif at the beginning of all the functions
> > where it's being used
> >
> > v5
> > - Placed longest declarations first
> >
> >
> > drivers/net/wireless/silabs/wfx/wfx.h | 6 +-
> > drivers/net/wireless/silabs/wfx/data_rx.c | 5 +-
> > drivers/net/wireless/silabs/wfx/data_tx.c | 3 +-
> > drivers/net/wireless/silabs/wfx/key.c | 4 +-
> > drivers/net/wireless/silabs/wfx/queue.c | 3 +-
> > drivers/net/wireless/silabs/wfx/scan.c | 11 ++--
> > drivers/net/wireless/silabs/wfx/sta.c | 71 ++++++++++++++---------
> > 7 files changed, 65 insertions(+), 38 deletions(-)
> >
> [...]
> > diff --git a/drivers/net/wireless/silabs/wfx/sta.c b/drivers/net/wireless/silabs/wfx/sta.c
> > index 3297d73c327a..040d1f9fb03a 100644
> > --- a/drivers/net/wireless/silabs/wfx/sta.c
> > +++ b/drivers/net/wireless/silabs/wfx/sta.c
> > @@ -101,6 +101,7 @@ void wfx_configure_filter(struct ieee80211_hw *hw, unsigned int changed_flags,
> > struct wfx_vif *wvif = NULL;
> > struct wfx_dev *wdev = hw->priv;
> > bool filter_bssid, filter_prbreq, filter_beacon;
> > + struct ieee80211_vif *vif = wvif_to_vif(wvif);
>
> wvif is modified later in the function, so this one is not correct.
>
Hi Jerome, I'm so sorry about this. I'll check more carefully and
correct for any other occurrences.
>
> --
> J?r?me Pouiller
>
>