Received: by 2002:a05:6512:2355:0:0:0:0 with SMTP id p21csp106484lfu; Thu, 7 Apr 2022 22:19:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy7BuJksclN8AnXluNvP1RmVklSPeP6bayXKCSWqa+jjPBkQegYoFrrpS5nfH/6OUmKDIH8 X-Received: by 2002:a62:5343:0:b0:4f7:baad:5c22 with SMTP id h64-20020a625343000000b004f7baad5c22mr17650466pfb.30.1649395143281; Thu, 07 Apr 2022 22:19:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649395143; cv=none; d=google.com; s=arc-20160816; b=VJ0oilINUB3Hx05oQUdTSwOFUfKDPB/KChCL8WZ5W+X17ph5mGBneNKVLtPnh/AU6+ 3iSwvzvYTqmnyKrSpWBYbSOZRE8qiLHnWcdWWFVuZbvHnX1E17DHUHCu2dZGOGfAXoid Awlw//AOX2bY78WtMOZyAjg6+JVrOHThp8orQUnreTxL3GfEKWsIl7GHByMagLvt5+0C HVF/WEA02elxKeQZ50yZT2FaF/aQECiLnpMJ4FL5jILfa+ZcU8V4rV9pXTnoheIDIpRb yl7adV1z2XIa4rpVYcpGkzOxSXSsWc+Fc7uVnpak5+6keK6Y7erCJMoriTldQKWkkAzn 43Mw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=pq4NND+c4u+zdNx2zI0AkIyFhM4R9hTwvLBm/Ahc1Qs=; b=PAluXtd5H0ViZxAjYgECNcXykfcZZjpUfezoW9TgW8dcbTWFHRwZwnwuYEuiMVUNUC CTmr+D2M5IwJUSZeWg7GyepDDdlmo1LPzlBHbJ9y9pHExnbbKUFY2bHKGSLU76voHrPB tF2JlROae94HoqWvPsvdgT9gE9pMMuGlECKiwkNj9+esa+5McGxR44eioxv2QJd2uSXB UtitfNR5H/Qy4xKcDIfmpKmE1Yqg0XetqIsyLiZQYHhSSvZlLwhwP1BS+gkpqlW7zATe FyRgQbSWmrGY2q/tMjoteGNaqe2h3kw4ogIPbOS126oFmhjBuVdwf3btIH1q8dJDCfVf Jykw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=uuJu3pzZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id j13-20020a056a00234d00b004fe4e23e4f9si119283pfj.262.2022.04.07.22.19.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Apr 2022 22:19:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=uuJu3pzZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id B35312A22DD; Thu, 7 Apr 2022 21:46:07 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234335AbiDHEsD (ORCPT + 99 others); Fri, 8 Apr 2022 00:48:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50470 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234332AbiDHEsA (ORCPT ); Fri, 8 Apr 2022 00:48:00 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 95D1A29D5EA for ; Thu, 7 Apr 2022 21:45:56 -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 D958B61E86 for ; Fri, 8 Apr 2022 04:45:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E34DFC385A3; Fri, 8 Apr 2022 04:45:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649393155; bh=7lE1WpCl6Wiqc1IF6o6ROkQcTmCYCmlk5yThG4LhwDI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=uuJu3pzZADimLOrM+BO+8kpLs+0MgZud2+AAAxm7ReoOY5YQImOnFHlZMDQUN3VTl 5S/CpvmtpY8Bq5VJ3+qrN9K5fUM37sNEfk5GNw2moXv9YUAZDpbaELsI6gm44hvUBp BBXj3VKudp/7WW+fhqXNJyA2V8iQV03XPQcr3Sgk= Date: Fri, 8 Apr 2022 06:45:52 +0200 From: Greg Kroah-Hartman To: Jaehee Park Cc: =?iso-8859-1?B?Suly9G1l?= Pouiller , linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, outreachy@lists.linux.dev, Stefano Brivio Subject: Re: [PATCH v2] staging: wfx: use container_of() to get vif Message-ID: References: <20220408032349.GA2132476@jaehee-ThinkPad-X1-Extreme> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20220408032349.GA2132476@jaehee-ThinkPad-X1-Extreme> X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED autolearn=no 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-kernel@vger.kernel.org On Thu, Apr 07, 2022 at 11:23:49PM -0400, Jaehee Park wrote: > Use container_of() to get vif. This improves the code in two ways: > [1] it speeds up the compilation because container_of() saves steps to > retrieve vif (the representation of ieee80211_vif), and > [2] it eliminates the need to define multiple pointers. Previously, > after setting the pointer to drv_priv, another pointer had to be > defined by vif in struct wfx_vif to point back to ieee80211_vif. > Remove vif from the struct wfx_vif, define a macro wvif_to_vif(ptr) > for container_of(), and replace all wvif->vif with the newly defined > container_of() construct. > > Signed-off-by: Jaehee Park > --- > Note: > This is a revised patch to sequence the wfx.h file (with the new defines) to show up first on the diff, which makes the ordering of the diff more logical. > > Questions: > - These changes had built?without errors for me but it would be great if someone can test it on the actual hardware. > - We noticed that the?development of the wfx driver is happening in the netdev tree instead of Greg's tree. Do you suggest that I use the net-next tree for this change?? > https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git/log/drivers/staging/wfx > https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git/log/drivers/staging/wfx > > drivers/staging/wfx/wfx.h | 3 ++- > drivers/staging/wfx/data_rx.c | 4 ++-- > drivers/staging/wfx/data_tx.c | 2 +- > drivers/staging/wfx/key.c | 3 +-- > drivers/staging/wfx/queue.c | 2 +- > drivers/staging/wfx/scan.c | 6 ++--- > drivers/staging/wfx/sta.c | 45 ++++++++++++++++------------------- > 7 files changed, 31 insertions(+), 34 deletions(-) > > diff --git a/drivers/staging/wfx/wfx.h b/drivers/staging/wfx/wfx.h > index 6594cc647c2f..78f2a416fe4f 100644 > --- a/drivers/staging/wfx/wfx.h > +++ b/drivers/staging/wfx/wfx.h > @@ -25,6 +25,8 @@ > #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)) Always use whitespace properly. > struct wfx_hwbus_ops; > > struct wfx_dev { > @@ -61,7 +63,6 @@ struct wfx_dev { > > struct wfx_vif { > struct wfx_dev *wdev; > - struct ieee80211_vif *vif; You need to test this on real hardware. For an outreachy-first-task, this is not a good one at all. Also this code is no longer in drivers/staging/ Please work on the netdev mailing list as I can not take these changes anymore. good luck! greg k-h