Re: [PATCH V3] wfx: use container_of() to get vif

From: Greg Kroah-Hartman
Date: Tue Apr 12 2022 - 00:59:51 EST


On Tue, Apr 12, 2022 at 12:12:18AM -0400, 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@xxxxxxxxx>
> ---
>
> Changes in 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.
> (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 +-

This file is not in linux-next anymore.