Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp4607194pxb; Wed, 20 Apr 2022 06:49:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxb4DzAH+ISkW656pekOsLUQoCbfhbbemf58QICAHr3ne+5Ny+v4XfLWvixidxYG+lVfYaB X-Received: by 2002:a17:906:9c82:b0:6df:baa2:9f75 with SMTP id fj2-20020a1709069c8200b006dfbaa29f75mr18331834ejc.762.1650462546205; Wed, 20 Apr 2022 06:49:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650462546; cv=none; d=google.com; s=arc-20160816; b=APLO4pEr6JCTiL3Q0ox9bCowFzYF1lCZXot9rxYwo7+76v8AMlSIMCdu750Qyen1hg f6/Ji63hkUy1XcFkqC6ibpweH3eC/jCKyEU6MReAxZh4PKHv51TaDUh5xclx7a89u+St gYCnQObcUWS4U4ls+1+yUTsi2LeI4KYwAf6lfOYd8gr6ILFRy4uv/54YLjc7+DxwXCTv utZ/kpG/zBm+LCynntfCUEF+0SPlpsbhThGt7chDC1GlzSQH0XgQIQYJXlzzSQPZC6ni F/VlDLVZFa/7RaVnfkWTHHweLWRpkah+wU2gX8M2Erpds4mSyvOiLhOVvIDoBoA3DcTM Qg+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:message-id:in-reply-to :date:references:subject:cc:to:from:dkim-signature; bh=nD1VB8rxpCNkrafIdbR+Q+q+Dld6jdLcs9VrytAJh44=; b=vZrSjSiRHv44VbbnTqo2P2RcGvrQP+jiTCZNc9xWCT+ueb+1XvzZ/cx8rOKO40qBnB 1ou7Aa9gP3qgREvx4CeyH6wUdGLnmqv1NKLOmGCmKTLVx1Qq0Of4LWGOkSmEn4J2tlNP CTg2zS1IT2WDDqCvmE4R5a9ByZjCdPqcqBBMzkqobJtUu2Algwascoeva9009gvsVpVx 7myJv6r/J47yvFCzzsyytAzeQNZtgRWFJrK2/tsLEw631heNms21TNRQW3MUlBxoHn5d VrSKbld0d9GvFLiF5csouHojpXafSt6TDtobESK8VTFlU5faahF+oMZ7u4d7eOdBF+h+ 1H/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=NfDGpu1q; 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=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u21-20020a1709064ad500b006df8c2d3fb6si1899986ejt.184.2022.04.20.06.48.49; Wed, 20 Apr 2022 06:49:06 -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=@kernel.org header.s=k20201202 header.b=NfDGpu1q; 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=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378358AbiDTMAw (ORCPT + 66 others); Wed, 20 Apr 2022 08:00:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37934 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376472AbiDTMAv (ORCPT ); Wed, 20 Apr 2022 08:00:51 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ED6561C90B; Wed, 20 Apr 2022 04:58:05 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8616F61956; Wed, 20 Apr 2022 11:58:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9F898C385A1; Wed, 20 Apr 2022 11:58:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1650455885; bh=jIZaCR72MF416k5GIz4UoDMTlUaPThfpK+9Q+0zcmnA=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=NfDGpu1qdTYrgU1CsS4C493/8J8g7H83U69IwcitBhqJRfSidYmtcLEanfyNq6EbH /5j8jbyJHH8uyMGmM3drZuhFOOARrXoDzSm70oiHYofgNXtYaMg2/VNW2z67PhjB0I L4DUYj6f0hTq6Sfnz8HGZXxpjbXVHN0HJugl5dQz+9BLCt7+wJqfKUSEnpiZDs6jNx 3gJe4Xxx/tDHdNnl+aFTdYKgEcKP2jUiI+AZRM/L6gbU9nXlrAYlFH0fGiCbef64I1 a1ftlEy/XIt2moCYmXDBBveAANFowT7iLF7M/MrDGdBnNUpN+L6ek8sv+HVoGaPnvt hZN/i+uTYH5bA== From: Kalle Valo To: Jaehee Park Cc: =?utf-8?B?SsOpcsO0bWU=?= 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 References: <20220418035110.GA937332@jaehee-ThinkPad-X1-Extreme> Date: Wed, 20 Apr 2022 14:57:57 +0300 In-Reply-To: <20220418035110.GA937332@jaehee-ThinkPad-X1-Extreme> (Jaehee Park's message of "Sun, 17 Apr 2022 23:51:10 -0400") Message-ID: <87y200nf0a.fsf@kernel.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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 Jaehee Park writes: > 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 [...] > +static inline struct ieee80211_vif *wvif_to_vif(struct wfx_vif *wvif) > +{ > + return container_of((void *)wvif, struct ieee80211_vif, drv_priv); > +} Why the void pointer cast? Avoid casts as much possible. -- https://patchwork.kernel.org/project/linux-wireless/list/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches