LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] [Outreachy Kernel] Staging: wlan-ng: cfg80211: Fix Lines should not end with a '('
@ 2021-08-24 3:15 Tawah Peggy
2021-08-24 9:49 ` [Outreachy kernel] " Matthew Wilcox
0 siblings, 1 reply; 3+ messages in thread
From: Tawah Peggy @ 2021-08-24 3:15 UTC (permalink / raw)
To: Kroah-Hartman; +Cc: outreachy-kernel, linux-kernel
This patch fixes the checkpatch.pl warning:
CHECK: Lines should not end with a '(' .
Signed-off-by: Tawah Peggy <tawahpeggy98@gmail.com>
---
drivers/staging/wlan-ng/cfg80211.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/wlan-ng/cfg80211.c b/drivers/staging/wlan-ng/cfg80211.c
index 7951bd63816f..8d044e3fc2e8 100644
--- a/drivers/staging/wlan-ng/cfg80211.c
+++ b/drivers/staging/wlan-ng/cfg80211.c
@@ -328,8 +328,8 @@ static int prism2_scan(struct wiphy *wiphy,
(i < request->n_channels) && i < ARRAY_SIZE(prism2_channels);
i++)
msg1.channellist.data.data[i] =
- ieee80211_frequency_to_channel(
- request->channels[i]->center_freq);
+ ieee80211_frequency_to_channel
+ (request->channels[i]->center_freq);
msg1.channellist.data.len = request->n_channels;
msg1.maxchanneltime.data = 250;
--
2.25.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Outreachy kernel] [PATCH] [Outreachy Kernel] Staging: wlan-ng: cfg80211: Fix Lines should not end with a '('
2021-08-24 3:15 [PATCH] [Outreachy Kernel] Staging: wlan-ng: cfg80211: Fix Lines should not end with a '(' Tawah Peggy
@ 2021-08-24 9:49 ` Matthew Wilcox
[not found] ` <CADT-=4mWmUmBQtwwdRXUCPZfePbX6gQB_+ZrVwuE-GC=TYE2rw@mail.gmail.com>
0 siblings, 1 reply; 3+ messages in thread
From: Matthew Wilcox @ 2021-08-24 9:49 UTC (permalink / raw)
To: Tawah Peggy; +Cc: Kroah-Hartman, outreachy-kernel, linux-kernel
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.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Outreachy kernel] [PATCH] [Outreachy Kernel] Staging: wlan-ng: cfg80211: Fix Lines should not end with a '('
[not found] ` <CADT-=4mWmUmBQtwwdRXUCPZfePbX6gQB_+ZrVwuE-GC=TYE2rw@mail.gmail.com>
@ 2021-08-31 20:12 ` Matthew Wilcox
0 siblings, 0 replies; 3+ messages in thread
From: Matthew Wilcox @ 2021-08-31 20:12 UTC (permalink / raw)
To: Tawah Peggy; +Cc: outreachy-kernel, linux-kernel
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.
> >
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-08-31 20:13 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-24 3:15 [PATCH] [Outreachy Kernel] Staging: wlan-ng: cfg80211: Fix Lines should not end with a '(' 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 is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).