mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: Tawah Peggy <tawahpeggy98@gmail.com>
Cc: outreachy-kernel@googlegroups.com, linux-kernel@vger.kernel.org
Subject: Re: [Outreachy kernel] [PATCH] [Outreachy Kernel] Staging: wlan-ng: cfg80211: Fix Lines should not end with a '('
Date: Tue, 31 Aug 2021 21:12:56 +0100	[thread overview]
Message-ID: <YS6NSLhZKx0mlcYC@casper.infradead.org> (raw)
In-Reply-To: <CADT-=4mWmUmBQtwwdRXUCPZfePbX6gQB_+ZrVwuE-GC=TYE2rw@mail.gmail.com>

On Mon, Aug 30, 2021 at 01:41:58PM +0100, Tawah Peggy wrote:
> Thanks for your feedback Mattew,
> please what approach do you suggest I use?

[please don't remove mailing lists; other people may benefit from the
answers to your questions]

There are a number of different approaches you can take to fixing this
kind of warning.

1. Reduce indentation.  This call seems to be indented 3-4 levels,
so maybe it would be good to pull part of this function out into
a helper function.

2. Use a local variable.
			type center_freq = request->channels[i]->center_freq;
			ieee80211_frequency_to_channel(center_freq);

3. Reduce the length of the function name.  ieee80211_frequency_to_channel
is quite a long identifier.  Maybe it would be worth renaming.

4. Introduce a helper function, eg

static inline foo something_to_channel(struct bar *channel)
{
	return ieee80211_frequency_to_channel(channel->center_freq);
}

...

			something_to_channel(request->channels[i]);

There's a judgement call to be made, and without looking at the function
in detail, I don't know which of these methods might be best.

> tawah peggy
> 
> On Tue, Aug 24, 2021 at 10:50 AM Matthew Wilcox <willy@infradead.org> wrote:
> 
> > On Tue, Aug 24, 2021 at 04:15:51AM +0100, Tawah Peggy wrote:
> > > -                     ieee80211_frequency_to_channel(
> > > -                             request->channels[i]->center_freq);
> > > +                     ieee80211_frequency_to_channel
> > > +                             (request->channels[i]->center_freq);
> >
> > This is the wrong way to fix this warning.  Function names should not be
> > divorced from their arguments.
> >

      parent reply	other threads:[~2021-08-31 20:13 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-24  3:15 Tawah Peggy
2021-08-24  9:49 ` [Outreachy kernel] " Matthew Wilcox
     [not found]   ` <CADT-=4mWmUmBQtwwdRXUCPZfePbX6gQB_+ZrVwuE-GC=TYE2rw@mail.gmail.com>
2021-08-31 20:12     ` Matthew Wilcox [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=YS6NSLhZKx0mlcYC@casper.infradead.org \
    --to=willy@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=outreachy-kernel@googlegroups.com \
    --cc=tawahpeggy98@gmail.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®