All of lore.kernel.org
 help / color / mirror / Atom feed
From: Deepak R Varma <drv@mailo.com>
To: Julia Lawall <julia.lawall@inria.fr>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	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
Date: Mon, 31 Oct 2022 21:38:12 +0530	[thread overview]
Message-ID: <Y1/y7J0RXqQOCit6@debian-BULLSEYE-live-builder-AMD64> (raw)
In-Reply-To: <58624e76-aea8-4ed4-d6e-106cf77d629b@inria.fr>

On Mon, Oct 31, 2022 at 04:37:38PM +0100, Julia Lawall wrote:
>
>
> 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 <drv@mailo.com>
> > > > > > > > > ---
> > > > > > > > >  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.

Thank you so much. I will send in the proposed patch shortly.

./drv

>
> 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
> > > > > >
> > > > >
> > > > >
> > > > >
> > > >
> > > >
> > > >
> > > >
> >
> >
> >
>



      reply	other threads:[~2022-10-31 16:08 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-26  3:26 [PATCH 0/2] staging: rtl8192u: unused code cleanup Deepak R Varma
2022-10-26  3:27 ` [PATCH 1/2] staging: rtl8192u: remove unnecessary function implementation Deepak R Varma
2022-10-26 10:44   ` Greg Kroah-Hartman
2022-10-26 12:12     ` Deepak R Varma
2022-10-26  3:28 ` [PATCH 2/2] staging: rtl8192u: remove unused macro definition Deepak R Varma
2022-10-26 13:14   ` Greg Kroah-Hartman
2022-10-26 13:44     ` Deepak R Varma
2022-10-26 13:55       ` Greg Kroah-Hartman
2022-10-27 19:33         ` Deepak R Varma
2022-10-31 14:45           ` Deepak R Varma
2022-10-31 14:55             ` Julia Lawall
2022-10-31 15:19               ` Deepak R Varma
2022-10-31 15:37                 ` Julia Lawall
2022-10-31 16:08                   ` Deepak R Varma [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Y1/y7J0RXqQOCit6@debian-BULLSEYE-live-builder-AMD64 \
    --to=drv@mailo.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=julia.lawall@inria.fr \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=outreachy@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.