Skip to contentSkip to conversation

Staging: wlan-ng: cfg80211: Fix Lines should not end with a '('

PATCH Superseded Tawah Peggy 2 participants 3 messages Aug 24, 2021 – Aug 31, 2021 1 message not in the archive Staging

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Staging: wlan-ng: cfg80211: Fix Lines should not end with a '('

This patch fixes the checkpatch.pl warning:

CHECK: Lines should not end with a '(' .

---
 drivers/staging/wlan-ng/cfg80211.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/wlan-ng/cfg80211.c +2 -2
index 7951bd63816f..8d044e3fc2e8 100644
@@ -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;
Signature · 1 line
2.25.1
#1 lore raw

drivers/staging/wlan-ng/cfg80211.c static int prism2_scan(struct wiphy *wiphy, · line 332

Quoted 4 lines · Tawah Peggy
drivers/staging/wlan-ng/cfg80211.c +2 -2
-			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.

A message that is not in the archive (sent off-list or not yet received): CADT-=4mWmUmBQtwwdRXUCPZfePbX6gQB_+ZrVwuE-GC=TYE2rw@mail.gmail.com

#3 lore raw
Quoted 2 lines · Tawah Peggy

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.

Quoted 13 lines

tawah peggy

Quoted 9 lines · Matthew Wilcox

drivers/staging/wlan-ng/cfg80211.c static int prism2_scan(struct wiphy *wiphy, · line 332

Quoted 4 lines · Tawah Peggy
drivers/staging/wlan-ng/cfg80211.c +2 -2
-                     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.