Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp318569pxb; Wed, 20 Apr 2022 23:48:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzUAlH58YXPy/hJDmq46XtZOZ7DwZw6vOJ1UR9B9kB08FR7h03zK3F/TEygh7cULisWv5nh X-Received: by 2002:a17:902:76ca:b0:157:1c6:5660 with SMTP id j10-20020a17090276ca00b0015701c65660mr23955839plt.105.1650523683413; Wed, 20 Apr 2022 23:48:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650523683; cv=none; d=google.com; s=arc-20160816; b=fqB5Vryo/vEhySftawOEr29x/YkM0zSKRahxa4hEeurCFC1qYGgMEKmvalqzpgmlwm UskYS8L6DAOZcOqIlGiNvWEN4tGG91UeMAe65ykCCRhIW2XVhzovGf/NBwtfQ9iLJFzE FCWDzq3C/rdKde44CSDkZFV2jja12G1aFI8hsKaHjCAtl/BaxqriiU671j2wkqpo7H1X XSsBX0hZSWr/fLdXir+b6RdpkLoXuHUlXUF3Y/iO2EZhNEbvuB7Lxo5jZogpcIWky27S YI5XuN/gwWye5wdS3veV9IHUDqwLfOVpphrvsPGn1WHzTkikyR6ctLGc2JIQboY+sqMm qzkg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Rfm74VEUMWZeXlpuLUyC+UQS6WldzCAHTX0ZUV4DSls=; b=sFBqm71eTWAIq5dsj5GVfXHDByiuhLbfOtnW1e9QXqkf66a4E+6kVzryL+SLKYAU4W 8tx+6d3UOfNkF1BcNaJo05YU+EsXvzmgO59jMCgF2FB/0Cj102OLnWD2iPBe8aVVu6Qp 2bHxAde9DkmcvcTMq7/doVvC7rFpaUlXgBVNY+P43FoTpusdGv3+lyL66iVLJrtKWk6n VqHCU3YFIMF77Rj3SWnVZidmjRMioXUJ447Q3iLi9xBNBK+em+IlO1cPf7o2i2Ezx8vq xVnzIR8Q2SIJHsgwQCRhxXSylr+lKuVCMh5LaDkzMx9XIAqqAygi+c4zpsge7sOibRSR lG0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=blpgcPwC; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f10-20020a170902ce8a00b00153b2d16643si4476308plg.587.2022.04.20.23.47.54; Wed, 20 Apr 2022 23:48:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=blpgcPwC; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1380790AbiDTQ4c (ORCPT + 67 others); Wed, 20 Apr 2022 12:56:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43330 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234342AbiDTQ4b (ORCPT ); Wed, 20 Apr 2022 12:56:31 -0400 Received: from mail-ej1-x629.google.com (mail-ej1-x629.google.com [IPv6:2a00:1450:4864:20::629]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5B8FB3E5C4; Wed, 20 Apr 2022 09:53:43 -0700 (PDT) Received: by mail-ej1-x629.google.com with SMTP id lc2so4733866ejb.12; Wed, 20 Apr 2022 09:53:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Rfm74VEUMWZeXlpuLUyC+UQS6WldzCAHTX0ZUV4DSls=; b=blpgcPwCTkxucUu2qZrWjwcq7sstE9xLRf5AbMMlxE8YZrJ0K0DNZxOq4mCHEiyIyZ XdoMlOsuUf/eyx3g2tt7V7BIGpKZARWCyw1YovPsqhkocExAa58e2kNc0dv0QBaUvZTa ObRRFqQ4FyNMmEiFGHCCqZyPP+x7gzFpMJbnyt2QOVwKfhkFb3cu+p9W2jcva0Vxo2JL lO9F9NUmdDYZfFpt3wm6+UBs1MD6omwNrsa9yUtpOxuAmZ8f7zy3kfQpG3afpx91hIaT XBh/sjnCyaTmpslP6liNlZldDuaPtD9AyVqE2rsH4dciA+m8PBxfVU+bGhG2acy4lRXn OzIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Rfm74VEUMWZeXlpuLUyC+UQS6WldzCAHTX0ZUV4DSls=; b=Ga428sQXnIt8y9TLN9dmCYe7YR4MYziCIzq3hq6bdMmKcZjyn51xtepg9cix9q1RA8 pkag3NnZqTrXRckXKQaAMxunTI6ms+d7r+DFWUXPYsFuoi7izJZpaDR5ftEtCEMKvCiX MWlGxUl0BholX0v6rqAxngtSDTAtbsCfYcGs8S1+4lm+WunImFlqgcZ42noHAHKGByPU y63dpo+dMTy5vkjtG5pEfJZSJoWtvrzTcaZCfaVBF1ZPHxU1KaYysuhW5jKs/FaIs6Et a18e+jT6b9HcTy9Pv4Y22CVLcFlyp/hVNjrp7owktUwWiOedrtEZPS5XKE6l/fR7n2C8 e3yg== X-Gm-Message-State: AOAM533pMuWmFHM8YB4K9t2ki8U9RAy6SevE0cKDGC0pvkmwPvcvu2Ef vET3Dw2uUYnREZoxJil+5dk= X-Received: by 2002:a17:907:6d96:b0:6e8:d7d9:d573 with SMTP id sb22-20020a1709076d9600b006e8d7d9d573mr19276189ejc.90.1650473621788; Wed, 20 Apr 2022 09:53:41 -0700 (PDT) Received: from leap.localnet (host-79-50-86-254.retail.telecomitalia.it. [79.50.86.254]) by smtp.gmail.com with ESMTPSA id ee17-20020a056402291100b0041fe1e4e342sm10006539edb.27.2022.04.20.09.53.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Apr 2022 09:53:40 -0700 (PDT) From: "Fabio M. De Francesco" To: Jaehee Park , Kalle Valo Cc: =?ISO-8859-1?Q?J=E9r=F4me?= Pouiller , "David S. Miller" , Jakub Kicinski , Paolo Abeni , linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-staging@lists.linux.dev, outreachy@lists.linux.dev, Stefano Brivio Subject: Re: [PATCH] wfx: use container_of() to get vif Date: Wed, 20 Apr 2022 18:53:39 +0200 Message-ID: <2258432.bcXerOTE6V@leap> In-Reply-To: <87y200nf0a.fsf@kernel.org> References: <20220418035110.GA937332@jaehee-ThinkPad-X1-Extreme> <87y200nf0a.fsf@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org On mercoled=C3=AC 20 aprile 2022 13:57:57 CEST Kalle Valo wrote: > Jaehee Park writes: >=20 > > 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 >=20 > [...] >=20 > > +static inline struct ieee80211_vif *wvif_to_vif(struct wfx_vif *wvif) > > +{ > > + return container_of((void *)wvif, struct ieee80211_vif,=20 drv_priv); > > +} >=20 > Why the void pointer cast? Avoid casts as much possible. In a previous email Jaehee wrote that she could compile her changes only by= =20 using that "(void *)" cast. I replied that probably this is a hint that something is broken, although=20 my argument is not necessarily a "proof". Might very well be that this cast= =20 was needed in this particular situation but I cannot see why. @Jaehee, please try to explain why this "(void *)" cast is actually=20 necessary and why your changes cannot avoid it. Thanks, =46abio M. De Francesco