Received: by 2002:a05:6358:111d:b0:dc:6189:e246 with SMTP id f29csp911142rwi; Mon, 31 Oct 2022 08:59:57 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6IsjQx7tguGxGxWNnp9JDCn+uA/bOfjSkSoIZdASxeoqp4JRn91CiKWgKGF7jlfyfAMeOH X-Received: by 2002:a17:907:94c1:b0:792:56d7:2879 with SMTP id dn1-20020a17090794c100b0079256d72879mr14119269ejc.144.1667231997695; Mon, 31 Oct 2022 08:59:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667231997; cv=none; d=google.com; s=arc-20160816; b=sz6jEq0SZrQ9x3P21/o9rGMbgfcXsZKl+bRflRqhKfIg1oVtdyeS5uiukjYju8EQUJ qmzN+WON+BMXiUrS1XfGLKJSOMYC84KxBqzXLBRGQBSzNJ8+Iw5FmdWWww+JPia9kNfP Ql764EX6YN5RJB+OTQY9eqRHtdpqdI1+eETG/Q/UkRJvDfq26/Ehm8OADDSnehZBvmWj yW/N8hpvEh4gto7jCILfsBBW+nHEubUlQtWve+tM506Ix7NGXhMVZtOmw9Sxfc5UZG/1 spXJh1wt8S7+41yVptSrTtrrcjZCBklClNx2kiOMaFi0FGLHrKjW+uSUwBygyVJxy9cd Qnqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:message-id:in-reply-to :subject:cc:to:from:date:dkim-signature; bh=sKTqaSBEcn0IWYMabqYuftiIpKiuyEBRVfv2niEuE4o=; b=rUB1KOei6ThTR8WXyploJh3JTaISwZwRa7V4flyGbXPH5oLlKp3ZWrlmOQRUmTKxcH QeNkfAusr/ZvHtANdpLzczJS5Hbn/i6STdwhPi87WNjifV7/HLuL1nDMqK8h5ftCIa3s REkjnANamngemuTXd7ufwRad69wMjiEj6KZR4MSrgbE0yHufI/1xKB3swDqWE2as54S+ prMDtzROrNwi9tH+A9sdlw9LbRhzuUbThuN9liptUH7+5d9YiBviPMja6APG8WPkKYlm sa4+gWV1GlsEzqDi7uAlQ7zPrRKmI8RrlTxjBFJ6wx7JwC8YYh8kXsGtNj2ZghSobwd9 15Ug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@inria.fr header.s=dc header.b="FITU6U8/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=inria.fr Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s10-20020a056402520a00b00462a70e31f4si9545657edd.557.2022.10.31.08.59.33; Mon, 31 Oct 2022 08:59:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-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=@inria.fr header.s=dc header.b="FITU6U8/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=inria.fr Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231896AbiJaPh4 (ORCPT + 98 others); Mon, 31 Oct 2022 11:37:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43522 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230416AbiJaPhn (ORCPT ); Mon, 31 Oct 2022 11:37:43 -0400 Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BC9F9B4BE for ; Mon, 31 Oct 2022 08:37:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=inria.fr; s=dc; h=date:from:to:cc:subject:in-reply-to:message-id: references:mime-version; bh=sKTqaSBEcn0IWYMabqYuftiIpKiuyEBRVfv2niEuE4o=; b=FITU6U8/P7K6vWSxTRNGFLI4Sriu6OKExtoSnKyyNMJ4Nr2XiMoi7Ik8 K5WYuYN/74aSe0V9kg/l15Lhs05g5yIfkGQeJPJI20bi26QNDrFna0DBW qawOu4qBkVyvgrhmqzvtfTrCr5W57tN26QM7kLpE5eb//+bc8D/HkoUtE k=; Authentication-Results: mail3-relais-sop.national.inria.fr; dkim=none (message not signed) header.i=none; spf=SoftFail smtp.mailfrom=julia.lawall@inria.fr; dmarc=fail (p=none dis=none) d=inria.fr X-IronPort-AV: E=Sophos;i="5.95,228,1661810400"; d="scan'208";a="36113020" Received: from dt-lawall.paris.inria.fr ([128.93.67.65]) by mail3-relais-sop.national.inria.fr with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Oct 2022 16:37:39 +0100 Date: Mon, 31 Oct 2022 16:37:38 +0100 (CET) From: Julia Lawall To: Deepak R Varma cc: Greg Kroah-Hartman , outreachy@lists.linux.dev, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/2] staging: rtl8192u: remove unused macro definition In-Reply-To: Message-ID: <58624e76-aea8-4ed4-d6e-106cf77d629b@inria.fr> References: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,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-kernel@vger.kernel.org On Mon, 31 Oct 2022, Deepak R Varma wrote: > On Mon, Oct 31, 2022 at 03:55:59PM +0100, Julia Lawall wrote: > > > > > > On Mon, 31 Oct 2022, Deepak R Varma wrote: > > > > > On Fri, Oct 28, 2022 at 01:03:36AM +0530, Deepak Varma wrote: > > > > On Wed, Oct 26, 2022 at 03:55:01PM +0200, Greg Kroah-Hartman wrote: > > > > > On Wed, Oct 26, 2022 at 07:14:43PM +0530, Deepak R Varma wrote: > > > > > > On Wed, Oct 26, 2022 at 03:14:23PM +0200, Greg Kroah-Hartman wrote: > > > > > > > On Wed, Oct 26, 2022 at 08:58:44AM +0530, Deepak R Varma wrote: > > > > > > > > Pre-processor macros that are defined but are never used should be > > > > > > > > cleaned up to avoid unexpected usage. > > > > > > > > > > > > > > > > Signed-off-by: Deepak R Varma > > > > > > > > --- > > > > > > > > drivers/staging/rtl8192u/ieee80211/ieee80211.h | 2 -- > > > > > > > > 1 file changed, 2 deletions(-) > > > > > > > > > > > > > > > > diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211.h b/drivers/staging/rtl8192u/ieee80211/ieee80211.h > > > > > > > > index 00c07455cbb3..0b3dda59d7c0 100644 > > > > > > > > --- a/drivers/staging/rtl8192u/ieee80211/ieee80211.h > > > > > > > > +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211.h > > > > > > > > @@ -230,8 +230,6 @@ struct cb_desc { > > > > > > > > #define ieee80211_unregister_crypto_ops ieee80211_unregister_crypto_ops_rsl > > > > > > > > #define ieee80211_get_crypto_ops ieee80211_get_crypto_ops_rsl > > > > > > > > > > > > > > > > -#define ieee80211_ccmp_null ieee80211_ccmp_null_rsl > > > > > > > > - > > > > > > > > #define free_ieee80211 free_ieee80211_rsl > > > > > > > > #define alloc_ieee80211 alloc_ieee80211_rsl > > > > > > > > > > > > > > These #defines are a mess, please look into unwinding them as they > > > > > > > should not be needed at all. > > > > > > > > > > > > Hello Greg, > > > > > > I would like to know what you mean by "unwind them". Is there a documentation or past > > > > > > commit that I can review to understand the expectations better? > > > > > > > > > > Look at them and try to figure out why they are there, and then work to > > > > > remove them entirely. A define like this is very odd in the kernel, it > > > > > should not be needed at all, right? > > > > > > > > Hello Greg, > > > > I will look into these additional macros soon and send any further edits as a > > > > separate patch (set). Is the current patch set with 2 patches acceptable? > > > > > > > > Also, I am trying to get Coccinelle to work on my machine. Trying to work > > > > through strange issues. I will work on the macro unwinding task you suggested > > > > once a get the Coccinelle task completed. > > > > > > Hello Greg, > > > Most of these macro defines appear to be unused in the module anywhere. > > > I can simply delete the #defines for these and let the original function > > > names be retained. > > > The other way is to rename the functions by the defined value. So, we will have > > > to make the code change to use the foo_rsl symbol names at all places. This will > > > be a bigger change involving the API name change itself. > > > > I'm not sure to understand. In the case of > > My apologies for not being clear in my message. > > > > #define abc def > > > > If abc is never used, it would seem that you could just remove the macro > > definition. > > The module uses abc at all places in the code. It gets simply replaced by > abc_rsl symbol name at compile time. I am unable to determine the utility of > this compile time conversion. So, to clean it up, we can continue to use abc > in the code (by simply removing the #define line) or make code changes to use > abc_rsl (makes the #define line redundant and be deleted). > > Hope this helps. > My question: should we use abc or def in the code? The only hint I have form the > code comment is this line: > // added for kernel conflict > > > > > If abc is used, one might consider whether the renaming is worth it, or > > whether the abc's should be changed to def. Or maybe def is a very simple > > function, that just calls some standard kernel function like kfree, in > > which can you could get rid of both abc and def everywhere and just use > > kfree. > > > > It is often better to use standard functions, because it makes it easier > > for people to understand immediately what is going on. > > Thank you so much for the explanation. Since the initial intention is not clear > to me, I am unable to decide the go forward name for these functions. > > May I request to look at one of the macro implementations and make suggestion? Ah, ok I see, these macros replace both the names at the uses of eg free_ieee80211, but also the name at the point of the definition. But the name free_ieee80211 isn't used elsewhere in the kernel source tree, so it would seem that changing the name is useless. Maybe the purpose was to link this code with some other code that also uses the name free_ieee80211, but that other code doesn't seem to be part of the kernel. At least, you could propose a patch that removes these definitions and explains clearly what the impact is, and see if the maintainers of the driver complain. julia > > > > > julia > > > > > > > > > > I am unable to determine the initial intention as to why these #defines were > > > added. Can you please suggest what would be the recommended way for the clean up > > > of these unused macros? > > > > > > Thank you, > > > ./drv > > > > > > > > > > > Thank you, > > > > ./drv > > > > > > > > > > > > > > thanks, > > > > > > > > > > greg k-h > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > >